groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject Re: [VOTE] Release Apache Groovy 2.5.0-rc-3
Date Mon, 21 May 2018 01:23:49 GMT
I suspect there is some stray "X" class on the test classpath which keeps
the early checks happy until later resolution. Thanks for the fix.

Cheers, Paul.

On Mon, May 21, 2018 at 1:29 AM, Daniel.Sun <sunlan@apache.org> wrote:

> +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&lt;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&lt;X>> {
>             X getFirstElement(T t) {
>                 X x = t.get(0)
>                 return x
>             }
>
>             static void main(String[] args) {
>                 def f = new Foo<Integer, ArrayList&lt;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
>

Mime
View raw message