### 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.2 diff -u -r1.133.2.2 Expression.java --- compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java 1 Mar 2011 17:29:59 -0000 1.133.2.2 +++ compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java 6 Mar 2011 19:54:40 -0000 @@ -386,8 +386,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 @@ -427,7 +432,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; } } @@ -474,8 +483,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 {