-
Notifications
You must be signed in to change notification settings - Fork 3.1k
allow use of dollar signs in processed class names #501
Conversation
That wasn't as easy as I was hoping it to be! I assume you didn't see something dumb we were doing that could have made this easier? |
@swankjesse, my first approach I ended up tossing because it seemed riskier: it was to change the format of the key strings so that type names get encoded with slashes in the package (instead of dots) and nested classes are separated with dots (instead of dollars). For example But this was a bigger and more complicated change which had a couple of big downsides:
The latter point seemed riskiest because it doesn't seem easy to test. I suppose I could have added support for a system property to force it to generate keys in the legacy format. Then a unit test could run the compiler both ways and verify that the runtime works regardless of the key format that appears in generated code. (Easier to do, but less thorough, would be to just have unit tests for all of the methods in So, all said and done, this seemed a lot easier. It does more work in pathological cases (like a class name with a silly number of dollar signs), but in practice should be the same as without the fix since it does at least first check the version of the name with all dollars replaced with dots. Also, this is not unlike the work that javac must do to resolve a class use into a binary name (it does the inverse work; naively it must do more since there are many more dots that may potentially need to be converted to dollars, but it can employ techniques to prune the search space that I don't think can apply here). |
BTW, any tips on getting travis-ci to go green -- is it flaky? That test passes fine locally, and the error message in travis-ci is cryptic enough that I don't know where to start debugging. |
Hmm |
Full exception is:
|
59c50c4
to
3f0db82
Compare
The issue in CI was a bug in javac. I put together a trivial repro case and filed a bug with Oracle. Under some conditions, it can throw instead of return null when asking I hacked in a work-around here. |
allow use of dollar signs in processed class names
@swankjesse @JakeWharton