groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Theodorou (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-8338) Calling Stream.of from groovy class in JDK 9 fails
Date Tue, 26 Dec 2017 10:12:00 GMT

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

Jochen Theodorou commented on GROOVY-8338:
------------------------------------------

Even though I did backport the change to 2.4.x, it is very possible I will have to change
the fix version and say it is 2.5+ only. On the CI server the same fix works well on master
and 2.5.x, but the JDK8 snapshot build currently fails there.... because it requests asm-all-6.0,
which does not exist. Right now I have no idea what would be different for Groovy 2.4 to not
pass verification and still work with for example master or 2.5. Would it possible for you
to test Groovy 2.5? I know there are problems with master and spock, because master is set
to Groovy 3, but 2.5 should work, should it not?

> Calling Stream.of from groovy class in JDK 9 fails
> --------------------------------------------------
>
>                 Key: GROOVY-8338
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8338
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.12
>            Reporter: Marcus Nylander
>            Assignee: Jochen Theodorou
>             Fix For: 2.4.14
>
>
> Trying to call Stream.of from groovy class (groovy version 2.4.12) using JDK 9 (jdk 9
181) fails. 
> Example:
> {code}
> package test
> import java.util.stream.Stream
> class B {
>     static void main(String[] args) {
>         Stream.of("1").forEach({ println(it) })
>     }
> }
> {code}
> The code above fails with:
> Exception in thread "main" java.lang.IncompatibleClassChangeError: Method java.util.stream.Stream.of(Ljava/lang/Object;)Ljava/util/stream/Stream;
must be InterfaceMethodref constant
> 	at java_util_stream_Stream$of.call(Unknown Source)
> 	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
> 	at test.B.main(B.groovy:7)
> The same occurs for other interface static methods also:
> {code}
> public interface D {
>     static D of(String s) {
>         return new D() {
>         };
>     }
> }
> class C {
>     static void main(String[] args) {
>         D.of("1")
>     }
> }
> {code}
> Also fails with:
> Exception in thread "main" java.lang.IncompatibleClassChangeError: Method test.D.of(Ljava/lang/String;)Ltest/D;
must be InterfaceMethodref constant
> 	at test.D$of.call(Unknown Source)
> 	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
> 	at test.C.main(C.groovy:7)
> Running with JDK 8 works fine.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message