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

Wrong LineNumberTable for variable declarations in lambdas

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • tools
    • None
    • b115
    • Verified

      Consider this source code:
      -----
      package test;

      public class LambdaLNT {
          public static void main(String... args) {
              Runnable r = () -> {
                  int i = args.length;
              };
              r.run();
          }
      }
      -----

      When compiled with -g, the LineNumberTable for the lambda method looks like this:
            LineNumberTable:
              line 1: 0
              line 7: 3

      That is undoubtedly wrong: the first statement of the lambda does not start at line 1. As a consequence, debuggers would likely misbehave.

      This appears to be caused by a missing TreeMaker.at in LambdaToMethod.visitVarDef.

            jlahoda Jan Lahoda
            jlahoda Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: