groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dwi Elfianto (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-8856) Trait with generic will fail compilation if it has a static method that return the defined generic type.
Date Wed, 24 Oct 2018 12:20:00 GMT
Dwi Elfianto created GROOVY-8856:
------------------------------------

             Summary: Trait with generic will fail compilation if it has a static method that
return the defined generic type.
                 Key: GROOVY-8856
                 URL: https://issues.apache.org/jira/browse/GROOVY-8856
             Project: Groovy
          Issue Type: Bug
          Components: Compiler
    Affects Versions: 2.5.3, 2.5.2, 2.5.1, 2.5.0
         Environment: macOS 10.14
OpenJDK 1.8.0_181-b02
            Reporter: Dwi Elfianto


If you define a trait with generic type T and have a static method that return that type,
compilation will fail with message:{{}}
{code:java}
Error:(5, 5) Groovyc: unable to resolve class T{code}
Simple code for reproducing this bug:
{code:java}
trait MyTrait<T extends List> {
    static T myMethod() {
        return [1, 2, 3]
    }
}{code}
 Groovy 2.4.x does not have this issue, from my testing this only happen in 2.5.x



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message