mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Tests pass
This commit is contained in:
parent
0ee5ba52c4
commit
b9d6e29ca2
|
@ -62,7 +62,7 @@ class ResourceProgramTransformer {
|
||||||
return Arrays.<Instruction>asList(accessInsn);
|
return Arrays.<Instruction>asList(accessInsn);
|
||||||
}
|
}
|
||||||
ClassReader iface = innerSource.get(method.getClassName());
|
ClassReader iface = innerSource.get(method.getClassName());
|
||||||
if (iface.getAnnotations().get(Resource.class.getName()) == null) {
|
if (!isSubclass(iface, Resource.class.getName())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (method.getName().startsWith("get")) {
|
if (method.getName().startsWith("get")) {
|
||||||
|
@ -81,6 +81,23 @@ class ResourceProgramTransformer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSubclass(ClassReader cls, String superClass) {
|
||||||
|
if (cls.getName().equals(superClass)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
ClassReader parent = cls.getParent() != null ? innerSource.get(cls.getParent()) : null;
|
||||||
|
if (parent != null && isSubclass(parent, superClass)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (String ifaceName : cls.getInterfaces()) {
|
||||||
|
ClassReader iface = innerSource.get(ifaceName);
|
||||||
|
if (iface != null) {
|
||||||
|
return isSubclass(iface, superClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private List<Instruction> transformGetterInvocation(InvokeInstruction insn, String property) {
|
private List<Instruction> transformGetterInvocation(InvokeInstruction insn, String property) {
|
||||||
if (insn.getReceiver() == null) {
|
if (insn.getReceiver() == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user