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

IllegalStateException: Deque full #76

Open ddebrunner opened 8 years ago

ddebrunner commented 8 years ago

Converting this class causes a Deque full exception. The addition of the field DISCARD causes the problem.

public interface X { static X DISCARD = t -> {}; void accept(T x); }

 [exec] Retrolambda 2.0.6
 [exec] Bytecode version: 51 (Java 7)
 [exec] Default methods:  true
 [exec] Input directory:  tt
 [exec] Output directory: /home/streamsadmin/diztill/dec2015/diztill/java7/classes
 [exec] Classpath:        tt
 [exec] Saving lambda class: X$$Lambda$1
 [exec] Saving lambda class: X$$Lambda$5
 [exec] ERROR: Failed to backport lambda class: X$$Lambda$5
 [exec] java.lang.IllegalStateException: Deque full
 [exec] at java.util.concurrent.LinkedBlockingDeque.addFirst(LinkedBlockingDeque.java:326)
 [exec] at java.util.concurrent.LinkedBlockingDeque.push(LinkedBlockingDeque.java:770)
 [exec] at net.orfjackal.retrolambda.lambdas.LambdaReifier.setLambdaClass(LambdaReifier.java:65)
 [exec] at net.orfjackal.retrolambda.lambdas.BackportLambdaClass.visit(BackportLambdaClass.java:29)
 [exec] at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:622)
 [exec] at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:506)
 [exec] at net.orfjackal.retrolambda.Transformers.lambda$transform$4(Transformers.java:106)
 [exec] at net.orfjackal.retrolambda.Transformers$$Lambda$3.00000000846BB390.accept(Unknown Source)
 [exec] at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:121)
 [exec] at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:106)
 [exec] at net.orfjackal.retrolambda.Transformers.backportLambdaClass(Transformers.java:29)
 [exec] at net.orfjackal.retrolambda.lambdas.LambdaClassSaver.reifyLambdaClass(LambdaClassSaver.java:30)
 [exec] at net.orfjackal.retrolambda.lambdas.LambdaClassSaver.saveIfLambda(LambdaClassSaver.java:23)
 [exec] at net.orfjackal.retrolambda.lambdas.LambdaClassDumper$ClassChannel.close(LambdaClassDumper.java:145)
 [exec] at java.nio.channels.Channels$1.close(Channels.java:189)
 [exec] at java.nio.file.Files.write(Files.java:3311)
 [exec] at java.lang.invoke.ProxyClassesDumper.dumpClass(ProxyClassesDumper.java:152)
 [exec] at java.lang.invoke.InnerClassLambdaMetafactory$2.run(InnerClassLambdaMetafactory.java:327)
 [exec] at java.lang.invoke.InnerClassLambdaMetafactory$2.run(InnerClassLambdaMetafactory.java:324)
 [exec] at java.security.AccessController.doPrivileged(AccessController.java:503)
 [exec] at java.lang.invoke.InnerClassLambdaMetafactory.spinInnerClass(InnerClassLambdaMetafactory.java:324)
 [exec] at java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:206)
 [exec] at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:315)
 [exec] at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:538)
 [exec] at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:591)
 [exec] at net.orfjackal.retrolambda.lambdas.LambdaReifier.callBootstrapMethod(LambdaReifier.java:110)
 [exec] at net.orfjackal.retrolambda.lambdas.LambdaReifier.reifyLambdaClass(LambdaReifier.java:37)
 [exec] at net.orfjackal.retrolambda.lambdas.BackportLambdaInvocations$InvokeDynamicInsnConverter.backportLambda(BackportLambdaInvocations.java:118)
 [exec] at net.orfjackal.retrolambda.lambdas.BackportLambdaInvocations$InvokeDynamicInsnConverter.visitInvokeDynamicInsn(BackportLambdaInvocations.java:107)
 [exec] at net.orfjackal.retrolambda.asm.ClassReader.readCode(ClassReader.java:1452)
 [exec] at net.orfjackal.retrolambda.asm.ClassReader.readMethod(ClassReader.java:1017)
 [exec] at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:693)
 [exec] at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:506)
 [exec] at net.orfjackal.retrolambda.Transformers.backportInterface(Transformers.java:63)
 [exec] at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:74)
 [exec] at net.orfjackal.retrolambda.Main.main(Main.java:26)
luontola commented 8 years ago

I'm unable to reproduce this bug. There is something weird about it: the log shows that the X class has 2 or 5 lambdas (possibly 3 lambdas in a dependency), but your example code has only one. Also your example code doesn't compile; there is no type T.

Please post the full .java file and also a copy of the .class file before it was processed by Retrolambda.

ddebrunner commented 8 years ago

Sorry, the markup stripped the generics:

public interface X<T>
{
    static X<Object> DISCARD = t -> {};
    void accept(T x);
}
luontola commented 8 years ago

I'm unable to reproduce this with the source code. Please send me the X.class file as it is before processing it with Retrolambda.

luontola commented 8 years ago

Also, which compiler are you using?

ddebrunner commented 8 years ago

I'm using the IBM Java 8 compiler.

X.class should be here

https://ibm.box.com/s/etln28qbjb1lzageusu1itq2nbudo7r8

luontola commented 8 years ago

I'm able to backport that X.class without problems. So the class file has no problems. I'll still need to test whether running Retrolambda on IBM Java 8 is the problem.