mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-08 07:54:11 -08:00
Fix NPE when there are build errors related to lack of reflection support
This commit is contained in:
parent
bb55089742
commit
cdffb779e0
|
@ -113,10 +113,12 @@ 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());
|
||||||
|
if (cls != null) {
|
||||||
for (FieldReader field : cls.getFields()) {
|
for (FieldReader field : cls.getFields()) {
|
||||||
linkType(agent, field.getType());
|
linkType(agent, field.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else if (method.getReference().equals(getConstructors) || method.getReference().equals(getMethods)) {
|
} else if (method.getReference().equals(getConstructors) || method.getReference().equals(getMethods)) {
|
||||||
method.getVariable(0).getClassValueNode().addConsumer(type -> {
|
method.getVariable(0).getClassValueNode().addConsumer(type -> {
|
||||||
|
@ -124,6 +126,7 @@ 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());
|
||||||
|
if (cls != null) {
|
||||||
for (MethodReader reflectableMethod : cls.getMethods()) {
|
for (MethodReader reflectableMethod : cls.getMethods()) {
|
||||||
linkType(agent, reflectableMethod.getResultType());
|
linkType(agent, reflectableMethod.getResultType());
|
||||||
for (ValueType param : reflectableMethod.getParameterTypes()) {
|
for (ValueType param : reflectableMethod.getParameterTypes()) {
|
||||||
|
@ -131,6 +134,7 @@ public class ReflectionDependencyListener extends AbstractDependencyListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else if (method.getReference().equals(forName) || method.getReference().equals(forNameShort)) {
|
} else if (method.getReference().equals(forName) || method.getReference().equals(forNameShort)) {
|
||||||
allClasses.connect(method.getResult().getClassValueNode());
|
allClasses.connect(method.getResult().getClassValueNode());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user