View | Details | Raw Unified | Return to bug 334493 | Differences between
and this patch

Collapse All | Expand All

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

Return to bug 334493