JDK-8043351 : 4.5: Capture to check well-formedness of a parameterized type may be undefined
  • Type: Bug
  • Component: specification
  • Sub-Component: language
  • Affected Version: 5.0,7,8
  • Priority: P5
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2014-05-16
  • Updated: 2016-07-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorUnresolved
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
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.