shevek / jarjar

Jar Jar Links is a utility that makes it easy to repackage Java libraries and embed them into your own distribution.
Apache License 2.0
735 stars 93 forks source link

Escape class name components #4

Closed alexarchambault closed 5 years ago

alexarchambault commented 7 years ago

This PR proposes to escape the class name components prior to passing them to regexes.

For standard / usual class names, this shouldn't change the current behavior.

For class names having non standard characters ($ in particular), this allows to shade these with jarjar. Without this PR, these are currently simply not escaped (as the $ signs get interpreted as end-of-line from the regexes).

I'm kind of new to this codebase, any direction would be welcome about where and how to add non regression tests for these (unless I'm mistaken, I couldn't find a comprehensive test suite in the current code).

shevek commented 5 years ago

This whole section of the code needs significant testing if we're going to keep it stable and merge many more PRs, but I'm going to merge this for now based on inspection.

shevek commented 5 years ago

Note please that another patch which handled $ slightly differently went in as #5 - it may be that we have a specification round and the behaviour becomes documented and canonical between you and @zawn