mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-08 16:04:10 -08:00
Fixes dependency checker bugs
This commit is contained in:
parent
181e69f72d
commit
d9b7a87784
|
@ -43,7 +43,7 @@ public class ObjectNativeGenerator implements Generator, DependencyPlugin {
|
||||||
achieveClone(checker, method);
|
achieveClone(checker, method);
|
||||||
break;
|
break;
|
||||||
case "getClass":
|
case "getClass":
|
||||||
achieveGetClass(checker);
|
achieveGetClass(checker, method);
|
||||||
break;
|
break;
|
||||||
case "wrap":
|
case "wrap":
|
||||||
achieveWrap(checker, method);
|
achieveWrap(checker, method);
|
||||||
|
@ -60,11 +60,12 @@ public class ObjectNativeGenerator implements Generator, DependencyPlugin {
|
||||||
writer.append("return $rt_cls(").append(thisArg).append(".$class);").softNewLine();
|
writer.append("return $rt_cls(").append(thisArg).append(".$class);").softNewLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void achieveGetClass(DependencyChecker checker) {
|
private void achieveGetClass(DependencyChecker checker, MethodReference method) {
|
||||||
String classClass = "java.lang.Class";
|
String classClass = "java.lang.Class";
|
||||||
MethodReference method = new MethodReference(classClass, new MethodDescriptor("createNew",
|
MethodReference initMethod = new MethodReference(classClass, new MethodDescriptor("createNew",
|
||||||
ValueType.object(classClass)));
|
ValueType.object(classClass)));
|
||||||
checker.addEntryPoint(method);
|
checker.addEntryPoint(initMethod);
|
||||||
|
checker.attachMethodGraph(method).getResultNode().propagate("java.lang.Class");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateHashCode(GeneratorContext context, SourceWriter writer) {
|
private void generateHashCode(GeneratorContext context, SourceWriter writer) {
|
||||||
|
|
|
@ -75,6 +75,9 @@ class DependencyGraphBuilder {
|
||||||
System.out.println("Virtual call of " + methodDesc + " detected on " + node.getTag() + ". " +
|
System.out.println("Virtual call of " + methodDesc + " detected on " + node.getTag() + ". " +
|
||||||
"Target class is " + className);
|
"Target class is " + className);
|
||||||
}
|
}
|
||||||
|
if (className.startsWith("[")) {
|
||||||
|
className = "java.lang.Object";
|
||||||
|
}
|
||||||
MethodReference methodRef = new MethodReference(className, methodDesc);
|
MethodReference methodRef = new MethodReference(className, methodDesc);
|
||||||
MethodHolder method = findMethod(methodRef, checker.getClassSource());
|
MethodHolder method = findMethod(methodRef, checker.getClassSource());
|
||||||
if (method == null) {
|
if (method == null) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user