diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/TypeSet.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/TypeSet.java index 0bb46bbe36..8fe242bac4 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/TypeSet.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/TypeSet.java @@ -532,6 +532,9 @@ public class TypeSet { return resolver.resolve(name); } catch (ClassNotFoundException cnfe) { // ignored, maybe another resolver will find the class + } catch (LinkageError le) { + // we found the class, but there is a problem with it (see https://github.com/pmd/pmd/issues/328) + return null; } } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java index d2b13a091a..c5206c56bf 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java @@ -1298,8 +1298,6 @@ public class ClassTypeResolver extends JavaParserVisitorAdapter { myType = pmdClassLoader.loadClass(qualifiedName); } catch (ClassNotFoundException e) { myType = processOnDemand(qualifiedName); - } catch (NoClassDefFoundError e) { - myType = processOnDemand(qualifiedName); } catch (LinkageError e) { myType = processOnDemand(qualifiedName); } @@ -1430,7 +1428,7 @@ public class ClassTypeResolver extends JavaParserVisitorAdapter { String strName = anImportDeclaration.getImportedName(); String fieldName = strName.substring(strName.lastIndexOf('.') + 1); - Class staticClassWithField = loadClass(strPackage); + Class staticClassWithField = loadClass(strPackage); if (staticClassWithField != null) { JavaTypeDefinition typeDef = getFieldType(JavaTypeDefinition.forClass(staticClassWithField), fieldName, currentAcu.getType());