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

Suspect message regarding suitable enclosing instance not being in scope

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • tools
    • b97
    • generic
    • generic
    • Verified

      ( http://stackoverflow.com/questions/26258412/invalid-constructor-reference-when-using-local-class as pointed out by Brian)

      javac on jdk9 tip refuses to compile this program:

      // --
      import java.util.ArrayList;
      import java.util.List;

      public class X {

          public static void main(String[] args) {
          }

          public void foo() {
              class LocalFoo {
                  LocalFoo(String in) {
                  }
              }

              List<String> ls = new ArrayList<>();
              new LocalFoo("");
              ls.stream().map(LocalFoo::new); //Line 21
          }
      }

      ECJ compiles it alright. Javac compiles the direct inner object instantiation.

            sadayapalam Srikanth Adayapalam (Inactive)
            sadayapalam Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: