< prev index next >

src/java.base/share/classes/java/lang/reflect/TypeVariable.java

Print this page




  34  * requires the resolution (see JVMS 5) of the ith enclosing class of T,
  35  * for i = 0 to n, inclusive. Creating a type variable must not cause the
  36  * creation of its bounds. Repeated creation of a type variable has no effect.
  37  *
  38  * <p>Multiple objects may be instantiated at run-time to
  39  * represent a given type variable. Even though a type variable is
  40  * created only once, this does not imply any requirement to cache
  41  * instances representing the type variable. However, all instances
  42  * representing a type variable must be equal() to each other.
  43  * As a consequence, users of type variables must not rely on the identity
  44  * of instances of classes implementing this interface.
  45  *
  46  * @param <D> the type of generic declaration that declared the
  47  * underlying type variable.
  48  *
  49  * @since 1.5
  50  */
  51 public interface TypeVariable<D extends GenericDeclaration> extends Type, AnnotatedElement {
  52     /**
  53      * Returns an array of {@code Type} objects representing the
  54      * upper bound(s) of this type variable.  Note that if no upper bound is
  55      * explicitly declared, the upper bound is {@code Object}.
  56      *
  57      * <p>For each upper bound B: <ul> <li>if B is a parameterized
  58      * type or a type variable, it is created, (see {@link
  59      * java.lang.reflect.ParameterizedType ParameterizedType} for the
  60      * details of the creation process for parameterized types).
  61      * <li>Otherwise, B is resolved.  </ul>
  62      *
  63      * @throws TypeNotPresentException  if any of the
  64      *     bounds refers to a non-existent type declaration
  65      * @throws MalformedParameterizedTypeException if any of the
  66      *     bounds refer to a parameterized type that cannot be instantiated
  67      *     for any reason
  68      * @return an array of {@code Type}s representing the upper
  69      *     bound(s) of this type variable
  70     */
  71     Type[] getBounds();
  72 
  73     /**
  74      * Returns the {@code GenericDeclaration} object representing the




  34  * requires the resolution (see JVMS 5) of the ith enclosing class of T,
  35  * for i = 0 to n, inclusive. Creating a type variable must not cause the
  36  * creation of its bounds. Repeated creation of a type variable has no effect.
  37  *
  38  * <p>Multiple objects may be instantiated at run-time to
  39  * represent a given type variable. Even though a type variable is
  40  * created only once, this does not imply any requirement to cache
  41  * instances representing the type variable. However, all instances
  42  * representing a type variable must be equal() to each other.
  43  * As a consequence, users of type variables must not rely on the identity
  44  * of instances of classes implementing this interface.
  45  *
  46  * @param <D> the type of generic declaration that declared the
  47  * underlying type variable.
  48  *
  49  * @since 1.5
  50  */
  51 public interface TypeVariable<D extends GenericDeclaration> extends Type, AnnotatedElement {
  52     /**
  53      * Returns an array of {@code Type} objects representing the
  54      * upper bound(s) of this type variable.  If no upper bound is
  55      * explicitly declared, the upper bound is {@code Object}.
  56      *
  57      * <p>For each upper bound B: <ul> <li>if B is a parameterized
  58      * type or a type variable, it is created, (see {@link
  59      * java.lang.reflect.ParameterizedType ParameterizedType} for the
  60      * details of the creation process for parameterized types).
  61      * <li>Otherwise, B is resolved.  </ul>
  62      *
  63      * @throws TypeNotPresentException  if any of the
  64      *     bounds refers to a non-existent type declaration
  65      * @throws MalformedParameterizedTypeException if any of the
  66      *     bounds refer to a parameterized type that cannot be instantiated
  67      *     for any reason
  68      * @return an array of {@code Type}s representing the upper
  69      *     bound(s) of this type variable
  70      */
  71     Type[] getBounds();
  72 
  73     /**
  74      * Returns the {@code GenericDeclaration} object representing the


< prev index next >