Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8016334

Hide the lambda proxy frame

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • None
    • core-libs

      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);

      Submitted on behalf of Rémi Forax.



            sla Staffan Larsen (Inactive)
            rfield Robert Field (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: