### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java,v retrieving revision 1.133.2.4 diff -u -r1.133.2.4 Expression.java --- compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java 15 Mar 2011 12:06:21 -0000 1.133.2.4 +++ compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java 30 Mar 2011 16:23:08 -0000 @@ -387,8 +387,13 @@ if (use15specifics) { checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); // ensure there is no collision between both interfaces: i.e. I1 extends List, I2 extends List - if (interfaceType.hasIncompatibleSuperType((ReferenceBinding)castType)) + if (scope.compilerOptions().complianceLevel < ClassFileConstants.JDK1_7) { + if (interfaceType.hasIncompatibleSuperType((ReferenceBinding) castType)) { + return false; + } + } else if (!castType.isRawType() && interfaceType.hasIncompatibleSuperType((ReferenceBinding) castType)) { return false; + } } else { // pre1.5 semantics - no covariance allowed (even if 1.5 compliant, but 1.4 source) // look at original methods rather than the parameterized variants at 1.4 to detect @@ -428,7 +433,11 @@ if (use15specifics) { checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); // ensure there is no collision between both interfaces: i.e. I1 extends List, I2 extends List - if (((ReferenceBinding)castType).hasIncompatibleSuperType((ReferenceBinding) expressionType)) { + if (scope.compilerOptions().complianceLevel < ClassFileConstants.JDK1_7) { + if (((ReferenceBinding)castType).hasIncompatibleSuperType((ReferenceBinding) expressionType)) { + return false; + } + } else if (!castType.isRawType() && ((ReferenceBinding)castType).hasIncompatibleSuperType((ReferenceBinding) expressionType)) { return false; } } @@ -475,8 +484,13 @@ if (use15specifics) { checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); // ensure there is no collision between both interfaces: i.e. I1 extends List, I2 extends List - if (refExprType.hasIncompatibleSuperType((ReferenceBinding) castType)) + if (scope.compilerOptions().complianceLevel < ClassFileConstants.JDK1_7) { + if (refExprType.hasIncompatibleSuperType((ReferenceBinding) castType)) { + return false; + } + } else if (!castType.isRawType() && refExprType.hasIncompatibleSuperType((ReferenceBinding) castType)) { return false; + } } return true; } else {