}
else if (actualClass.isAssignableFrom(declaringClass))
{
Class<?> directSubclass = getDirectSubclass(declaringClass, actualClass);
Type[] typeArguments = resolveTypeArguments(directSubclass, actualType);
Type directSubtype = new OwbParametrizedTypeImpl(directSubclass.getDeclaringClass(), directSubclass, typeArguments);
return resolveTypeVariable(variable, directSubtype);
}
else // if (declaringClass.isAssignableFrom(actualClass))
{
Type genericSuperclass = getGenericSuperclass(actualClass, declaringClass);
if (genericSuperclass == null)
{
return variable;
}
else if (genericSuperclass instanceof Class)
{
// special handling for type erasure
Class<?> superclass = (Class<?>)genericSuperclass;
genericSuperclass = new OwbParametrizedTypeImpl(superclass.getDeclaringClass(), superclass, getRawTypes(superclass.getTypeParameters()));
}
else
{
ParameterizedType genericSupertype = getParameterizedType(genericSuperclass);
Type[] typeArguments = resolveTypeArguments(getParameterizedType(actualType), genericSupertype);
genericSuperclass = new OwbParametrizedTypeImpl(genericSupertype.getOwnerType(), genericSupertype.getRawType(), typeArguments);
}
Type resolvedType = resolveTypeVariable(variable, genericSuperclass);
if (resolvedType instanceof TypeVariable)
{
TypeVariable<?> resolvedTypeVariable = (TypeVariable<?>)resolvedType;