public boolean canBeAssignedTo(ConstraintVariable targetVariable) { if (fTypeBinding == null || targetVariable.fTypeBinding == null) return false; return TypeRules.canAssign(fTypeBinding, targetVariable.fTypeBinding); }
/** * Tests if a two primitive types are assign compatible * @param toAssignCode The binding of the type to assign * @param definedTypeCode The type of the object that is assigned * @return boolean Returns true if definedType = typeToAssign is true */ public static boolean canAssignPrimitive(PrimitiveType.Code toAssignCode, PrimitiveType.Code definedTypeCode) { // definedTypeCode = typeCodeToAssign; if (toAssignCode == definedTypeCode) { return true; } if (definedTypeCode == PrimitiveType.BOOLEAN || toAssignCode == PrimitiveType.BOOLEAN) { return false; } if (definedTypeCode == PrimitiveType.CHAR && toAssignCode == PrimitiveType.BYTE) { return false; } return getTypeOrder(definedTypeCode) > getTypeOrder(toAssignCode); }
return isArrayCompatible(castType); // can not cast an arraytype to a non array type (except to Object, Serializable...) return isArrayCompatible(bindingToCast.getElementType()); } else { return isArrayCompatible(castType.getElementType()); return isArrayCompatible(bindingToCast); if (isJavaLangObject(castType)) { return true;
return isArrayCompatible(definedType.getElementType()); } else { return false; return canAssignPrimitive(toAssignCode, definedTypeCode); } else { if (definedType.isPrimitive()) { return isArrayCompatible(definedType); if (isJavaLangObject(definedType)) { return true;
if (someType == null || TypeRules.isJavaLangObject(someType)) { break;
return isArrayCompatible(castType); // can not cast an arraytype to a non array type (except to Object, Serializable...) return isArrayCompatible(bindingToCast.getElementType()); } else { return isArrayCompatible(castType.getElementType()); return isArrayCompatible(bindingToCast); if (isJavaLangObject(castType)) { return true;
if (someType == null || TypeRules.isJavaLangObject(someType)) { break;
return isArrayCompatible(castType); // can not cast an arraytype to a non array type (except to Object, Serializable...) return isArrayCompatible(bindingToCast.getElementType()); } else { return isArrayCompatible(castType.getElementType()); return isArrayCompatible(bindingToCast); if (isJavaLangObject(castType)) { return true;
public boolean canBeAssignedTo(ConstraintVariable targetVariable) { if (fTypeBinding == null || targetVariable.fTypeBinding == null) return false; return TypeRules.canAssign(fTypeBinding, targetVariable.fTypeBinding); }
ITypeBinding typeArgument= typeArguments[j]; typeArgument= Bindings.normalizeForDeclarationUse(typeArgument, ast); if (! TypeRules.isJavaLangObject(typeArgument)) {
public boolean canBeAssignedTo(ConstraintVariable targetVariable) { if (fTypeBinding == null || targetVariable.fTypeBinding == null) return false; return TypeRules.canAssign(fTypeBinding, targetVariable.fTypeBinding); }
ITypeBinding typeArgument= typeArguments[j]; typeArgument= Bindings.normalizeForDeclarationUse(typeArgument, ast); if (! TypeRules.isJavaLangObject(typeArgument)) {
} else if (! TypeRules.canAssign(initializerType, referenceType)) { if (!Bindings.containsTypeVariables(referenceType)) return referenceType;
} else if (! TypeRules.canAssign(initializerType, referenceType)) { if (!Bindings.containsTypeVariables(referenceType)) return referenceType;