From da0220bb5b8c4a0f561fc6d18a18884d8eada679 Mon Sep 17 00:00:00 2001 From: konsoletyper Date: Mon, 3 Nov 2014 20:48:17 +0300 Subject: [PATCH] Fix https://github.com/konsoletyper/teavm/issues/30 --- .../org/teavm/jso/plugin/JavascriptNativeProcessor.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java b/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java index d41f03e60..c3af8a24a 100644 --- a/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java +++ b/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java @@ -145,6 +145,13 @@ class JavascriptNativeProcessor { } isConstructor = true; } else { + AnnotationReader methodAnnot = method.getAnnotations().get(JSMethod.class.getName()); + if (methodAnnot != null) { + AnnotationValue redefinedMethodName = methodAnnot.getValue("value"); + if (redefinedMethodName != null) { + name = redefinedMethodName.getString(); + } + } if (method.getResultType() != ValueType.VOID && !isSupportedType(method.getResultType())) { throw new RuntimeException("Method " + invoke.getMethod() + " is not " + "a proper native JavaScript method declaration");