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

breaks on JDK 13 #154

Closed
codefromthecrypt opened this issue Oct 29, 2019 · 5 comments
Closed

breaks on JDK 13 #154

codefromthecrypt opened this issue Oct 29, 2019 · 5 comments
Labels

Comments

@codefromthecrypt
Copy link

Not sure if this project is active anymore, but would be awesome if it were. Currently JDK 13 isn't usable due to below:

[INFO] --- retrolambda-maven-plugin:2.5.6:process-main (default) @ zipkin-reporter ---
[INFO] Retrieving Retrolambda 2.5.6
[INFO] Configured Artifact: net.orfjackal.retrolambda:retrolambda:2.5.6:jar
[INFO] Copying retrolambda-2.5.6.jar to /Users/acole/oss/zipkin-reporter-java/core/target/retrolambda/retrolambda.jar
[INFO] Processing classes with Retrolambda
[INFO] Executing tasks

main:
     [exec] 00:00 ERROR: Failed to transform java/lang/invoke/InnerClassLambdaMetafactory, cannot enable the Java agent. Please report an isOpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appendesue to Retrolambda with full logs. Probably you're running on an unsupported Java version.
     [exec] java.lang.IllegalArgumentException: Unsupported class file major version 57
     [exec] 	at net.orfjackal.retrolambda.asm.ClassReader.<init>(ClassReader.java:184)
     [exec] 	at net.orfjackal.retrolambda.asm.ClassReader.<init>(ClassReader.java:166)
     [exec] 	at net.orfjackal.retrolambda.asm.ClassReader.<init>(ClassReader.java:152)
     [exec] 	at net.orfjackal.retrolambda.lambdas.InnerClassLambdaMetafactoryTransformer.transformMetafactory(InnerClassLambdaMetafactoryTransformer.java:36)
     [exec] 	at net.orfjackal.retrolambda.lambdas.InnerClassLambdaMetafactoryTransformer.transform(InnerClassLambdaMetafactoryTransformer.java:22)
     [exec] 	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:246)
     [exec] 	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
     [exec] 	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:563)
     [exec] 	at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
     [exec] 	at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.javad
     [exec] :167)
     [exec] 	at net.orfjackal.retrolambda.PreMain.premain(PreMain.java:22)
     [exec] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [exec] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     [exec] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     [exec] 	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
     [exec] 	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
     [exec] 	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
     [exec] Retrolambda 2.5.6
     [exec] 00:00 ERROR: Failed to run Retrolambda
     [exec] java.lang.IllegalStateException: Cannot initialize dumper; unexpected JDK implementation. Please run Retrolambda using the Java agent (enable forking in the Maven plugin).
     [exec] 	at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.install(LambdaClassDumper.java:38)
     [exec] 	at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:67)
     [exec] 	at net.orfjackal.retrolambda.Main.main(Main.java:28)
     [exec] 	Suppressed: java.lang.RuntimeException: java.lang.IllegalAccessException: class net.orfjackal.retrolambda.lambdas.LambdaClassDumper cannot access a member of class java.lang.invoke.InnerClassLambdaMetafactory (in module java.base) with modifiers "private static final"
     [exec] 		at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.uninstall(LambdaClassDumper.java:48)
     [exec] 		at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.close(LambdaClassDumper.java:55)
     [exec] 		at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:102)
     [exec] 		... 1 more
     [exec] 	Caused by: java.lang.IllegalAccessException: class net.orfjackal.retrolambda.lambdas.LambdaClassDumper cannot access a member of class java.lang.invoke.InnerClassLambdaMetafactory (in module java.base) with modifiers "private static final"
     [exec] 		at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:376)
     [exec] 		at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:642)
     [exec] 		at java.base/java.lang.reflect.Field.checkAccess(Field.java:1075)
     [exec] 		at java.base/java.lang.reflect.Field.set(Field.java:778)
     [exec] 		at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.uninstall(LambdaClassDumper.java:46)
     [exec] 		... 3 more
     [exec] Caused by: java.lang.NoSuchFieldException: modifiers
     [exec] 	at java.base/java.lang.Class.getDeclaredField(Class.java:2412)
     [exec] 	at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.makeNonFinal(LambdaClassDumper.java:59)
     [exec] 	at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.install(LambdaClassDumper.java:32)
     [exec] 	... 2 more
@luontola
Copy link
Owner

Retrolambda only supports backporting Java 8 bytecode. Backporting newer language features is outside the scope of this project, so the workaround is to compile the project using Java 8.

@codefromthecrypt
Copy link
Author

The source is 1.8 on this project (ex set in the compiler plugin) and all is well in JDK 11. Are you saying that JDK 11 accidentally works and that we shouldn't expect it to?

PS we also have fork set to true here

@luontola
Copy link
Owner

Retrolambda's tests are run using also JDK 11 (https://github.com/luontola/retrolambda/blob/master/scripts/build.sh#L82), so it works to some extend, though features beyond Java 8 are not backported. It could still break at some point, so building the project with Java 8 is the best bet.

The error "Unsupported class file major version 57" indicates that some classes use Java 13 bytecode. The IllegalAccessException might have to do with stricter access checks in the recent Java versions.

@luontola
Copy link
Owner

Upgrading ASM library fixed the Java 13 compatibility. Java 12 and 13 should work only with fork=true. This fix is included in Retrolambda 2.5.7.

@codefromthecrypt
Copy link
Author

codefromthecrypt commented Jan 24, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants