Merge branch 'pr-950'

This commit is contained in:
Clément Fournier
2018-03-05 14:42:21 +01:00
2 changed files with 8 additions and 9 deletions

View File

@@ -204,11 +204,7 @@ public class ClassTypeResolver extends JavaParserVisitorAdapter {
if (className != null) {
populateClassName(node, className);
}
} catch (ClassNotFoundException e) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "Could not find class " + className + ", due to: " + e);
}
} catch (NoClassDefFoundError e) {
} catch (ClassNotFoundException | NoClassDefFoundError e) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "Could not find class " + className + ", due to: " + e);
}
@@ -1344,9 +1340,7 @@ public class ClassTypeResolver extends JavaParserVisitorAdapter {
try {
pmdClassLoader.loadClass(fullyQualifiedClassName);
return true; // Class found
} catch (ClassNotFoundException e) {
return false;
} catch (NoClassDefFoundError e) {
} catch (ClassNotFoundException | NoClassDefFoundError e) {
return false;
}
}

View File

@@ -62,7 +62,12 @@ public abstract class JavaTypeDefinition implements TypeDefinition {
return typeDef;
}
final JavaTypeDefinition newDef = new JavaTypeDefinitionSimple(clazz);
final JavaTypeDefinition newDef;
try {
newDef = new JavaTypeDefinitionSimple(clazz);
} catch (final NoClassDefFoundError e) {
return null; // Can happen if a parent class references a class not in classpath
}
CLASS_EXACT_TYPE_DEF_CACHE.put(clazz, newDef);