[ https://issues.apache.org/jira/browse/GROOVY-9763?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-9763: -------------------------------- Fix Version/s: 2.5.16 > Regression in groovyc 3.0 and 4.0 and Compile static with generic static > method in trait > ---------------------------------------------------------------------------------------- > > Key: GROOVY-9763 > URL: https://issues.apache.org/jira/browse/GROOVY-9763 > Project: Groovy > Issue Type: Bug > Components: Compiler, Static compilation, Static Type Checker > Affects Versions: 4.0.0-alpha-1, 3.0.6 > Reporter: Arthur Sengileyev > Assignee: Eric Milles > Priority: Major > Fix For: 3.0.7, 4.0.0-alpha-2, 2.5.16 > > Time Spent: 50m > Remaining Estimate: 0h > > After upgrading to groovy 3.0 this code fails to compile (can't pass type > checker). > {code:java} > import groovy.transform.CompileStatic > @CompileStatic > trait StaticTrait { > static <T> T wrapClosure(Closure<T> callable) { > callable() > } > } > class ClassWithTrait implements StaticTrait {} > @CompileStatic > class ClassCaller { > void call() { > ClassWithTrait.wrapClosure { > println("fails to compile") > 0 > } > } > } > new ClassCaller().call() > {code} > Error output: > {code:java} > % groovyc test1.groovy > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > test1.groovy: 15: [Static type checking] - Cannot find matching method > ClassWithTrait#wrapClosure(groovy.lang.Closure <java.lang.Integer>). Please > check if the declared type is correct and if the method exists. > @ line 15, column 9. > ClassWithTrait.wrapClosure { > ^ > 1 error {code} > It compiles fine with 2.5.13. -- This message was sent by Atlassian Jira (v8.20.1#820001)