use of org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ArrayTypeVariable2 in project che by eclipse.
the class InferTypeArgumentsTCModel method makeArrayTypeVariable.
private ArrayTypeVariable2 makeArrayTypeVariable(ArrayType type) {
ArrayTypeVariable2 cv = new ArrayTypeVariable2(type);
ArrayTypeVariable2 storedCv = (ArrayTypeVariable2) storedCv(cv);
if (cv == storedCv) {
fCuScopedConstraintVariables.add(storedCv);
makeArrayElementVariable(storedCv);
if (fStoreToString)
//$NON-NLS-1$ //$NON-NLS-2$
storedCv.setData(ConstraintVariable2.TO_STRING, "ArrayType(" + type.getPrettySignature() + ")");
}
return storedCv;
}
use of org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ArrayTypeVariable2 in project che by eclipse.
the class InferTypeArgumentsConstraintsSolver method findCastsToRemove.
private void findCastsToRemove(CastVariable2[] castVariables) {
for (int i = 0; i < castVariables.length; i++) {
CastVariable2 castCv = castVariables[i];
ConstraintVariable2 expressionVariable = castCv.getExpressionVariable();
TType chosenType = InferTypeArgumentsConstraintsSolver.getChosenType(expressionVariable);
TType castType = castCv.getType();
TType expressionType = expressionVariable.getType();
if (chosenType != null && TTypes.canAssignTo(chosenType, castType)) {
if (chosenType.equals(expressionType))
// The type has not changed. Don't remove the cast, since it could be
continue;
// there to get access to default-visible members or to
// unify types of conditional expressions.
fUpdate.addCastToRemove(castCv);
} else if (expressionVariable instanceof ArrayTypeVariable2 && castType.isArrayType()) {
// bug 97258
ArrayElementVariable2 arrayElementCv = fTCModel.getArrayElementVariable(expressionVariable);
if (arrayElementCv == null)
continue;
TType chosenArrayElementType = InferTypeArgumentsConstraintsSolver.getChosenType(arrayElementCv);
if (chosenArrayElementType != null && TTypes.canAssignTo(chosenArrayElementType, ((ArrayType) castType).getComponentType())) {
if (expressionType instanceof ArrayType && chosenArrayElementType.equals(((ArrayType) expressionType).getComponentType()))
// The type has not changed. Don't remove the cast, since it could be
continue;
// there to unify types of conditional expressions.
fUpdate.addCastToRemove(castCv);
}
}
}
}
Aggregations