You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/03/19 21:08:00 UTC

[jira] [Updated] (GROOVY-8960) Can not call a java parameterized type method from groovy with java enum. Compile error

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

Eric Milles updated GROOVY-8960:
--------------------------------
    Fix Version/s: 3.0.8

> Can not call a java parameterized type method from groovy with java enum. Compile error
> ---------------------------------------------------------------------------------------
>
>                 Key: GROOVY-8960
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8960
>             Project: Groovy
>          Issue Type: Bug
>          Components: GroovyScriptEngine
>    Affects Versions: 2.5.5
>            Reporter: Stuart Adamson
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 3.0.8, 4.0.0-alpha-3
>
>
> Java:
> {code:java}
> import java.io.Serializable;
> public class aJavaClass<A extends Serializable>  {
>     private aJavaClass(final A inA) {
>         System.out.println("Hello");
>     }
>     public static <A extends Serializable> aJavaClass<A> create(final A inA) {
>         return new aJavaClass<>(inA);
>     }
>     public enum aEnum {
>         entry1,
>     }
> }{code}
> Groovy calling class:
> {code:java}
> import groovy.transform.CompileStatic
> import aJavaClass
> @CompileStatic
> class aCallingGroovyClass {
>     static void main(String[] args) {
>         aJavaClass.create(aJavaClass.aEnum.entry1)
>     }
> }{code}
> try compiling get:
> {code:java}
> Error:(10, 9) Groovyc: [Static type checking] - Cannot call <A extends java.io.Serializable> aJavaClass#create(A) with arguments [aJavaClass$aEnum]{code}
> Replace the method arg aJavaClass.aEnum.entry1 with non enum, say '1' no quotes, code compiles and runs.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)