+1
All tests pass on my machine. Here is my machine info:
```
------------------------------------------------------------
Gradle 4.7
------------------------------------------------------------
Build time: 2018-04-18 09:09:12 UTC
Revision: b9a962bf70638332300e7f810689cb2febbd4a6c
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_152 (Oracle Corporation 25.152-b16)
OS: Windows 10 10.0 amd64
```
As a side note, the following test passes, but when running it in groovy
console, it failed...
```
@groovy.transform.CompileStatic
public class Foo<T extends List<X>, X extends Number> {
X getFirstElement(T t) {
X x = t.get(0)
return x
}
static void main(String[] args) {
def f = new Foo<ArrayList<Integer>, Integer>()
def list = new ArrayList<Integer>()
list.add(123)
assert 123 == f.getFirstElement(list)
}
}
```
(https://github.com/apache/groovy/blob/GROOVY_2_5_X/src/test/groovy/bugs/Groovy6171Bug.groovy#L58)
workaround:
```
@groovy.transform.CompileStatic
public class Foo<X extends Number, T extends List<X>> {
X getFirstElement(T t) {
X x = t.get(0)
return x
}
static void main(String[] args) {
def f = new Foo<Integer, ArrayList<Integer>>()
def list = new ArrayList<Integer>()
list.add(123)
assert 123 == f.getFirstElement(list)
}
}
```
Cheers,
Daniel.Sun
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html