final Type[] bounds = getImplicitBounds((TypeVariable<?>) type);
/** * <p>Determines whether or not specified types satisfy the bounds of their * mapped type variables. When a type parameter extends another (such as * {@code <T, S extends T>}), uses another as a type parameter (such as * {@code <T, S extends Comparable>>}), or otherwise depends on * another type variable to be specified, the dependencies must be included * in {@code typeVarAssigns}.</p> * * @param typeVarAssigns specifies the potential types to be assigned to the * type variables, not {@code null}. * @return whether or not the types can be assigned to their respective type * variables. */ public static boolean typesSatisfyVariables(final Map<TypeVariable<?>, Type> typeVarAssigns) { Validate.notNull(typeVarAssigns, "typeVarAssigns is null"); // all types must be assignable to all the bounds of their mapped // type variable. for (final Map.Entry<TypeVariable<?>, Type> entry : typeVarAssigns.entrySet()) { final TypeVariable<?> typeVar = entry.getKey(); final Type type = entry.getValue(); for (final Type bound : getImplicitBounds(typeVar)) { if (!isAssignable(type, substituteTypeVariables(bound, typeVarAssigns), typeVarAssigns)) { return false; } } } return true; }
for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) { if (isAssignable(bound, toGenericArrayType)) { return true;
for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) {
private void calculateExactType(TypeVariable<?> type) { logger.info("Calculating exact type for typevariable " + type); Type[] bounds = TypeUtils.getImplicitBounds(type); Type exactType = bounds[0]; for (VariableReference var : typeMap.get(type)) { Type candidateType = var.getType(); logger.info("Candidate type: " + candidateType); if (TypeUtils.isAssignable(candidateType, exactType)) { exactType = candidateType; } } logger.info("Result: " + exactType); }
final Type[] bounds = getImplicitBounds((TypeVariable<?>) type);
final Type[] bounds = getImplicitBounds((TypeVariable<?>) type);
/** * <p>Determines whether or not specified types satisfy the bounds of their * mapped type variables. When a type parameter extends another (such as * {@code <T, S extends T>}), uses another as a type parameter (such as * {@code <T, S extends Comparable>>}), or otherwise depends on * another type variable to be specified, the dependencies must be included * in {@code typeVarAssigns}.</p> * * @param typeVarAssigns specifies the potential types to be assigned to the * type variables, not {@code null}. * @return whether or not the types can be assigned to their respective type * variables. */ public static boolean typesSatisfyVariables(final Map<TypeVariable<?>, Type> typeVarAssigns) { Validate.notNull(typeVarAssigns, "typeVarAssigns is null"); // all types must be assignable to all the bounds of their mapped // type variable. for (final Map.Entry<TypeVariable<?>, Type> entry : typeVarAssigns.entrySet()) { final TypeVariable<?> typeVar = entry.getKey(); final Type type = entry.getValue(); for (final Type bound : getImplicitBounds(typeVar)) { if (!isAssignable(type, substituteTypeVariables(bound, typeVarAssigns), typeVarAssigns)) { return false; } } } return true; }
final Type[] bounds = getImplicitBounds((TypeVariable<?>) type);
/** * <p>Determines whether or not specified types satisfy the bounds of their * mapped type variables. When a type parameter extends another (such as * {@code <T, S extends T>}), uses another as a type parameter (such as * {@code <T, S extends Comparable>>}), or otherwise depends on * another type variable to be specified, the dependencies must be included * in {@code typeVarAssigns}.</p> * * @param typeVarAssigns specifies the potential types to be assigned to the * type variables, not {@code null}. * @return whether or not the types can be assigned to their respective type * variables. */ public static boolean typesSatisfyVariables(final Map<TypeVariable<?>, Type> typeVarAssigns) { Validate.notNull(typeVarAssigns, "typeVarAssigns is null"); // all types must be assignable to all the bounds of their mapped // type variable. for (final Map.Entry<TypeVariable<?>, Type> entry : typeVarAssigns.entrySet()) { final TypeVariable<?> typeVar = entry.getKey(); final Type type = entry.getValue(); for (final Type bound : getImplicitBounds(typeVar)) { if (!isAssignable(type, substituteTypeVariables(bound, typeVarAssigns), typeVarAssigns)) { return false; } } } return true; }
/** * <p>Determines whether or not specified types satisfy the bounds of their * mapped type variables. When a type parameter extends another (such as * {@code <T, S extends T>}), uses another as a type parameter (such as * {@code <T, S extends Comparable>>}), or otherwise depends on * another type variable to be specified, the dependencies must be included * in {@code typeVarAssigns}.</p> * * @param typeVarAssigns specifies the potential types to be assigned to the * type variables, not {@code null}. * @return whether or not the types can be assigned to their respective type * variables. */ public static boolean typesSatisfyVariables(final Map<TypeVariable<?>, Type> typeVarAssigns) { Validate.notNull(typeVarAssigns, "typeVarAssigns is null"); // all types must be assignable to all the bounds of their mapped // type variable. for (final Map.Entry<TypeVariable<?>, Type> entry : typeVarAssigns.entrySet()) { final TypeVariable<?> typeVar = entry.getKey(); final Type type = entry.getValue(); for (final Type bound : getImplicitBounds(typeVar)) { if (!isAssignable(type, substituteTypeVariables(bound, typeVarAssigns), typeVarAssigns)) { return false; } } } return true; }
for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) { if (isAssignable(bound, toGenericArrayType)) { return true;
for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) { if (isAssignable(bound, toGenericArrayType)) { return true;
for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) { if (isAssignable(bound, toGenericArrayType)) { return true;
for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) {
for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) {
for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) {
Type type = typeMap.get(var); if (type == null) { types.add(new WildcardTypeImpl(TypeUtils.getImplicitBounds(var), new Type[] {})); } else {