Diagnostic with incorrect line info generated when compiling lambda expression

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 11
    • Affects Version/s: 9, 10, 11
    • Component/s: tools
    • 9
    • b12

      When compiling this program:

      package issue;
      public class A {

          public static interface I {
              public void m(String s);
          }
          
          public void add (I i) {}
          
          public static void main(String[] args) {
              A a = new A();
              a.add(() -> {});
          }
      }

      A spurious diagnostic is generated (with the wrong line info):

      error: incompatible types: incompatible parameter types in lambda expression
      class A {
      ^
      Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
      1 error


            Assignee:
            Bernard Blaser
            Reporter:
            Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: