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 2022/07/23 16:27:00 UTC

[jira] [Updated] (GROOVY-10552) @AutoImplement for method with type parameter(s)

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

Eric Milles updated GROOVY-10552:
---------------------------------
    Fix Version/s:     (was: 5.0.0-alpha-1)

> @AutoImplement for method with type parameter(s)
> ------------------------------------------------
>
>                 Key: GROOVY-10552
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10552
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.5.15, 3.0.10, 4.0.1
>         Environment: Ubuntu 20.04 / Groovy 4.0.1 / OpenJDK 8
>            Reporter: Peter Giles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 2.5.17, 3.0.11, 4.0.2
>
>
> I have tried a few permutations of Groovy versions and Java versions, and I can't get this to work with anything I've tried that is above Groovy version 2.5.12:
> {code:java}
> import groovy.transform.AutoImplement
> public class AutoImplementExample {
>     public static void main(String ... args) {
>         def c = new DummyConnection()
>         c.commit()
>     }
> }
> @AutoImplement
> class DummyConnection implements java.sql.Connection {}
> // Name this file AutoImplementExample.groovy and try to compile and run{code}
>  
> For example, with Groovy 4.0.1, JDK 8, and my GROOVY_HOME, PATH, and JAVA_HOME set up as instructed in the installation page for Groovy:
> {noformat}
> ~/groovy-autoimplement$ groovy -version
> Groovy Version: 4.0.1 JVM: 1.8.0_312 Vendor: Private Build OS: Linux
> ~/groovy-autoimplement$ java -version
> openjdk version "1.8.0_312"
> OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~20.04-b07)
> OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)
> ~/groovy-autoimplement$ groovyc ./AutoImplementExample.groovy
> ~/groovy-autoimplement$ groovy AutoImplementExample
> Caught: java.lang.NullPointerException
> java.lang.NullPointerException
>     at com.sun.beans.TypeResolver.resolve(TypeResolver.java:203)
>     at com.sun.beans.TypeResolver.resolve(TypeResolver.java:218)
>     at com.sun.beans.TypeResolver.resolve(TypeResolver.java:169)
>     at com.sun.beans.TypeResolver.resolve(TypeResolver.java:218)
>     at com.sun.beans.TypeResolver.resolveInClass(TypeResolver.java:96)
>     at AutoImplementExample.main(AutoImplementExample.groovy:5)
> ~/groovy-autoimplement$ {noformat}
>  
> This stacktrace looks similar to the error I see with other Groovy versions and JDK 8.  The trace looks slightly longer with JDK 11, but everything from AutoImplementExample.groovy:5 and above looks the same, right down to the line numbers.
> I've also run this with *java* (after compiling with {*}groovyc{*}) to make sure there is nothing funny going on when running directly with *groovy* that could be sullying the results.  That's a bit messier to run in that I have to construct a long classpath for all the groovy jars, and for that effort I just get a longer stack trace with the same bits at the top.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)