[java] Fix NoClassDefFoundErrors#2685
Merged
Merged
Conversation
Generated by 🚫 Danger |
oowekyala
reviewed
Aug 11, 2020
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the PR
When determining methods/fields by reflection, we could run into situations, that the classes, that are referenced in the methods (e.g. parameter types, return types) are not on the auxclasspath. Then a LinkageError is thrown, which was not handled before.
The reason, why the types are missing on the auxclasspath is actually a valid case: As long as the methods are not used in the code, the referenced classes neither need to be on the compile classpath. And we use the compile classpath as our auxclasspath.
This can happen, if a project uses a provided dependency and this dependency has other transitive dependencies. These transitive dependencies are not on the compile classpath.
This PR fixes the problem in ImportWrapper as well as in two other cases, where we use reflection.
Related issues
Ready?
./mvnw clean verifypasses (checked automatically by travis)