[ https://issues.apache.org/jira/browse/GROOVY-9422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King updated GROOVY-9422: ------------------------------ Summary: @CompileStatic non-static inner class instantiation in closure (was: @CompileStatic non-statin inner class instantiation in closure) > @CompileStatic non-static inner class instantiation in closure > -------------------------------------------------------------- > > Key: GROOVY-9422 > URL: https://issues.apache.org/jira/browse/GROOVY-9422 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.3.4, 2.4.0, 2.5.0, 3.0.0 > Reporter: Aleksey > Assignee: Eric Milles > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > Script: > {code:groovy} > 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()) > {code} > Result: > {noformat} > 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... > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)