Map<JTypeParameter, JClassType> constraints = new HashMap<JTypeParameter, JClassType>();
JClassType subWithWildcardsReplaced = replaceWildcardsWithFreshTypeVariables(
subType, constraints);
// Rewrite subType so that it has the same base type as superType.
JParameterizedType subAsParameterized = subWithWildcardsReplaced.asParameterizationOf(superAsParameterized.getBaseType());
if (subAsParameterized == null) {
// The subtype's base does not inherit from the supertype's base,
// so again no constraint will be possible.
return subType;
}