Repository: groovy Updated Branches: refs/heads/master 440ae1832 -> 6cf958c2f
tweak wording of error message Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/6cf958c2 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/6cf958c2 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/6cf958c2 Branch: refs/heads/master Commit: 6cf958c2fa7dab4a028039c7c6e8f23456a5d7e5 Parents: 440ae18 Author: paulk <pa...@asert.com.au> Authored: Sat Sep 16 15:52:19 2017 +1000 Committer: paulk <pa...@asert.com.au> Committed: Sat Sep 16 16:35:23 2017 +1000 ---------------------------------------------------------------------- src/main/groovy/transform/builder/InitializerStrategy.java | 2 +- .../groovy/transform/stc/StaticTypeCheckingVisitor.java | 2 +- src/spec/doc/core-domain-specific-languages.adoc | 2 +- src/spec/test/typing/TypeCheckingTest.groovy | 6 +++--- .../transform/stc/ClosureParamTypeInferenceSTCTest.groovy | 2 +- src/test/groovy/transform/stc/DelegatesToSTCTest.groovy | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/6cf958c2/src/main/groovy/transform/builder/InitializerStrategy.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/transform/builder/InitializerStrategy.java b/src/main/groovy/transform/builder/InitializerStrategy.java index 4e0dd82..9a558ac 100644 --- a/src/main/groovy/transform/builder/InitializerStrategy.java +++ b/src/main/groovy/transform/builder/InitializerStrategy.java @@ -104,7 +104,7 @@ import static org.objectweb.asm.Opcodes.ACC_SYNTHETIC; * </pre> * then the following compile-time error would result: * <pre> - * [Static type checking] - Cannot find matching method Person#<init>(Person$PersonInitializer <groovy.transform.builder.InitializerStrategy$SET, groovy.transform.builder.InitializerStrategy$SET, groovy.transform.builder.InitializerStrategy$UNSET>). Please check if the declared type is right and if the method exists. + * [Static type checking] - Cannot find matching method Person#<init>(Person$PersonInitializer <groovy.transform.builder.InitializerStrategy$SET, groovy.transform.builder.InitializerStrategy$SET, groovy.transform.builder.InitializerStrategy$UNSET>). Please check if the declared type is correct and if the method exists. * </pre> * The message is a little cryptic, but it is basically the static compiler telling us that the third parameter, {@code age} in our case, is unset. * http://git-wip-us.apache.org/repos/asf/groovy/blob/6cf958c2/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java ---------------------------------------------------------------------- diff --git a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java index 28c6368..b8be25d 100644 --- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java +++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java @@ -4671,7 +4671,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { if (isClassClassNodeWrappingConcreteType(receiver)) { receiver = receiver.getGenericsTypes()[0].getType(); } - addStaticTypeError("Cannot find matching method " + receiver.getText() + "#" + toMethodParametersString(name, args) + ". Please check if the declared type is right and if the method exists.", call); + addStaticTypeError("Cannot find matching method " + receiver.getText() + "#" + toMethodParametersString(name, args) + ". Please check if the declared type is correct and if the method exists.", call); } protected void addAmbiguousErrorMessage(final List<MethodNode> foundMethods, final String name, final ClassNode[] args, final Expression expr) { http://git-wip-us.apache.org/repos/asf/groovy/blob/6cf958c2/src/spec/doc/core-domain-specific-languages.adoc ---------------------------------------------------------------------- diff --git a/src/spec/doc/core-domain-specific-languages.adoc b/src/spec/doc/core-domain-specific-languages.adoc index 001705f..c9c8e81 100644 --- a/src/spec/doc/core-domain-specific-languages.adoc +++ b/src/spec/doc/core-domain-specific-languages.adoc @@ -353,7 +353,7 @@ include::{projectdir}/src/spec/test/DelegatesToSpecTest.groovy[tags=sendmail_typ will fail compilation with errors like this one: ---- -[Static type checking] - Cannot find matching method MyScript#from(java.lang.String). Please check if the declared type is right and if the method exists. +[Static type checking] - Cannot find matching method MyScript#from(java.lang.String). Please check if the declared type is correct and if the method exists. @ line 31, column 21. from 'dsl-g...@mycompany.com' ---- http://git-wip-us.apache.org/repos/asf/groovy/blob/6cf958c2/src/spec/test/typing/TypeCheckingTest.groovy ---------------------------------------------------------------------- diff --git a/src/spec/test/typing/TypeCheckingTest.groovy b/src/spec/test/typing/TypeCheckingTest.groovy index d22cce5..f32ca3f 100644 --- a/src/spec/test/typing/TypeCheckingTest.groovy +++ b/src/spec/test/typing/TypeCheckingTest.groovy @@ -300,7 +300,7 @@ class TypeCheckingTest extends StaticTypeCheckingTestCase { // tag::stc_argparam_array_fail[] format([1,2] as int[]) // fails // end::stc_argparam_array_fail[] - ''', '#format(int[]). Please check if the declared type is right and if the method exists.' + ''', '#format(int[]). Please check if the declared type is correct and if the method exists.' assertScript ''' @@ -319,7 +319,7 @@ class TypeCheckingTest extends StaticTypeCheckingTestCase { } format(new ArrayList()) // fails // end::stc_argparam_superclass_fail[] - ''', '#format(java.util.ArrayList). Please check if the declared type is right and if the method exists.' + ''', '#format(java.util.ArrayList). Please check if the declared type is correct and if the method exists.' assertScript ''' // tag::stc_argparam_interface[] @@ -337,7 +337,7 @@ class TypeCheckingTest extends StaticTypeCheckingTestCase { } format(new LinkedList()) // fails // end::stc_argparam_interface_fail[] - ''', '#format(java.util.LinkedList). Please check if the declared type is right and if the method exists.' + ''', '#format(java.util.LinkedList). Please check if the declared type is correct and if the method exists.' assertScript ''' // tag::stc_argparam_prim[] http://git-wip-us.apache.org/repos/asf/groovy/blob/6cf958c2/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy ---------------------------------------------------------------------- diff --git a/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy b/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy index 3bf6a93..cce4682 100644 --- a/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy +++ b/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy @@ -1198,7 +1198,7 @@ import groovy.transform.stc.FirstParam return self } callee01(["a","b","c"]) { a -> - println(a.toUpperCase()) // [Static type checking] - Cannot find matching method java.lang.Object#toUpperCase(). Please check if the declared type is right and if the method exists. + println(a.toUpperCase()) // [Static type checking] - Cannot find matching method java.lang.Object#toUpperCase(). Please check if the declared type is correct and if the method exists. } ''' } http://git-wip-us.apache.org/repos/asf/groovy/blob/6cf958c2/src/test/groovy/transform/stc/DelegatesToSTCTest.groovy ---------------------------------------------------------------------- diff --git a/src/test/groovy/transform/stc/DelegatesToSTCTest.groovy b/src/test/groovy/transform/stc/DelegatesToSTCTest.groovy index 6c4beff..f20220e 100644 --- a/src/test/groovy/transform/stc/DelegatesToSTCTest.groovy +++ b/src/test/groovy/transform/stc/DelegatesToSTCTest.groovy @@ -645,8 +645,8 @@ class DelegatesToSTCTest extends StaticTypeCheckingTestCase { * Because the Parrot parser provides more accurate node position information, * org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.addError will not be interfered by wrong node position. * - * 1) TestScripttestDelegatesToGenericArgumentTypeAndTypo0.groovy: 17: [Static type checking] - Cannot find matching method TestScripttestDelegatesToGenericArgumentTypeAndTypo0#getname(). Please check if the declared type is right and if the method exists. - * 2) TestScripttestDelegatesToGenericArgumentTypeAndTypo0.groovy: 17: [Static type checking] - Cannot find matching method java.lang.Object#toUpperCase(). Please check if the declared type is right and if the method exists. + * 1) TestScripttestDelegatesToGenericArgumentTypeAndTypo0.groovy: 17: [Static type checking] - Cannot find matching method TestScripttestDelegatesToGenericArgumentTypeAndTypo0#getname(). Please check if the declared type is correct and if the method exists. + * 2) TestScripttestDelegatesToGenericArgumentTypeAndTypo0.groovy: 17: [Static type checking] - Cannot find matching method java.lang.Object#toUpperCase(). Please check if the declared type is correct and if the method exists. * */ shouldFailWithMessages code, msg, msg