[jira] [Comment Edited] (GROOVY-8338) Calling Stream.of from groovy class in JDK 9 fails

2018-01-14 Thread Slawomir Nowak (JIRA)

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

Slawomir Nowak edited comment on GROOVY-8338 at 1/14/18 1:21 PM:
-

[~paulk]
Ok, so this is what I've found so far:
If you define an interface:
{code}
public interface InterfaceWithStaticMethod {

static boolean someStaticMethod() {
return true;
}
}{code}

then this works:
{code}class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
InterfaceWithStaticMethod.someStaticMethod()
}
}{code}

however this fails:
{code}class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
def result = InterfaceWithStaticMethod.someStaticMethod()
result
}
}{code}
with {code}java.lang.VerifyError: (class: 
example/app/InterfaceWithStaticMethod$someStaticMethod, method: callStatic 
signature: (Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;) Illegal 
type in constant pool

at 
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3110)
at java.base/java.lang.Class.getConstructor0(Class.java:3315)
at java.base/java.lang.Class.getConstructor(Class.java:2108)
at com.example.app.StaticMethodCall.static method call 
test(StaticMethodCall.groovy:9){code}

Running it with @CompileStatic yields:
{code}[INFO] Running com.example.app.StaticMethodCall
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.161 s 
<<< FAILURE! - in com.example.app.StaticMethodCall
[ERROR] static method call test(com.example.app.StaticMethodCall)  Time 
elapsed: 0.068 s  <<< ERROR!
java.lang.IncompatibleClassChangeError: Method 
example.app.InterfaceWithStaticMethod.someStaticMethod()Z must be 
InterfaceMethodref constant
at com.example.app.StaticMethodCall.static method call 
test(StaticMethodCall.groovy:11)

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   StaticMethodCall.static method call test:11 IncompatibleClassChange 
Method exa...
{code}




was (Author: slnowak):
[~paulk]
Ok, so this is what I've found so far:
If you define an interface:
{code}
public interface InterfaceWithStaticMethod {

static boolean someStaticMethod() {
return true;
}
}{code}

then this works:
{code}class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
InterfaceWithStaticMethod.someStaticMethod()
}
}{code}

however this fails:
{code}class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
def result = InterfaceWithStaticMethod.someStaticMethod()
result
}
}{code}
with {code}java.lang.VerifyError: (class: 
example/app/InterfaceWithStaticMethod$someStaticMethod, method: callStatic 
signature: (Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;) Illegal 
type in constant pool

at 
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3110)
at java.base/java.lang.Class.getConstructor0(Class.java:3315)
at java.base/java.lang.Class.getConstructor(Class.java:2108)
at com.example.app.StaticMethodCall.static method call 
test(StaticMethodCall.groovy:9){code}

Do you want me to put @CompileStatic on top of the test class?



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

[jira] [Commented] (GROOVY-8338) Calling Stream.of from groovy class in JDK 9 fails

2018-01-14 Thread Slawomir Nowak (JIRA)

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

Slawomir Nowak commented on GROOVY-8338:


[~paulk]
Ok, so this is what I've found so far:
If you define an interface:
{code}
public interface InterfaceWithStaticMethod {

static boolean someStaticMethod() {
return true;
}
}{code}

then this works:
{code}class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
InterfaceWithStaticMethod.someStaticMethod()
}
}{code}

however this fails:
{code}class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
def result = InterfaceWithStaticMethod.someStaticMethod()
result
}
}{code}
with {code}java.lang.VerifyError: (class: 
example/app/InterfaceWithStaticMethod$someStaticMethod, method: callStatic 
signature: (Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;) Illegal 
type in constant pool

at 
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3110)
at java.base/java.lang.Class.getConstructor0(Class.java:3315)
at java.base/java.lang.Class.getConstructor(Class.java:2108)
at com.example.app.StaticMethodCall.static method call 
test(StaticMethodCall.groovy:9){code}

Do you want me to put @CompileStatic on top of the test class?



> 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
>
> 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)


[jira] [Commented] (GROOVY-8338) Calling Stream.of from groovy class in JDK 9 fails

2018-01-14 Thread Paul King (JIRA)

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

Paul King commented on GROOVY-8338:
---

Thanks! Your results with and without @CompileStatic would also potentially be 
useful information.

> 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
>
> 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)


[jira] [Comment Edited] (GROOVY-8338) Calling Stream.of from groovy class in JDK 9 fails

2018-01-14 Thread Slawomir Nowak (JIRA)

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

Slawomir Nowak edited comment on GROOVY-8338 at 1/14/18 1:00 PM:
-

I've just built groovy-all jar from latest commit on 2.4.X branch, included it 
in my test project and the following test
{code}class StaticMethodCall extends Specification {

def 'static method call test'() {
expect:
Stream.of(1, 2, 3).map({ it + 1 }).collect(Collectors.toList()) == [2, 
3, 4]
}

}{code}
passed on jdk 9.0.1

