JDK-8061426 : Wildcard should have multiple bounds similar to type variables
  • Type: Enhancement
  • Component: specification
  • Sub-Component: language
  • Priority: P5
  • Status: Closed
  • Resolution: Other
  • Submitted: 2004-05-26
  • Updated: 2014-12-11
  • Resolved: 2014-10-17
Related Reports
Relates :  
Relates :  
Description
Currently wildcards can only have one bound, whereas type variables can have
multiple bounds:

<T extends Number & Cloneable> void m(List<T> l);

A similar method could be expressed using wildcards with multiple bounds:

void m(List<? extends Number & Cloneable> l);

Among the benefits of using wildcards over type variables are:

1. The signature becomes simpler since you do not need to add a type variable
   to express the constraints on l.
2. The signature using wildcards states implicitly that you do not intent to
   modify l (at least not add new non-null elements).
3. It is not necessary to understand the rules of inference to read the
   signature.

###@###.### 2004-05-25

Comments
The 'specification' component of the Java Bug System is for reporting technical errors and ambiguities in the text of The Java Language Specification and The JVM Specification. It is not the venue to propose new features in the Java language or JVM. Ongoing feature development is carried out in OpenJDK (http://openjdk.java.net/jeps/); corresponding enhancements to The Java Language Specification and The JVM Specification are managed through the Java Community Process (http://jcp.org/).
17-10-2014

EVALUATION It is probably an oversight that we didn't do things this way to begin with. ###@###.### 2004-05-25 Yes; I believe it is not worth changing thes pecification unless the FCS implementation will conform to it. Othrewise we will be opening the door to conformance problems for users. May be fixed in a future revision. ###@###.### 2004-05-26
26-05-2004