Skip to content
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

Ratpack Guice error in 1.6.0-rc-1 #1411

Closed
jdbevan opened this issue Nov 21, 2018 · 5 comments
Closed

Ratpack Guice error in 1.6.0-rc-1 #1411

jdbevan opened this issue Nov 21, 2018 · 5 comments
Labels
java9+ Related to running on Java versions 9 and after
Milestone

Comments

@jdbevan
Copy link
Contributor

jdbevan commented Nov 21, 2018

I have a test that contains code like:

        ExecHarness.runSingle({ it.add(ServerConfig.embedded().build()) }) { Execution exec ->
            def iface = (Guice.registry {
                it.binder { b ->
                    b.bindInterceptor(Matchers.any(), Matchers.any(), new ExecutionCachingInterceptor())
                    b.bind(TestInterface).to(CountingTestInterface).asEagerSingleton()
                }
            }).apply(exec).get(TestInterface)

            def emit1 = iface.emit()
            def emit2 = iface.emit()

            assert emit1 == "1"
            assert emit2 == "1"
            assert emit1.is(emit2) // is ensures that they are the same instance
        }

and when it runs using Java 9 I get the following stacktrace:

BUG! UNCAUGHT EXCEPTION: access to public member failed: ratpack.func.Action.toConsumer()Consumer/invokeSpecial, from ratpack.func.Action/2 (unnamed module @63753b6d)
        at org.codehaus.groovy.vmplugin.v7.Java7.getInvokeSpecialHandle(Java7.java:99)
        at ratpack.guice.Guice$AdHocModule.configure(Guice.java:264)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
        at com.google.inject.spi.Elements.getElements(Elements.java:110)
        at com.google.inject.util.Modules$OverrideModule.configure(Modules.java:198)
        at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
        at com.google.inject.spi.Elements.getElements(Elements.java:110)
        at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
        at com.google.inject.Guice.createInjector(Guice.java:99)
        at com.google.inject.Guice.createInjector(Guice.java:84)
        at ratpack.guice.Guice.lambda$newInjectorFactory$2(Guice.java:209)
        at ratpack.guice.Guice.buildInjector(Guice.java:250)
        at ratpack.guice.Guice.registry(Guice.java:203)
        at ratpack.guice.Guice.lambda$registry$0(Guice.java:195)
        at com.example.package.ratpack.cache.ExecutionCachingInterceptorSpec.Result with a simple result is cached_closure2(ExecutionCachingInterceptorSpec.groovy:21)

but its a bit beyond me to debug...

@michaelschlies
Copy link
Contributor

Can you tell what version of Groovy is being resolved on your classpath here?

@jdbevan
Copy link
Contributor Author

jdbevan commented Nov 21, 2018

I think 2.4.15... this is output from ./gradlew project:dependencies under testRuntimeClasspath:

+--- org.spockframework:spock-core:1.1-groovy-2.4
|    +--- org.codehaus.groovy:groovy-all:2.4.9 -> 2.4.15
|    \--- junit:junit:4.12
|         \--- org.hamcrest:hamcrest-core:1.3
+--- io.ratpack:ratpack-groovy-test:1.6.0-rc-1
|    +--- org.codehaus.groovy:groovy-all:2.4.15
|    +--- io.ratpack:ratpack-groovy:1.6.0-rc-1
|    |    +--- org.codehaus.groovy:groovy-all:2.4.15
|    |    +--- io.ratpack:ratpack-core:1.6.0-rc-1 (*)
|    |    \--- io.ratpack:ratpack-guice:1.6.0-rc-1 (*)

@jdbevan
Copy link
Contributor Author

jdbevan commented Nov 21, 2018

Adding an explicit testCompile for org.codehaus.groovy:groovy-all:2.5.4 in my gradle config worked around this problem

@johnrengelman
Copy link
Member

This will be address in 1.7 once Gradle 5 is available which we need (because of ratpack-gradle) to move to Groovy 2.5.x

#1412

@johnrengelman johnrengelman added this to the release-1.7.0 milestone Nov 21, 2018
@beckje01 beckje01 added the java9+ Related to running on Java versions 9 and after label Nov 21, 2018
@jdbevan
Copy link
Contributor Author

jdbevan commented Nov 22, 2018

FYI the test above works with Java 8 without bumping the groovy-all dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java9+ Related to running on Java versions 9 and after
Projects
None yet
Development

No branches or pull requests

4 participants