Fix reporting error on calling async method from native method

This commit is contained in:
Alexey Andreev 2018-01-08 19:56:47 +03:00
parent b38368b27d
commit 8dea7e9035
2 changed files with 11 additions and 3 deletions

View File

@ -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;

View File

@ -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());