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

Hide lambda proxy frames in stacktraces

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 8
    • hotspot
    • svc
    • b52

        [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.

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

                Created:
                Updated:
                Resolved: