Fix diagnostics tests

This commit is contained in:
Alexey Andreev 2017-01-24 23:42:41 +03:00
parent 55836d6ed7
commit c7829a77cf
2 changed files with 7 additions and 9 deletions

View File

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

View File

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