Skip to content

Broken on JDK 8 build b121 #3

Closed
@luontola

Description

@luontola

Reported at http://blog.orfjackal.net/2013/07/lambda-expressions-backported-to-java-7.html by Serge Zaitsev

Test.java:

public class Test {
    public static void main(String[] args) {
        System.out.println("=== Runnable test on Dalvik VM ===");
        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                System.out.println("First runnable");
            }
        };
        Runnable r2 = () -> { System.out.println("Second runnable"); };

        r1.run(); r2.run();
    }
}

Compile:

$ /tmp/jdk1.8.0/bin/javac Test.java

Run retrolambda:

$ /tmp/jdk1.8.0/bin/java -Dretrolambda.inputDir=. -Dretrolambda.classpath=. -javaagent:retrolambda.jar -jar retrolambda.jar
Retrolambda 1.1.1  
Bytecode version: 51 (Java 7)
Input directory:  .
Output directory: .
Classpath:        .
Error! Failed to transform some classes
java.lang.RuntimeException: java.util.NoSuchElementException
    at net.orfjackal.retrolambda.LambdaReifier.reifyLambdaClass(LambdaReifier.java:32)
    at net.orfjackal.retrolambda.LambdaUsageBackporter$InvokeDynamicInsnConvertingMethodVisitor.backportLambda(LambdaUsageBackporter.java:107)
    at net.orfjackal.retrolambda.LambdaUsageBackporter$InvokeDynamicInsnConvertingMethodVisitor.visitInvokeDynamicInsn(LambdaUsageBackporter.java:99)
    at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1343)
    at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:938)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:669)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
    at net.orfjackal.retrolambda.LambdaUsageBackporter.transform(LambdaUsageBackporter.java:28)
    at net.orfjackal.retrolambda.Main$1.transform(Main.java:40)
    at net.orfjackal.retrolambda.BytecodeTransformingFileVisitor.visitFile(BytecodeTransformingFileVisitor.java:25)
    at net.orfjackal.retrolambda.BytecodeTransformingFileVisitor.visitFile(BytecodeTransformingFileVisitor.java:11)
    at java.nio.file.Files.walkFileTree(Files.java:2667)
    at java.nio.file.Files.walkFileTree(Files.java:2739)
    at net.orfjackal.retrolambda.Main.main(Main.java:38)
Caused by: java.util.NoSuchElementException
    at java.util.concurrent.LinkedBlockingDeque.getFirst(LinkedBlockingDeque.java:553)
    at net.orfjackal.retrolambda.LambdaReifier.getLambdaFactoryMethod(LambdaReifier.java:47)
    at net.orfjackal.retrolambda.LambdaReifier.reifyLambdaClass(LambdaReifier.java:29)
    ... 13 more

$ env | grep J
JAVA_HOME=/tmp/jdk1.8.0
JAVAC=/tmp/jdk1.8.0/bin/javac
JDK_HOME=/tmp/jdk1.8.0
JAVA8_HOME=/tmp/jdk1.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions