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/08/26 03:31:00 UTC

[jira] [Closed] (GROOVY-7050) Type Checker failure for generic method with java enum type

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

Paul King closed GROOVY-7050.
-----------------------------
    Resolution: Cannot Reproduce
      Assignee: Paul King

Seems to work in 2.4.15, 2.5.2 and master. I presume it was fixed previously. Please re-open if you have further problems.

> Type Checker failure for generic method with java enum type
> -----------------------------------------------------------
>
>                 Key: GROOVY-7050
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7050
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.3.6
>            Reporter: Thibault Kruse
>            Assignee: Paul King
>            Priority: Major
>
> To reproduce, create (gradle) project:
> File MyEnum.java (.groovy has no problem):
> {code}
> public enum MyEnum  {
>     V1, V2
> }
> {code}
> File Example.groovy:
> {code}
> import groovy.transform.TypeChecked
> @TypeChecked
> class Example {
>     def main(String[] args) {
>         println randomSample(MyEnum.values())
>     }
>     public <T> List<T> randomSample(T[] sequence) {
>         return new ArrayList<T>()
>     }
> }
> {code}
> Running gradle compileGrooy yields:
> ...work/java/generics2/src/main/groovy/Example.groovy: 7: [Static type checking] - Cannot call <T> Example#randomSample(T[]) with arguments [MyEnum[]] 
>  @ line 7, column 17.
>            println randomSample(MyEnum.values())



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