Hiding the lambda proxy frame

Remi Forax forax at univ-mlv.fr
Tue Jun 11 05:54:48 PDT 2013


Hi Brian, Paul, Robert, hi all,
currently when you print a stacktrace that show a call inside a lambda,
users can see the the frame corresponding to the method of the generated 
proxy.

By example:
java.lang.Throwable
     StackTraceTest.lambda$0(StackTraceTest.java:6)
     StackTraceTest$$Lambda$1.run(Unknown Source)     <---   ugly, isn't it
     StackTraceTest.main(StackTraceTest.java:8)

I think this line should not be visible to user, it doesn't provide 
useful information,
just make the stack trace longer than it should.

A method can be marked hidden in a stack trace by using the annotation 
LambdaFom.Hidden.

With ASM, one just have to add the following line:

mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);

cheers,
Rémi



More information about the lambda-dev mailing list