Guice: New release for Java 11?

Created on 12 Sep 2018  路  17Comments  路  Source: google/guice

Java 11 is in RC and will be out in a couple weeks. The latest ASM is out and supports Java 11 bytecode already. Is a new release required?

Most helpful comment

released guice 4.2.2 w/ new cglib & asm. may take a couple hours before it shows up on maven central.

All 17 comments

Definitely a new release Guice-4.2.1 is needed.
I can't run my code on Java 10 either without the newest ASM.
I use now 4.2.1-SNAPSHOT updated 2 days ago successfully.
Please release 4.2.1 ASAP, thanks!

FYI 4.2.1 is released with proper jdk10 support. it may be better for jdk11 too, but asm doesn't have a non-experimental way of supporting jdk11 yet, so i'll do another release for jdk11 once that's out.

It's ok.
When will guice-4.2.1 be available in maven central?

It should be on maven central now.

@sameb it is, works for my case, thanks a lot.

When asm releases a new version that non-experimentally supports JDK11, I'll include that and re-release. Feel free to ping here when ASM releases a new version, thanks.

@sameb is there any asm issue at all? Can't find any one here https://gitlab.ow2.org/asm/asm/issues?scope=all&utf8=%E2%9C%93&state=opened

UPDATE, new versions would appear here:
https://asm.ow2.io/versions.html

no there is no bug in asm we're waiting on. we're just waiting on a release of ASM that supports JDK11 properly. asm reads bytecode, and jdk11 added new bytecode. the current version has an experimental JDK11 mode that can be enabled using ASM7_EXPERIMENTAL, but i don't want a proper release of guice to depend on experimental stuff. asm apparently releases builds that properly support the current JDK a few days after the JDK itself is released.

On JDK 11 with Guice 4.2.1 I was getting the exception

Caused by: java.lang.UnsupportedOperationException
    at com.google.inject.internal.asm.$ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
    at com.google.inject.internal.asm.$ClassReader.accept(ClassReader.java:651)
    at com.google.inject.internal.asm.$ClassReader.accept(ClassReader.java:391)
    at com.google.inject.internal.cglib.core.$DuplicatesPredicate.<init>(DuplicatesPredicate.java:93)
    at com.google.inject.internal.cglib.proxy.$Enhancer.getMethods(Enhancer.java:557)
    at com.google.inject.internal.cglib.proxy.$Enhancer.getMethods(Enhancer.java:535)
    at com.google.inject.internal.ProxyFactory.<init>(ProxyFactory.java:87)
    at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:82)
    at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:37)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
    at com.google.inject.internal.FailableCache$1.load(FailableCache.java:40)

because of the ASM7_EXPERIMENTAL opcodes.

You can workaround this by passing

-Dcom.google.inject.internal.cglib.$experimental_asm7=true

to the jvm

the current version has an experimental JDK11 mode that can be enabled using ASM7_EXPERIMENTAL, but i don't want a proper release of guice to depend on experimental stuff.

In this PR I did just that and released the artifacts here. With that custom Guice release Gerrit Code Review works as expected with Java 11: [1].

[1] https://gerrit-review.googlesource.com/c/gerrit/+/194040

Yup, I just don't want to make an official release using experimental stuff. Once asm puts out a release with a non experimental version, I'll use it.

@sameb Thanks!

released guice 4.2.2 w/ new cglib & asm. may take a couple hours before it shows up on maven central.

@sameb Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gripedthumbtacks picture gripedthumbtacks  路  126Comments

kamenik picture kamenik  路  5Comments

riuvshin picture riuvshin  路  14Comments

jhm-ciberman picture jhm-ciberman  路  10Comments

vgarmash picture vgarmash  路  4Comments