However, there's still something broken. I've added a static Vertx.vertx() call 
{code}
class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
def vertx = Vertx.vertx()
true
}
}{code}

and it fails with:
{code}
java.lang.VerifyError: (class: io/vertx/core/Vertx$vertx, method: callStatic 
signature: (Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;) Illegal 
type in constant pool

at 
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3110)
at java.base/java.lang.Class.getConstructor0(Class.java:3315)
at java.base/java.lang.Class.getConstructor(Class.java:2108)
at com.example.app.StaticMethodCall.static method call 
test(StaticMethodCall.groovy:9)
{code}

it's not caused by vertx itself as it works on jdk9, it only fails in groovy.

// edit:
I'm trying to recreate the issue without using vertx, will get back to you


was (Author: slnowak):
I've just built groovy-all jar from latest commit on 2.4.X branch, included it 
in my test project and the following test
{code}class StaticMethodCall extends Specification {

def 'static method call test'() {
expect:
Stream.of(1, 2, 3).map({ it + 1 }).collect(Collectors.toList()) == [2, 
3, 4]
}

}{code}
passed on jdk 9.0.1

However, there's still something broken. I've added a static Vertx.vertx() call 
{code}
class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
def vertx = Vertx.vertx()
true
}
}{code}

and it fails with:
{code}
java.lang.VerifyError: (class: io/vertx/core/Vertx$vertx, method: callStatic 
signature: (Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;) Illegal 
type in constant pool

at 
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3110)
at java.base/java.lang.Class.getConstructor0(Class.java:3315)
at java.base/java.lang.Class.getConstructor(Class.java:2108)
at com.example.app.StaticMethodCall.static method call 
test(StaticMethodCall.groovy:9)
{code}

it's not caused by vertx itself as it works on jdk9, it only fails in groovy.

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

[jira] [Comment Edited] (GROOVY-8338) Calling Stream.of from groovy class in JDK 9 fails

2018-01-14 Thread Slawomir Nowak (JIRA)

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

Slawomir Nowak edited comment on GROOVY-8338 at 1/14/18 12:49 PM:
--

I've just built groovy-all jar from latest commit on 2.4.X branch, included it 
in my test project and the following test
{code}class StaticMethodCall extends Specification {

def 'static method call test'() {
expect:
Stream.of(1, 2, 3).map({ it + 1 }).collect(Collectors.toList()) == [2, 
3, 4]
}

}{code}
passed on jdk 9.0.1

However, there's still something broken. I've added a static Vertx.vertx() call 
{code}
class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
def vertx = Vertx.vertx()
true
}
}{code}

and it fails with:
{code}
java.lang.VerifyError: (class: io/vertx/core/Vertx$vertx, method: callStatic 
signature: (Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;) Illegal 
type in constant pool

at 
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3110)
at java.base/java.lang.Class.getConstructor0(Class.java:3315)
at java.base/java.lang.Class.getConstructor(Class.java:2108)
at com.example.app.StaticMethodCall.static method call 
test(StaticMethodCall.groovy:9)
{code}

it's not caused by vertx itself as it works on jdk9, it only fails in groovy.


was (Author: slnowak):
I've just built groovy-all jar from latest commit on 2.4.X branch, included it 
in my test project and the following test
{code}class StaticMethodCall extends Specification {

def 'static method call test'() {
expect:
Stream.of(1, 2, 3).map({ it + 1 }).collect(Collectors.toList()) == [2, 
3, 4]
}

}{code}
passed on jdk 9.0.1

However, there's still something broken. I've added a static Vertx.vertx() call 
{code}
class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
def vertx = Vertx.vertx()
true
}
}{code}

and it fails with:
{code}
java.lang.VerifyError: (class: io/vertx/core/Vertx$vertx, method: callStatic 
signature: (Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;) Illegal 
type in constant pool

at 
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3110)
at java.base/java.lang.Class.getConstructor0(Class.java:3315)
at java.base/java.lang.Class.getConstructor(Class.java:2108)
at com.example.app.StaticMethodCall.static method call 
test(StaticMethodCall.groovy:9)
{code}

it's not caused by vertx itself as it works on jdk9.

> 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
>
> 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)


[jira] [Comment Edited] (GROOVY-8338) Calling Stream.of from groovy class in JDK 9 fails

2018-01-14 Thread Slawomir Nowak (JIRA)

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

Slawomir Nowak edited comment on GROOVY-8338 at 1/14/18 12:48 PM:
--

I've just built groovy-all jar from latest commit on 2.4.X branch, included it 
in my test project and the following test
{code}class StaticMethodCall extends Specification {

def 'static method call test'() {
expect:
Stream.of(1, 2, 3).map({ it + 1 }).collect(Collectors.toList()) == [2, 
3, 4]
}

}{code}
passed on jdk 9.0.1

However, there's still something broken. I've added a static Vertx.vertx() call 
{code}
class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
def vertx = Vertx.vertx()
true
}
}{code}

