Fix NPE when there are build errors related to lack of reflection support

This commit is contained in:
Alexey Andreev 2018-06-18 13:40:00 +03:00
parent bb55089742
commit cdffb779e0

View File

@ -113,8 +113,10 @@ public class ReflectionDependencyListener extends AbstractDependencyListener {
classesWithReflectableFields.add(type.getName()); classesWithReflectableFields.add(type.getName());
ClassReader cls = agent.getClassSource().get(type.getName()); ClassReader cls = agent.getClassSource().get(type.getName());
for (FieldReader field : cls.getFields()) { if (cls != null) {
linkType(agent, field.getType()); for (FieldReader field : cls.getFields()) {
linkType(agent, field.getType());
}
} }
} }
}); });
@ -124,10 +126,12 @@ public class ReflectionDependencyListener extends AbstractDependencyListener {
classesWithReflectableMethods.add(type.getName()); classesWithReflectableMethods.add(type.getName());
ClassReader cls = agent.getClassSource().get(type.getName()); ClassReader cls = agent.getClassSource().get(type.getName());
for (MethodReader reflectableMethod : cls.getMethods()) { if (cls != null) {
linkType(agent, reflectableMethod.getResultType()); for (MethodReader reflectableMethod : cls.getMethods()) {
for (ValueType param : reflectableMethod.getParameterTypes()) { linkType(agent, reflectableMethod.getResultType());
linkType(agent, param); for (ValueType param : reflectableMethod.getParameterTypes()) {
linkType(agent, param);
}
} }
} }
} }