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

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

     [ https://issues.apache.org/jira/browse/GROOVY-8856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-8856.
-----------------------------
    Resolution: Not A Problem

> 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.0, 2.5.1, 2.5.2, 2.5.3
>         Environment: macOS 10.14
> OpenJDK 1.8.0_181-b02
>            Reporter: Dwi Elfianto
>            Priority: Blocker
>
> If you define a trait with generic type T and have a static method that return that type, compilation will fail with the following 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)