-
Bug
-
Resolution: Unresolved
-
P5
-
5.0, 7, 8
The following parameterized type should be considered malformed:
class C<T extends Number> {}
C<? extends String> test;
This is sort of implied by 4.5, but could be more clear.
Specifically, well-formedness relies on capturing C<? extends String> and then checking that the capture variable is a subtype of Number. Capture, in turn, performs glb(String, Number), with this stipulation (5.1.10):
"It is a compile-time error if, for any two classes (not interfaces) Vi and Vj, Vi is not a subclass of Vj or vice versa."
In other words, in 4.5, the capture of C<T1,...,Tn> may be undefined. It would be helpful to call this out as a possible condition under which the type C<T1,...,Tn> may be considered malformed.
class C<T extends Number> {}
C<? extends String> test;
This is sort of implied by 4.5, but could be more clear.
Specifically, well-formedness relies on capturing C<? extends String> and then checking that the capture variable is a subtype of Number. Capture, in turn, performs glb(String, Number), with this stipulation (5.1.10):
"It is a compile-time error if, for any two classes (not interfaces) Vi and Vj, Vi is not a subclass of Vj or vice versa."
In other words, in 4.5, the capture of C<T1,...,Tn> may be undefined. It would be helpful to call this out as a possible condition under which the type C<T1,...,Tn> may be considered malformed.
- blocks
-
JDK-8048526 Well-formed wild-carded parameterized type of Iface<T extends U, U> fails to compile
-
- Open
-
- relates to
-
JDK-8054941 4.5: Possibly modify well-formedness restriction for wildcards?
-
- Open
-
-
JDK-8039222 5.1.10: Define glb for non-class types
-
- Open
-
-
JDK-8054937 5.1.10: Fresh capture variables sometimes can't conform to bounds
-
- Open
-
-
JDK-8145614 9.9: Fix non-wildcard parameterization process to match javac
-
- Open
-
-
JDK-8034147 javac crashes with a NullPointerException during bounds checking
-
- Closed
-
(1 relates to)