luontola / retrolambda

Backport of Java 8's lambda expressions to Java 7, 6 and 5
Apache License 2.0
3.54k stars 227 forks source link

Fails to run under Java 9/10 with "-javaagent" provided #139

Closed bumfo closed 5 years ago

bumfo commented 6 years ago

with -javaagent argument removed, it runs correctly under Java 9/10

but when -javaagent argument is set:

00:00 ERROR: Failed to run Retrolambda
java.lang.RuntimeException: Failed to backport class: xxx
  at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:129)
  at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:107)
  at net.orfjackal.retrolambda.Transformers.backportClass(Transformers.java:47)
  at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:92)
  at net.orfjackal.retrolambda.Main.main(Main.java:28)
Caused by: java.lang.RuntimeException: Failed to backport lambda or method reference: xxx (6)
  at net.orfjackal.retrolambda.lambdas.LambdaReifier.reifyLambdaClass(LambdaReifier.java:44)
  at net.orfjackal.retrolambda.lambdas.BackportLambdaInvocations$InvokeDynamicInsnConverter.backportLambda(BackportLambdaInvocations.java:194)
  at net.orfjackal.retrolambda.lambdas.BackportLambdaInvocations$InvokeDynamicInsnConverter.visitInvokeDynamicInsn(BackportLambdaInvocations.java:183)
  at net.orfjackal.retrolambda.asm.ClassReader.readCode(ClassReader.java:1519)
  at net.orfjackal.retrolambda.asm.ClassReader.readMethod(ClassReader.java:1032)
  at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:708)
  at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:521)
  at net.orfjackal.retrolambda.Transformers.lambda$transform$4(Transformers.java:107)
  at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:125)
  ... 4 more
Caused by: java.util.NoSuchElementException
  at java.base/java.util.concurrent.LinkedBlockingDeque.getFirst(LinkedBlockingDeque.java:544)
  at net.orfjackal.retrolambda.lambdas.LambdaReifier.getLambdaFactoryMethod(LambdaReifier.java:94)
  at net.orfjackal.retrolambda.lambdas.LambdaReifier.reifyLambdaClass(LambdaReifier.java:41)
  ... 12 more
luontola commented 6 years ago

Java 9 is not officially supported, though PRs are welcome if somebody really wants to use them. (Personally I don't see Java 9/10 adding any language features even half as useful as lambdas.)

The workaround is to use Java 8.

luontola commented 5 years ago

This should be fixed in Retrolambda 2.5.6