Skip to content

Commit

Permalink
Report problematic class only once and let it crash
Browse files Browse the repository at this point in the history
Relates to #69
  • Loading branch information
luontola committed Dec 18, 2015
1 parent 60bcc67 commit a1c10cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private byte[] transform(String className, Consumer<ClassVisitor> reader, ClassV
if (className != null) {
className = className.replace('/', '.');
}
throw new RuntimeException("Failed to transform class " + className, t);
throw new RuntimeException("Failed to backport class: " + className, t);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import net.orfjackal.retrolambda.files.OutputDirectory;
import org.objectweb.asm.ClassReader;

import java.io.IOException;

public class LambdaClassSaver {

private final OutputDirectory saver;
Expand All @@ -25,14 +27,12 @@ public void saveIfLambda(String className, byte[] bytecode) {
}

private void reifyLambdaClass(String className, byte[] bytecode) {
System.out.println("Saving lambda class: " + className);
bytecode = transformers.backportLambdaClass(new ClassReader(bytecode));
try {
System.out.println("Saving lambda class: " + className);
saver.writeClass(transformers.backportLambdaClass(new ClassReader(bytecode)));

} catch (Throwable t) {
// print to stdout to keep in sync with other log output
System.out.println("ERROR: Failed to backport lambda class: " + className);
t.printStackTrace(System.out);
saver.writeClass(bytecode);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

0 comments on commit a1c10cc

Please sign in to comment.