diff --git a/jso/impl/src/main/java/org/teavm/jso/impl/JSClassProcessor.java b/jso/impl/src/main/java/org/teavm/jso/impl/JSClassProcessor.java index d36d3d3a6..222de5406 100644 --- a/jso/impl/src/main/java/org/teavm/jso/impl/JSClassProcessor.java +++ b/jso/impl/src/main/java/org/teavm/jso/impl/JSClassProcessor.java @@ -337,7 +337,7 @@ class JSClassProcessor { if (invoke.getInstance() != null) { if (!typeHelper.isSupportedType(ValueType.object(method.getOwnerName()))) { diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " - + " declaration. It is non-static and declared on a non-overlay class {{c1}}", + + "declaration. It is non-static and declared on a non-overlay class {{c1}}", invoke.getMethod(), method.getOwnerName()); valid = false; } @@ -443,7 +443,7 @@ class JSClassProcessor { private boolean validateSignature(MethodReader method, CallLocation callLocation, boolean[] byRefParams) { if (method.getResultType() != ValueType.VOID && !typeHelper.isSupportedType(method.getResultType())) { diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " - + "declaration", method.getReference()); + + "declaration, since it returns wrong type", method.getReference()); return false; } @@ -453,13 +453,13 @@ class JSClassProcessor { ValueType paramType = parameterTypes[i]; if (!typeHelper.isSupportedType(paramType)) { diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " - + "declaration: its " + (i + 1) + "th argument has wrong type", method.getReference()); + + "declaration: its " + (i + 1) + "th parameter has wrong type", method.getReference()); return false; } if (parameterAnnotations[i].get(JSByRef.class.getName()) != null) { if (!typeHelper.isSupportedByRefType(paramType)) { diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " - + "declaration: its " + (i + 1) + "th argument is declared as JSByRef, " + + "declaration: its " + (i + 1) + "th parameter is declared as JSByRef, " + "which has incompatible type", method.getReference()); return false; } diff --git a/tests/src/test/java/org/teavm/tests/JSOTest.java b/tests/src/test/java/org/teavm/tests/JSOTest.java index 277310b8e..ff5fd6d94 100644 --- a/tests/src/test/java/org/teavm/tests/JSOTest.java +++ b/tests/src/test/java/org/teavm/tests/JSOTest.java @@ -35,14 +35,13 @@ public class JSOTest { Problem foundProblem = build("callJSBodyWithWrongParameter").stream().filter(problem -> { return problem.getLocation().getMethod().getName().equals("callJSBodyWithWrongParameter") && problem.getText().equals("Method {{m0}} is not a proper native JavaScript method " - + " declaration. Its parameter #1 has invalid type {{t1}}"); + + "declaration: its 1th parameter has wrong type"); }).findAny().orElse(null); assertNotNull(foundProblem); Object[] params = foundProblem.getParams(); assertThat(params[0], is(new MethodReference(JSOTest.class, "jsBodyWithWrongParameter", Object.class, void.class))); - assertThat(params[1], is(ValueType.parse(Object.class))); } private static void callJSBodyWithWrongParameter() { @@ -57,7 +56,7 @@ public class JSOTest { Problem foundProblem = build("callWrongNonStaticJSBody").stream().filter(problem -> { return problem.getLocation().getMethod().getName().equals("callWrongNonStaticJSBody") && problem.getText().equals("Method {{m0}} is not a proper native JavaScript method " - + " declaration. It is non-static and declared on a non-overlay class {{c1}}"); + + "declaration. It is non-static and declared on a non-overlay class {{c1}}"); }).findAny().orElse(null); assertNotNull(foundProblem); @@ -78,14 +77,13 @@ public class JSOTest { Problem foundProblem = build("callJSBodyWithWrongReturningType").stream().filter(problem -> { return problem.getLocation().getMethod().getName().equals("callJSBodyWithWrongReturningType") && problem.getText().equals("Method {{m0}} is not a proper native JavaScript method " - + " declaration, since it returns invalid type {{t1}}"); + + "declaration, since it returns wrong type"); }).findAny().orElse(null); assertNotNull(foundProblem); Object[] params = foundProblem.getParams(); assertThat(params[0], is(new MethodReference(JSOTest.class, "jsBodyWithWrongReturningType", String.class, Object.class))); - assertThat(params[1], is(ValueType.parse(Object.class))); } private static void callJSBodyWithWrongReturningType() {