use of org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TypeVariable in project che by eclipse.
the class InferTypeArgumentsTCModel method makeFixedSupertypeElementVariables.
private void makeFixedSupertypeElementVariables(ConstraintVariable2 expressionCv, TType supertype) {
if (supertype.isParameterizedType() || supertype.isRawType()) {
TType[] typeArguments = null;
if (supertype.isParameterizedType())
typeArguments = ((ParameterizedType) supertype).getTypeArguments();
TypeVariable[] typeParameters = ((GenericType) supertype.getTypeDeclaration()).getTypeParameters();
for (int i = 0; i < typeParameters.length; i++) {
TypeVariable typeParameter = typeParameters[i];
TType referenceTypeArgument;
if (typeArguments == null) {
// do not consider
continue;
} else {
referenceTypeArgument = typeArguments[i];
}
if (referenceTypeArgument.isTypeVariable()) {
CollectionElementVariable2 referenceTypeArgumentCv = getElementVariable(expressionCv, (TypeVariable) referenceTypeArgument);
setElementVariable(expressionCv, referenceTypeArgumentCv, typeParameter);
} else {
CollectionElementVariable2 elementCv = makeElementVariable(expressionCv, typeParameter, CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX);
createEqualsConstraint(elementCv, makeImmutableTypeVariable(referenceTypeArgument));
}
}
}
makeFixedElementVariablesFromSupertypes(expressionCv, supertype);
}
Aggregations