if (type.getRawType() instanceof Class) {
Type[] actualTypeArguments = type.getActualTypeArguments();
TypeVariable[] typeVariables = ((Class) type.getRawType()).getTypeParameters();
for (int i = 0; i < actualTypeArguments.length; i++) {
Type actualTypeArgument = actualTypeArguments[i];
TypeVariable variable = typeVariables[i];
if (actualTypeArgument instanceof Class) {
typeVariableMap.put(variable, actualTypeArgument);
}
else if (actualTypeArgument instanceof GenericArrayType) {
typeVariableMap.put(variable, actualTypeArgument);
}
else if (actualTypeArgument instanceof ParameterizedType) {
typeVariableMap.put(variable, ((ParameterizedType) actualTypeArgument).getRawType());
}
else if (actualTypeArgument instanceof TypeVariable) {
// We have a type that is parameterized at instantiation time
// the nearest match on the bridge method will be the bounded type.
TypeVariable typeVariableArgument = (TypeVariable) actualTypeArgument;
Type resolvedType = (Type) typeVariableMap.get(typeVariableArgument);
if (resolvedType == null) {
resolvedType = extractClassForTypeVariable(typeVariableArgument);
}
if (resolvedType != null) {