New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invocation of static interface methods on mock responses fails with jdk 9 #780

Open
marcusnyl opened this Issue Oct 12, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@marcusnyl

marcusnyl commented Oct 12, 2017

Invocation of static interface methods on mock responses fails with jdk 9.
Using:
JDK 9 181,
groovy-all:2.4.12
spock-core:1.1-groovy-2.4

In the following test stream.of fails with:

java.lang.IncompatibleClassChangeError: Method java.util.stream.Stream.of(Ljava/lang/Object;)Ljava/util/stream/Stream; must be InterfaceMethodref constant

at test.Test.test stream.of fails(Test.groovy:14)

package test

import spock.lang.Specification

import java.util.function.Supplier
import java.util.stream.Stream

class Test extends Specification {
def "test stream.of fails"() {
def m = Mock(Supplier)
when:
def r = m.get()
then:
m.get() >> Stream.of("a")
r.count() == 1
}

def "test stream.of ok"() {
    expect:
    Stream.of("a").count() == 1
}

}

@AlexElin

This comment has been minimized.

Show comment
Hide comment
@AlexElin

AlexElin Jan 19, 2018

Contributor

same problem without any mocking. (See test in the #814).

Seems it is the bug in the groovy. See GROOVY-8338

Contributor

AlexElin commented Jan 19, 2018

same problem without any mocking. (See test in the #814).

Seems it is the bug in the groovy. See GROOVY-8338

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment