}
}
private void resolveTypeVariable(final MetaType methodParmType, final MetaType callParmType) {
if (methodParmType instanceof MetaTypeVariable) {
final MetaTypeVariable typeVar = (MetaTypeVariable) methodParmType;
final MetaClass resolvedType;
if (callParmType instanceof MetaClass) {
resolvedType = (MetaClass) callParmType;
}
else if (callParmType instanceof MetaWildcardType) {
MetaType[] upperBounds = ((MetaWildcardType) callParmType).getUpperBounds();
if (upperBounds != null && upperBounds.length == 1 && upperBounds[0] instanceof MetaClass) {
resolvedType = (MetaClass) upperBounds[0];
}
else {
// it's either unbounded (? or ? super X) or has fancy bounds like ? extends X & Y
// so we'll fall back on good old java.lang.Object
resolvedType = MetaClassFactory.get(Object.class);
}
}
else {
throw new IllegalArgumentException("Call parameter \"" + callParmType + "\" is of unexpected metatype " + callParmType.getClass());
}
typeVariables.put(typeVar.getName(), resolvedType);
}
else if (methodParmType instanceof MetaParameterizedType) {
final MetaType parameterizedCallParmType;
if (callParmType instanceof MetaParameterizedType) {
parameterizedCallParmType = callParmType;