Today I found GROOVY-9058, but I also found that the following variation compiles with groovyc but still generates an error with Greclipse:
Consider this Java class:
package test51;
import java.util.List;
public class Foo {
public List bar() { return null; }
}
and this Groovy class:
package test51
import groovy.transform.CompileStatic
@CompileStatic
class Test51 {
protected void foo() {
List<Object[]> foo = new Foo().bar() // (A)
foo.each { Object[] row ->
def o = row[0] // (B)
}
}
List bar() {
}
}
No compiler error in (A), although, strictly speaking, it should. However groovyc does not complain either. I would assume foo to be inferred as List<Object[]>, given its declaration. Hovering the mouse pointer over row seems to confirm this and groovyc can compile this code. However, in Greclipse I get an error at (B), because row is inferred as Object even if foo is declared as List<Object[]> and row is declared as Object[].
Today I found GROOVY-9058, but I also found that the following variation compiles with groovyc but still generates an error with Greclipse:
Consider this Java class:
and this Groovy class:
No compiler error in (A), although, strictly speaking, it should. However groovyc does not complain either. I would assume
footo be inferred asList<Object[]>, given its declaration. Hovering the mouse pointer overrowseems to confirm this and groovyc can compile this code. However, in Greclipse I get an error at (B), becauserowis inferred asObjecteven iffoois declared asList<Object[]>androwis declared asObject[].