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

Lambda Spec: Fix subtype inference for a non-parameterized inner class of a generic type

    XMLWordPrintable

    Details

    • Subcomponent:
    • Verification:
      Verified

      Description

      Uses of a class like Inner, below, are not parameterized types (per JLS 4.5).

      class Outer<T> {
        abstract class Inner { abstract T get(); }

        static <X> X unwrap(Outer<X>.Inner i) { return i.get(); }

        static void test(Outer<String>.Inner i) {
          unwrap(i).substring(3);
        }

      }

      But, clearly, subtype inference should treat it just like a parameterized type. The rules in 18.2.3 should be modified to allow, e.g., x=String to be inferred above.

        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: