You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Dwi Elfianto (JIRA)" <ji...@apache.org> on 2018/10/24 12:20:00 UTC

[jira] [Created] (GROOVY-8856) Trait with generic will fail compilation if it has a static method that return the defined generic type.

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)