[java] Improve how we deal with broken classes#1133
Merged
Conversation
adangel
reviewed
May 23, 2018
adangel
left a comment
Member
There was a problem hiding this comment.
The change makes sense to me.
I had a look, where else we catch "ClassNotFoundException":
- - But that looks ok, because we use in most cases "our" PMDASMClassLoader, which rethrows NoClassDefFoundError as ClassNotFoundException.
-
https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/TypeSet.java - which is used by the symbol table, but loads classes from PMDASMClassLoader
-
We maybe should deal with LinkageError in TypeHelper, though:
| @@ -1246,6 +1251,13 @@ private void populateType(TypeNode node, String className, int arrayDimens) { | |||
| myType = pmdClassLoader.loadClass(qualifiedNameInner); | |||
| } catch (Exception ignored) { | |||
Member
There was a problem hiding this comment.
We should probable catch here just "ClassNotFoundException", too - at least, to make it consistent...
Member
Author
|
I did the change to |
Member
Author
|
@adangel there you go! thanks! |
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.
NoClassDefFoundErrorasClassNotFoundException, which is wrong and may lead us to believe a class doesn't exist when it's simply missing some pieces. I think this refactor is too large to make it into 6.4.0, but the quick fix here provided should be ok and get value to our users ASAP.