Lines 352-369
Link Here
|
352 |
ReferenceBinding interfaceType = (ReferenceBinding) expressionType; |
352 |
ReferenceBinding interfaceType = (ReferenceBinding) expressionType; |
353 |
match = interfaceType.findSuperTypeWithSameErasure(castType); |
353 |
match = interfaceType.findSuperTypeWithSameErasure(castType); |
354 |
if (match != null) { |
354 |
if (match != null) { |
355 |
if (use15specifics) { |
355 |
return checkUnsafeCast(scope, castType, interfaceType, match, false); |
356 |
return checkUnsafeCast(scope, castType, interfaceType, match, false); |
|
|
357 |
} |
358 |
return true; |
359 |
} |
356 |
} |
360 |
tagAsNeedCheckCast(); |
357 |
tagAsNeedCheckCast(); |
361 |
match = castType.findSuperTypeWithSameErasure(interfaceType); |
358 |
match = castType.findSuperTypeWithSameErasure(interfaceType); |
362 |
if (match != null) { |
359 |
if (match != null) { |
363 |
if (use15specifics) { |
360 |
return checkUnsafeCast(scope, castType, interfaceType, match, true); |
364 |
return checkUnsafeCast(scope, castType, interfaceType, match, true); |
|
|
365 |
} |
366 |
return true; |
367 |
} |
361 |
} |
368 |
if (use15specifics) { |
362 |
if (use15specifics) { |
369 |
checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); |
363 |
checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); |
Lines 397-406
Link Here
|
397 |
tagAsNeedCheckCast(); |
391 |
tagAsNeedCheckCast(); |
398 |
match = castType.findSuperTypeWithSameErasure(expressionType); |
392 |
match = castType.findSuperTypeWithSameErasure(expressionType); |
399 |
if (match != null) { |
393 |
if (match != null) { |
400 |
if (use15specifics) { |
394 |
return checkUnsafeCast(scope, castType, expressionType, match, true); |
401 |
return checkUnsafeCast(scope, castType, expressionType, match, true); |
|
|
402 |
} |
403 |
return true; |
404 |
} |
395 |
} |
405 |
if (((ReferenceBinding) castType).isFinal()) { |
396 |
if (((ReferenceBinding) castType).isFinal()) { |
406 |
// no subclass for castType, thus compile-time check is invalid |
397 |
// no subclass for castType, thus compile-time check is invalid |
Lines 442-451
Link Here
|
442 |
ReferenceBinding refExprType = (ReferenceBinding) expressionType; |
433 |
ReferenceBinding refExprType = (ReferenceBinding) expressionType; |
443 |
match = refExprType.findSuperTypeWithSameErasure(castType); |
434 |
match = refExprType.findSuperTypeWithSameErasure(castType); |
444 |
if (match != null) { |
435 |
if (match != null) { |
445 |
if (use15specifics) { |
436 |
return checkUnsafeCast(scope, castType, expressionType, match, false); |
446 |
return checkUnsafeCast(scope, castType, expressionType, match, false); |
|
|
447 |
} |
448 |
return true; |
449 |
} |
437 |
} |
450 |
// unless final a subclass may implement the interface ==> no check at compile time |
438 |
// unless final a subclass may implement the interface ==> no check at compile time |
451 |
if (refExprType.isFinal()) { |
439 |
if (refExprType.isFinal()) { |
Lines 454-463
Link Here
|
454 |
tagAsNeedCheckCast(); |
442 |
tagAsNeedCheckCast(); |
455 |
match = castType.findSuperTypeWithSameErasure(expressionType); |
443 |
match = castType.findSuperTypeWithSameErasure(expressionType); |
456 |
if (match != null) { |
444 |
if (match != null) { |
457 |
if (use15specifics) { |
445 |
return checkUnsafeCast(scope, castType, expressionType, match, true); |
458 |
return checkUnsafeCast(scope, castType, expressionType, match, true); |
|
|
459 |
} |
460 |
return true; |
461 |
} |
446 |
} |
462 |
if (use15specifics) { |
447 |
if (use15specifics) { |
463 |
checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); |
448 |
checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); |
Lines 471-488
Link Here
|
471 |
match = expressionType.findSuperTypeWithSameErasure(castType); |
456 |
match = expressionType.findSuperTypeWithSameErasure(castType); |
472 |
if (match != null) { |
457 |
if (match != null) { |
473 |
if (expression != null && castType.id == T_JavaLangString) this.constant = expression.constant; // (String) cst is still a constant |
458 |
if (expression != null && castType.id == T_JavaLangString) this.constant = expression.constant; // (String) cst is still a constant |
474 |
if (use15specifics) { |
459 |
return checkUnsafeCast(scope, castType, expressionType, match, false); |
475 |
return checkUnsafeCast(scope, castType, expressionType, match, false); |
|
|
476 |
} |
477 |
return true; |
478 |
} |
460 |
} |
479 |
match = castType.findSuperTypeWithSameErasure(expressionType); |
461 |
match = castType.findSuperTypeWithSameErasure(expressionType); |
480 |
if (match != null) { |
462 |
if (match != null) { |
481 |
tagAsNeedCheckCast(); |
463 |
tagAsNeedCheckCast(); |
482 |
if (use15specifics) { |
464 |
return checkUnsafeCast(scope, castType, expressionType, match, true); |
483 |
return checkUnsafeCast(scope, castType, expressionType, match, true); |
|
|
484 |
} |
485 |
return true; |
486 |
} |
465 |
} |
487 |
return false; |
466 |
return false; |
488 |
} |
467 |
} |