and it fails with:
{code}
java.lang.VerifyError: (class: io/vertx/core/Vertx$vertx, method: callStatic 
signature: (Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;) Illegal 
type in constant pool

at 
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3110)
at java.base/java.lang.Class.getConstructor0(Class.java:3315)
at java.base/java.lang.Class.getConstructor(Class.java:2108)
at com.example.app.StaticMethodCall.static method call 
test(StaticMethodCall.groovy:9)
{code}

it's not caused by vertx itself as it works on jdk9.


was (Author: slnowak):
I've just built groovy-all jar from latest commit on 2.4.X branch, included it 
in my test project and the following test
{code}class StaticMethodCall extends Specification {

def 'static method call test'() {
expect:
Stream.of(1, 2, 3).map({ it + 1 }).collect(Collectors.toList()) == [2, 
3, 4]
}

}{code}
passed on jdk 9.0.1

However, there's still something broken. I've added a static Vertx.vertx() call 
{code}
class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
def vertx = Vertx.vertx()
true
}
}{code}

and it fails with:
{code}
java.lang.VerifyError: (class: io/vertx/core/Vertx$vertx, method: callStatic 
signature: (Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;) Illegal 
type in constant pool

at 
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3110)
at java.base/java.lang.Class.getConstructor0(Class.java:3315)
at java.base/java.lang.Class.getConstructor(Class.java:2108)
at com.example.app.StaticMethodCall.static method call 
test(StaticMethodCall.groovy:9)
{code}

it's not caused by vertex itself as it works on jdk9.

> 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
>
> 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)


[jira] [Comment Edited] (GROOVY-8338) Calling Stream.of from groovy class in JDK 9 fails

2018-01-14 Thread Slawomir Nowak (JIRA)

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

Slawomir Nowak edited comment on GROOVY-8338 at 1/14/18 12:48 PM:
--

I've just built groovy-all jar from latest commit on 2.4.X branch, included it 
in my test project and the following test
{code}class StaticMethodCall extends Specification {

def 'static method call test'() {
expect:
Stream.of(1, 2, 3).map({ it + 1 }).collect(Collectors.toList()) == [2, 
3, 4]
}

}{code}
passed on jdk 9.0.1

However, there's still something broken. I've added a static Vertx.vertx() call 
{code}
class StaticMethodCall extends Specification {
def 'static method call test'() {
expect:
def vertx = Vertx.vertx()
true
}
}{code}

and it fails with:
{code}
java.lang.VerifyError: (class: io/vertx/core/Vertx$vertx, method: callStatic 
signature: (Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;) Illegal 
type in constant pool

at 
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3110)
at java.base/java.lang.Class.getConstructor0(Class.java:3315)
at java.base/java.lang.Class.getConstructor(Class.java:2108)
at com.example.app.StaticMethodCall.static method call 
test(StaticMethodCall.groovy:9)
{code}

it's not caused by vertex itself as it works on jdk9.


was (Author: slnowak):
I've just built groovy-all jar from latest commit on 2.4.X branch, included it 
in my test project and the following test
{code}class StaticMethodCall extends Specification {

def 'static method call test'() {
expect:
Stream.of(1, 2, 3).map({ it + 1 }).collect(Collectors.toList()) == [2, 
3, 4]
}

}{code}
passed on jdk 9.0.1

> 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
>
> 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)


[jira] [Commented] (GROOVY-8338) Calling Stream.of from groovy class in JDK 9 fails

2018-01-14 Thread Slawomir Nowak (JIRA)

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

Slawomir Nowak commented on GROOVY-8338:


I've just built groovy-all jar from latest commit on 2.4.X branch and the 
following test
{code}class StaticMethodCall extends Specification {

def 'static method call test'() {
expect:
Stream.of(1, 2, 3).map({ it + 1 }).collect(Collectors.toList()) == [2, 
3, 4]
}

}{code}
passed on jdk 9.0.1

> 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
>
> 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)


[jira] [Comment Edited] (GROOVY-8338) Calling Stream.of from groovy class in JDK 9 fails

2018-01-14 Thread Slawomir Nowak (JIRA)

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

Slawomir Nowak edited comment on GROOVY-8338 at 1/14/18 12:25 PM:
--

I've just built groovy-all jar from latest commit on 2.4.X branch, included it 
in my test project and the following test
{code}class StaticMethodCall extends Specification {

def 'static method call test'() {
expect:
Stream.of(1, 2, 3).map({ it + 1 }).collect(Collectors.toList()) == [2, 
3, 4]
}

}{code}
passed on jdk 9.0.1


was (Author: slnowak):
I've just built groovy-all jar from latest commit on 2.4.X branch and the 
following test
{code}class StaticMethodCall extends Specification {

def 'static method call test'() {
expect:
Stream.of(1, 2, 3).map({ it + 1 }).collect(Collectors.toList()) == [2, 
3, 4]
}

}{code}
passed on jdk 9.0.1

> 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
>
> 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)