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

    • Verified

      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.

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

              Created:
              Updated:
              Resolved: