< prev index next >

src/java.desktop/share/classes/com/sun/beans/TypeResolver.java

Print this page
rev 60127 : 8249205: Remove unnecessary trademark symbols


 207      * Replaces type variables of all formal types in the given array
 208      * with the types they stand for in the given {@code actual} type.
 209      *
 210      * @param actual   the type that supplies bindings for type variables
 211      * @param formals  the array of types to resolve
 212      * @return an array of resolved types
 213      */
 214     public static Type[] resolve(Type actual, Type[] formals) {
 215         int length = formals.length;
 216         Type[] actuals = new Type[length];
 217         for (int i = 0; i < length; i++) {
 218             actuals[i] = resolve(actual, formals[i]);
 219         }
 220         return actuals;
 221     }
 222 
 223     /**
 224      * Converts the given {@code type} to the corresponding class.
 225      * This method implements the concept of type erasure,
 226      * that is described in section 4.6 of
 227      * <cite>The Java&trade; Language Specification</cite>.
 228      *
 229      * @param type  the array of types to convert
 230      * @return a corresponding class
 231      */
 232     public static Class<?> erase(Type type) {
 233         if (type instanceof Class) {
 234             return (Class<?>) type;
 235         }
 236         if (type instanceof ParameterizedType) {
 237             ParameterizedType pt = (ParameterizedType) type;
 238             return (Class<?>) pt.getRawType();
 239         }
 240         if (type instanceof TypeVariable) {
 241             TypeVariable<?> tv = (TypeVariable<?>)type;
 242             Type[] bounds = tv.getBounds();
 243             return (0 < bounds.length)
 244                     ? erase(bounds[0])
 245                     : Object.class;
 246         }
 247         if (type instanceof WildcardType) {




 207      * Replaces type variables of all formal types in the given array
 208      * with the types they stand for in the given {@code actual} type.
 209      *
 210      * @param actual   the type that supplies bindings for type variables
 211      * @param formals  the array of types to resolve
 212      * @return an array of resolved types
 213      */
 214     public static Type[] resolve(Type actual, Type[] formals) {
 215         int length = formals.length;
 216         Type[] actuals = new Type[length];
 217         for (int i = 0; i < length; i++) {
 218             actuals[i] = resolve(actual, formals[i]);
 219         }
 220         return actuals;
 221     }
 222 
 223     /**
 224      * Converts the given {@code type} to the corresponding class.
 225      * This method implements the concept of type erasure,
 226      * that is described in section 4.6 of
 227      * <cite>The Java Language Specification</cite>.
 228      *
 229      * @param type  the array of types to convert
 230      * @return a corresponding class
 231      */
 232     public static Class<?> erase(Type type) {
 233         if (type instanceof Class) {
 234             return (Class<?>) type;
 235         }
 236         if (type instanceof ParameterizedType) {
 237             ParameterizedType pt = (ParameterizedType) type;
 238             return (Class<?>) pt.getRawType();
 239         }
 240         if (type instanceof TypeVariable) {
 241             TypeVariable<?> tv = (TypeVariable<?>)type;
 242             Type[] bounds = tv.getBounds();
 243             return (0 < bounds.length)
 244                     ? erase(bounds[0])
 245                     : Object.class;
 246         }
 247         if (type instanceof WildcardType) {


< prev index next >