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

2021-03-19 Thread Stuart Adamson (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-8960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17305207#comment-17305207
 ] 

Stuart Adamson commented on GROOVY-8960:


[~emilles]  A fix of refactoring does not help since we have a lot of code 
which uses this

Pattern. Also this pattern works in groovy version 2.4.16 

 

> 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: 2.5.15, 3.0.8, 4.0.0-alpha-3
>
>
> Java:
> {code:java}
> import java.io.Serializable;
> public class aJavaClass  {
> private aJavaClass(final A inA) {
> System.out.println("Hello");
> }
> public static  aJavaClass 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  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)


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

2019-01-17 Thread Stuart Adamson (JIRA)
Stuart Adamson created GROOVY-8960:
--

 Summary: 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


Java:
{code:java}
import java.io.Serializable;

public class aJavaClass  {

private aJavaClass(final A inA) {
System.out.println("Hello");
}

public static  aJavaClass 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  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
(v7.6.3#76005)