CadixDev / Mercury

A source transformation and -remapping framework for Java.
Eclipse Public License 2.0
54 stars 23 forks source link

Mercury crashes with null getBinaryName() on missing classes #1

Closed asiekierka closed 4 years ago

asiekierka commented 5 years ago

Whether or not this is intended behaviour is debatable - as there are potential legitimate use-cases for this (in my case: I'm distributing a loader which has an optional dependency that is only pulled in sometimes, yet the source is always remapped), I think it should be at least an option with potential problems (such as not catching superclasses on which missing classes are on the chain) explained to the API user.

Hotfix I made for personal use, might be helpful: https://github.com/asiekierka/Mercury/commit/c13660eb77f19e7fc4f4dddc512d4b5cd2d005df

stephan-gh commented 5 years ago

Hmm, yeah. I think this should be an option somewhere on Mercury disabled by default. It should also enable/disable https://github.com/CadixDev/Mercury/blob/51dd8f68fb881f787f1b3e72f101fc5c05fede44/src/main/java/org/cadixdev/mercury/Mercury.java#L168 which is likely the reason why you are getting these NPEs. (Otherwise it would fail much earlier while parsing)

asiekierka commented 5 years ago

Yes. That'd be great!

jamierocks commented 4 years ago

Okay, I've added a configuration toggle to Mercury with the same coverage as the hotfix originally supplied. If further coverage is requires, please follow up to this issue.

final Mercury mercury = new Mercury();
mercury.setGracefulClasspathChecks(true);
// whatever