Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.4, 2.4.0, 2.5.0, 3.0.0
-
None
-
None
Description
Script:
import groovy.transform.CompileStatic @CompileStatic class Test { final String test = 'test-' List<String> test() { ['val'].collect {String s -> return new InnerTest(s).val } } class InnerTest { final String val InnerTest(String val) { this.val = test + val } } } println(new Test().test())
Result:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: ideaGroovyConsole.groovy: 9: [Static type checking] - Cannot find matching method Test$InnerTest#<init>(groovy.lang.Closure <V extends java.lang.Object>, java.lang.String). Please check if the declared type is correct and if the method exists. @ line 9, column 20. return new InnerTest(s).val ^ 1 error at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:287) at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:963) and so on...