groovy-notifications mailing list archives

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

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

Slawomir Nowak edited comment on GROOVY-8338 at 12/26/17 11:04 AM:
-------------------------------------------------------------------

[~blackdrag] Well, I had some compilation issues on 2.5, but after fixing that:
{code}Caused by: java.lang.IncompatibleClassChangeError: Method io.vavr.control.Validation.valid(Ljava/lang/Object;)Lio/vavr/control/Validation;
must be InterfaceMethodref constant{code}
So it looks like the issue is still there. 

Let me know if I'm doing anything wrong:
1) i'm trying to compile groovy locally
{code}MacBook-Pro-Slawomir:groovy snowak$ git log -1
commit ad4b5d15e2191349f7ddc588cc208a4014a240d4 (HEAD -> GROOVY_2_5_X, upstream/GROOVY_2_5_X)
Author: sunlan <sunlan@apache.org>
Date:   Tue Dec 26 12:54:01 2017 +0800

    Simplify the arguments of `coerceToSAM` method

    (cherry picked from commit 6e5f47f)
MacBook-Pro-Slawomir:groovy snowak$ ./gradlew clean dist -x test  --parallel{code}
2) then I specify compiled jar as a maven depencency:
{code}        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy</artifactId>
            <version>2.5.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>/Users/snowak/work/projects/groovy/target/libs/groovy-2.5.0-SNAPSHOT.jar</systemPath>
        </dependency>
{code}

This should work, right?


was (Author: slnowak):
[~blackdrag] Well, I had some compilation issues on 2.5, but after fixing that:
{code}Caused by: java.lang.IncompatibleClassChangeError: Method io.vavr.control.Validation.valid(Ljava/lang/Object;)Lio/vavr/control/Validation;
must be InterfaceMethodref constant{code}
So it looks like the issue is still there. 

Let me know if I'm doing anything wrong:
1) i'm trying to compile groovy locally
{code}MacBook-Pro-Slawomir:groovy snowak$ git log -1
commit 7c99799f1b9984c807725a04081e04bca58f6322 (HEAD -> GROOVY_2_5_X, origin/GROOVY_2_5_X)
Author: paulk <paulk@asert.com.au>
Date:   Fri Dec 22 17:11:51 2017 +1000

    GROOVY-8386/GROOVY-8094: Final variable analysis broken with try/catch/finally and if/then/else
(closes #646)
MacBook-Pro-Slawomir:groovy snowak$ ./gradlew clean dist -x test  --parallel{code}
2) then I specify compiled jar as a maven depencency:
{code}        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy</artifactId>
            <version>2.5.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>/Users/snowak/work/projects/groovy/target/libs/groovy-2.5.0-SNAPSHOT.jar</systemPath>
        </dependency>
{code}

This should work, right?

// edit: Ok, looks like i'm a little bit outdated, let my try again

> 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