8250660: Clarify that WildcardType and AnnotatedWildcardType bounds methods return one

Reviewed-by: mchung, dholmes
This commit is contained in:
Joe Darcy 2020-08-05 23:02:22 -07:00
parent dc86b2e22b
commit 2d3372c8b5
2 changed files with 16 additions and 2 deletions

View File

@ -40,6 +40,10 @@ public interface AnnotatedWildcardType extends AnnotatedType {
* If no lower bound is explicitly declared, the lower bound is the
* type of null. In this case, a zero length array is returned.
*
* @apiNote While to date a wildcard may have at most one lower
* bound, callers of this method should be written to accommodate
* multiple bounds.
*
* @return the potentially annotated lower bounds of this wildcard type or
* an empty array if no lower bound is explicitly declared.
* @see WildcardType#getLowerBounds()
@ -51,6 +55,10 @@ public interface AnnotatedWildcardType extends AnnotatedType {
* If no upper bound is explicitly declared, the upper bound is
* unannotated {@code Object}
*
* @apiNote While to date a wildcard may have at most one upper
* bound, callers of this method should be written to accommodate
* multiple bounds.
*
* @return the potentially annotated upper bounds of this wildcard type
* @see WildcardType#getUpperBounds()
*/

View File

@ -46,6 +46,10 @@ public interface WildcardType extends Type {
* <li>Otherwise, B is resolved.
* </ul>
*
* @apiNote While to date a wildcard may have at most one upper
* bound, callers of this method should be written to accommodate
* multiple bounds.
*
* @return an array of Types representing the upper bound(s) of this
* type variable
* @throws TypeNotPresentException if any of the
@ -70,6 +74,10 @@ public interface WildcardType extends Type {
* <li>Otherwise, B is resolved.
* </ul>
*
* @apiNote While to date a wildcard may have at most one lower
* bound, callers of this method should be written to accommodate
* multiple bounds.
*
* @return an array of Types representing the lower bound(s) of this
* type variable
* @throws TypeNotPresentException if any of the
@ -79,6 +87,4 @@ public interface WildcardType extends Type {
* for any reason
*/
Type[] getLowerBounds();
// one or many? Up to language spec; currently only one, but this API
// allows for generalization.
}