public IType getActualTypeInContainer(IFeatureInfo container, IType type) { IType ownerType = container.getOwnersType(); if (ownerType.isParameterizedType()) { TypeVarToTypeMap actualParamByVarName = TypeLord.mapTypeByVarName(ownerType, ownerType); if (container instanceof IGenericMethodInfo) { for (IGenericTypeVariable tv : ((IGenericMethodInfo) container).getTypeVariables()) { if (actualParamByVarName.isEmpty()) { actualParamByVarName = new TypeVarToTypeMap(); } actualParamByVarName.put( tv.getTypeVariableDefinition().getType(), tv.getTypeVariableDefinition().getType()); } type = TypeLord.getActualType(type, actualParamByVarName, true); } } return type; }
@Override public IType getActualType(TypeVarToTypeMap typeMap, boolean bKeepTypeVars) { IType typeFromMap = typeMap.getByMatcher(this, JavaClassTypeVarMatcher.instance()); if (typeFromMap != null && !(typeFromMap instanceof ErrorType)) { if (typeFromMap.getName().equals(getName())) { IType boundingType = ((ITypeVariableType) typeFromMap).getBoundingType(); IType boundingTypeFromMap = TypeLord.getActualType(boundingType, typeMap, bKeepTypeVars); if (boundingType != boundingTypeFromMap) { TypeVariableDefinitionImpl tvd = ((TypeVariableDefinitionImpl) ((ITypeVariableType) typeFromMap).getTypeVarDef()) .clone(boundingTypeFromMap); typeFromMap = new TypeVariableType( tvd, ((ITypeVariableType) typeFromMap).getTypeVarDef().getEnclosingType() instanceof IFunctionType); ((ITypeVariableType) typeFromMap).getTypeVarDef().setVariance(getVariance()); } } return typeFromMap; } else { return TypeSystem.getErrorType(getName()); } }
@Override public IType getActualType(TypeVarToTypeMap typeMap) { return typeMap.getByMatcher(this, JavaClassTypeVarMatcher.instance()); }