Lines 386-393
Link Here
|
386 |
if (use15specifics) { |
386 |
if (use15specifics) { |
387 |
checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); |
387 |
checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); |
388 |
// ensure there is no collision between both interfaces: i.e. I1 extends List<String>, I2 extends List<Object> |
388 |
// ensure there is no collision between both interfaces: i.e. I1 extends List<String>, I2 extends List<Object> |
389 |
if (interfaceType.hasIncompatibleSuperType((ReferenceBinding)castType)) |
389 |
if (scope.compilerOptions().complianceLevel < ClassFileConstants.JDK1_7) { |
|
|
390 |
if (interfaceType.hasIncompatibleSuperType((ReferenceBinding) castType)) { |
391 |
return false; |
392 |
} |
393 |
} else if (!castType.isRawType() && interfaceType.hasIncompatibleSuperType((ReferenceBinding) castType)) { |
390 |
return false; |
394 |
return false; |
|
|
395 |
} |
391 |
} else { |
396 |
} else { |
392 |
// pre1.5 semantics - no covariance allowed (even if 1.5 compliant, but 1.4 source) |
397 |
// pre1.5 semantics - no covariance allowed (even if 1.5 compliant, but 1.4 source) |
393 |
// look at original methods rather than the parameterized variants at 1.4 to detect |
398 |
// look at original methods rather than the parameterized variants at 1.4 to detect |
Lines 427-433
Link Here
|
427 |
if (use15specifics) { |
432 |
if (use15specifics) { |
428 |
checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); |
433 |
checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); |
429 |
// ensure there is no collision between both interfaces: i.e. I1 extends List<String>, I2 extends List<Object> |
434 |
// ensure there is no collision between both interfaces: i.e. I1 extends List<String>, I2 extends List<Object> |
430 |
if (((ReferenceBinding)castType).hasIncompatibleSuperType((ReferenceBinding) expressionType)) { |
435 |
if (scope.compilerOptions().complianceLevel < ClassFileConstants.JDK1_7) { |
|
|
436 |
if (((ReferenceBinding)castType).hasIncompatibleSuperType((ReferenceBinding) expressionType)) { |
437 |
return false; |
438 |
} |
439 |
} else if (!castType.isRawType() && ((ReferenceBinding)castType).hasIncompatibleSuperType((ReferenceBinding) expressionType)) { |
431 |
return false; |
440 |
return false; |
432 |
} |
441 |
} |
433 |
} |
442 |
} |
Lines 474-481
Link Here
|
474 |
if (use15specifics) { |
483 |
if (use15specifics) { |
475 |
checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); |
484 |
checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); |
476 |
// ensure there is no collision between both interfaces: i.e. I1 extends List<String>, I2 extends List<Object> |
485 |
// ensure there is no collision between both interfaces: i.e. I1 extends List<String>, I2 extends List<Object> |
477 |
if (refExprType.hasIncompatibleSuperType((ReferenceBinding) castType)) |
486 |
if (scope.compilerOptions().complianceLevel < ClassFileConstants.JDK1_7) { |
|
|
487 |
if (refExprType.hasIncompatibleSuperType((ReferenceBinding) castType)) { |
488 |
return false; |
489 |
} |
490 |
} else if (!castType.isRawType() && refExprType.hasIncompatibleSuperType((ReferenceBinding) castType)) { |
478 |
return false; |
491 |
return false; |
|
|
492 |
} |
479 |
} |
493 |
} |
480 |
return true; |
494 |
return true; |
481 |
} else { |
495 |
} else { |