Object match = _internal2Java.maps(intType, extType);
if (match != null) {
currConstrDistance += ((JavaType)match).distance;
}
else if (intType instanceof ObjectType) {
ObjectType objectType = (ObjectType)intType;
if (objectType.getJavaClass() == extType)
continue;
else if (extType.isAssignableFrom(objectType.getJavaClass()))
currConstrDistance += 1;
else {
currConstrDistance = Integer.MAX_VALUE;
break;
}
}
else {
// no mapping available
currConstrDistance = Integer.MAX_VALUE;
break;
}
}
if (j == nArgs && currConstrDistance < bestConstrDistance ) {
_chosenConstructor = constructor;
_isExtConstructor = true;
bestConstrDistance = currConstrDistance;
if (_clazz != null)
_type = new ObjectType(_clazz);
else
_type = new ObjectType(_className);
}
}
if (_type != null) {
return _type;