mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-31 12:24:10 -08:00
Fix reporting error on calling async method from native method
This commit is contained in:
parent
b38368b27d
commit
8dea7e9035
|
@ -192,13 +192,19 @@ class JSClassProcessor {
|
||||||
Set<MethodDescriptor> methods = new HashSet<>();
|
Set<MethodDescriptor> methods = new HashSet<>();
|
||||||
findInheritedMethods(cls, methods, new HashSet<>());
|
findInheritedMethods(cls, methods, new HashSet<>());
|
||||||
for (MethodHolder method : cls.getMethods()) {
|
for (MethodHolder method : cls.getMethods()) {
|
||||||
if (methods.contains(method.getDescriptor()) && method.getAnnotations().get(Sync.class.getName()) == null) {
|
if (methods.contains(method.getDescriptor())) {
|
||||||
AnnotationHolder annot = new AnnotationHolder(Sync.class.getName());
|
makeSync(method);
|
||||||
method.getAnnotations().add(annot);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void makeSync(MethodHolder method) {
|
||||||
|
if (method.getAnnotations().get(Sync.class.getName()) == null) {
|
||||||
|
AnnotationHolder annot = new AnnotationHolder(Sync.class.getName());
|
||||||
|
method.getAnnotations().add(annot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void findInheritedMethods(ClassReader cls, Set<MethodDescriptor> methods, Set<String> visited) {
|
private void findInheritedMethods(ClassReader cls, Set<MethodDescriptor> methods, Set<String> visited) {
|
||||||
if (!visited.add(cls.getName())) {
|
if (!visited.add(cls.getName())) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -155,6 +155,8 @@ class JSObjectClassTransformer implements ClassHolderTransformer {
|
||||||
basicBlock.add(exit);
|
basicBlock.add(exit);
|
||||||
|
|
||||||
classHolder.addMethod(exportedMethod);
|
classHolder.addMethod(exportedMethod);
|
||||||
|
MethodHolder methodToCall = classHolder.getMethod(method);
|
||||||
|
JSClassProcessor.makeSync(methodToCall != null ? methodToCall : exportedMethod);
|
||||||
|
|
||||||
String publicAlias = classToExpose.methods.get(method);
|
String publicAlias = classToExpose.methods.get(method);
|
||||||
AnnotationHolder annot = new AnnotationHolder(JSMethodToExpose.class.getName());
|
AnnotationHolder annot = new AnnotationHolder(JSMethodToExpose.class.getName());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user