groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesper Steen Møller (JIRA) <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7160) NoSuchMethodError for varargs when type parameter extends interface
Date Thu, 30 Jun 2016 18:22:10 GMT

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

Jesper Steen Møller commented on GROOVY-7160:
---------------------------------------------

Famously, this happens for EnumSet.of(...) when passing more than 5 enums.

> NoSuchMethodError for varargs when type parameter extends interface
> -------------------------------------------------------------------
>
>                 Key: GROOVY-7160
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7160
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.3.7, 2.4.0-beta-3
>            Reporter: Yu Kobayashi
>
> Java code
> {code}
> public class Foo<T extends java.io.Serializable> {
>     public void bar(T... args) {}
> }
> {code}
> Groovy code
> {code}
> @groovy.transform.CompileStatic
> void test() {
>     new Foo<String>().bar("a")
> }
> test()
> {code}
> Error message
> {code}
> Caught: java.lang.NoSuchMethodError: Foo.bar([Ljava/lang/Object;)V
> java.lang.NoSuchMethodError: Foo.bar([Ljava/lang/Object;)V
>         at test.test(test.groovy:3)
>         at test.run(test.groovy:5)
> {code}
> This happens for these two conditions.
> 1. Foo is a separate class and is not an inner class of the Groovy code
> 2. T extends interface



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message