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

Hide lambda proxy frames in stacktraces

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P3
    • Resolution: Fixed
    • 8
    • 9
    • hotspot
    • svc
    • b52

    Backports

      Description

        [From Brian Goetz]

        public class Foo {
         public static void main(String[] args) {
           Runnable r = () -> { throw new RuntimeException(); };
           r.run();
         }
        }

        which produces:

        Exception in thread "main" java.lang.RuntimeException
        at Foo.lambda$0(Foo.java:3)
        at Foo$$Lambda$1.run(Unknown Source)
        at Foo.main(Foo.java:4)

        Here, Foo$$Lambda$1 is a synthetic class generated by the bootstrap of the lambda factory call site. (Lambdas are created by invoking an invokedynamic callsite, which returns the lambda. The bootstrap spins classes as necessary.)

        Ideally the user would want to see the calling line (r.run()) and the callee (the lambda) and nothing in between.

        Attachments

          Issue Links

            Activity

              People

                sla Staffan Larsen (Inactive)
                sla Staffan Larsen (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: