mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -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<>();
|
||||
findInheritedMethods(cls, methods, new HashSet<>());
|
||||
for (MethodHolder method : cls.getMethods()) {
|
||||
if (methods.contains(method.getDescriptor()) && method.getAnnotations().get(Sync.class.getName()) == null) {
|
||||
AnnotationHolder annot = new AnnotationHolder(Sync.class.getName());
|
||||
method.getAnnotations().add(annot);
|
||||
if (methods.contains(method.getDescriptor())) {
|
||||
makeSync(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!visited.add(cls.getName())) {
|
||||
return;
|
||||
|
|
|
@ -155,6 +155,8 @@ class JSObjectClassTransformer implements ClassHolderTransformer {
|
|||
basicBlock.add(exit);
|
||||
|
||||
classHolder.addMethod(exportedMethod);
|
||||
MethodHolder methodToCall = classHolder.getMethod(method);
|
||||
JSClassProcessor.makeSync(methodToCall != null ? methodToCall : exportedMethod);
|
||||
|
||||
String publicAlias = classToExpose.methods.get(method);
|
||||
AnnotationHolder annot = new AnnotationHolder(JSMethodToExpose.class.getName());
|
||||
|
|
Loading…
Reference in New Issue
Block a user