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

Diagnostic with incorrect line info generated when compiling lambda expression

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • 9, 10, 11
    • 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


            bsrbnd Bernard Blaser
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: