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

Lambda Spec: Raw inner class constructor ref should not attempt diamond inference

    Details

    • Subcomponent:
    • Verification:
      Verified

      Description

      A raw type that is a non-static member type of another raw type (see JLS 4.8) cannot be used with diamond inference. A method reference to such a raw type's constructor should simply use the raw constructor rather than trying to infer a parameterization.

      Example:

      class Outer<T> {
        class Inner1 {}
        class Inner2<U> {}

        Supplier<Outer.Inner1> s1 = Outer.Inner1::new; // ok
        Supplier<Outer.Inner2> s2 = Outer.Inner2::new; // ok
        Supplier<Outer<T>.Inner1> s3 = Outer.Inner1::new; // unchecked conversion
        Supplier<Outer<T>.Inner2<String>> s4 = Outer.Inner2::new; // unchecked conversion
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dlsmith Dan Smith
                Reporter:
                dlsmith Dan Smith
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: