- Allow for references to classes not in the classpath
This commit is contained in:
Juan Martín Sotuyo Dodero
2017-06-29 20:35:20 -03:00
parent 3bd69b15f1
commit b6482bb33b
2 changed files with 7 additions and 1 deletions

View File

@ -333,7 +333,12 @@ public class ClassTypeResolver extends JavaParserVisitorAdapter {
if (isMemberVisibleFromClass(typeToSearch.getType(), field.getModifiers(), accessingClass)) { if (isMemberVisibleFromClass(typeToSearch.getType(), field.getModifiers(), accessingClass)) {
return typeToSearch.resolveTypeDefinition(field.getGenericType()); return typeToSearch.resolveTypeDefinition(field.getGenericType());
} }
} catch (NoSuchFieldException e) { /* swallow */ } } catch (final NoSuchFieldException ignored) {
// swallow
} catch (final NoClassDefFoundError e) {
// TODO : report a missing class once we start doing that...
return null;
}
// transform the type into it's supertype // transform the type into it's supertype
typeToSearch = typeToSearch.resolveTypeDefinition(typeToSearch.getType().getGenericSuperclass()); typeToSearch = typeToSearch.resolveTypeDefinition(typeToSearch.getType().getGenericSuperclass());

View File

@ -5,6 +5,7 @@
package net.sourceforge.pmd.typeresolution; package net.sourceforge.pmd.typeresolution;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame; import static org.junit.Assert.assertSame;