Details
-
Type:
Bug
-
Status: Closed
-
Priority:
P3
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 8
-
Component/s: specification
-
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.
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
- relates to
-
JDK-8030746 4.10: Define subtyping for inner classes of parameterized types
-
- Open
-
-
JDK-8029885 javac, fix subtype inference for a non-parameterized inner class of a generic type
-
- Resolved
-