mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fix metaprogramming support, fix calculation of virtual tables for final classes
This commit is contained in:
parent
2e59db3ab9
commit
8c15885f44
|
@ -130,9 +130,6 @@ public class VirtualTableBuilder {
|
||||||
var methodsAtCallSites = methodsUsedAtCallSites.get(className);
|
var methodsAtCallSites = methodsUsedAtCallSites.get(className);
|
||||||
if (methodsAtCallSites != null) {
|
if (methodsAtCallSites != null) {
|
||||||
for (MethodDescriptor methodDesc : methodsAtCallSites) {
|
for (MethodDescriptor methodDesc : methodsAtCallSites) {
|
||||||
if (cls.hasModifier(ElementModifier.FINAL) && !table.entries.containsKey(methodDesc)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
MethodReader method = cls.getMethod(methodDesc);
|
MethodReader method = cls.getMethod(methodDesc);
|
||||||
if (method != null && method.getLevel() == AccessLevel.PRIVATE) {
|
if (method != null && method.getLevel() == AccessLevel.PRIVATE) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -94,10 +94,11 @@ public class MetaprogrammingDependencyListener extends AbstractDependencyListene
|
||||||
if (model.getUsages().size() == 1) {
|
if (model.getUsages().size() == 1) {
|
||||||
emitSingleUsage(model, pe, paramVars);
|
emitSingleUsage(model, pe, paramVars);
|
||||||
} else if (model.getUsages().isEmpty()) {
|
} else if (model.getUsages().isEmpty()) {
|
||||||
if (model.getMethod().getReturnType() == ValueType.VOID) {
|
var returnType = model.getMethod().getReturnType();
|
||||||
|
if (returnType == ValueType.VOID) {
|
||||||
pe.exit();
|
pe.exit();
|
||||||
} else {
|
} else {
|
||||||
pe.constantNull(Object.class).returnValue();
|
pe.defaultValue(returnType).returnValue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emitMultipleUsage(model, pe, agent, paramVars);
|
emitMultipleUsage(model, pe, agent, paramVars);
|
||||||
|
@ -147,10 +148,11 @@ public class MetaprogrammingDependencyListener extends AbstractDependencyListene
|
||||||
}
|
}
|
||||||
|
|
||||||
choice.otherwise(() -> {
|
choice.otherwise(() -> {
|
||||||
if (methodDep.getReference().getReturnType() == ValueType.VOID) {
|
var returnType = methodDep.getReference().getReturnType();
|
||||||
|
if (returnType == ValueType.VOID) {
|
||||||
pe.exit();
|
pe.exit();
|
||||||
} else {
|
} else {
|
||||||
pe.constantNull(Object.class).returnValue();
|
pe.defaultValue(returnType).returnValue();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user