1526 * of origin. |
1526 * of origin. |
1527 * |
1527 * |
1528 * It is assumed that both symbols have the same name. The static |
1528 * It is assumed that both symbols have the same name. The static |
1529 * modifier is ignored for this test. |
1529 * modifier is ignored for this test. |
1530 * |
1530 * |
|
1531 * A quirk in the works is that if the receiver is a method symbol for |
|
1532 * an inherited abstract method we answer false summarily all else being |
|
1533 * immaterial. Abstract "own" methods (i.e `this' is a direct member of |
|
1534 * origin) don't get rejected as summarily and are put to test against the |
|
1535 * suitable criteria. |
|
1536 * |
1531 * See JLS 8.4.6.1 (without transitivity) and 8.4.6.4 |
1537 * See JLS 8.4.6.1 (without transitivity) and 8.4.6.4 |
1532 */ |
1538 */ |
1533 public boolean overrides(Symbol _other, TypeSymbol origin, Types types, boolean checkResult) { |
1539 public boolean overrides(Symbol _other, TypeSymbol origin, Types types, boolean checkResult) { |
|
1540 return overrides(_other, origin, types, checkResult, true); |
|
1541 } |
|
1542 |
|
1543 /** Does this symbol override `other' symbol, when both are seen as |
|
1544 * members of class `origin'? It is assumed that _other is a member |
|
1545 * of origin. |
|
1546 * |
|
1547 * Caveat: If `this' is an abstract inherited member of origin, it is |
|
1548 * deemed to override `other' only when `requireConcreteIfInherited' |
|
1549 * is false. |
|
1550 * |
|
1551 * It is assumed that both symbols have the same name. The static |
|
1552 * modifier is ignored for this test. |
|
1553 * |
|
1554 * See JLS 8.4.6.1 (without transitivity) and 8.4.6.4 |
|
1555 */ |
|
1556 public boolean overrides(Symbol _other, TypeSymbol origin, Types types, boolean checkResult, |
|
1557 boolean requireConcreteIfInherited) { |
1534 if (isConstructor() || _other.kind != MTH) return false; |
1558 if (isConstructor() || _other.kind != MTH) return false; |
1535 |
1559 |
1536 if (this == _other) return true; |
1560 if (this == _other) return true; |
1537 MethodSymbol other = (MethodSymbol)_other; |
1561 MethodSymbol other = (MethodSymbol)_other; |
1538 |
1562 |
1548 return true; |
1572 return true; |
1549 } |
1573 } |
1550 } |
1574 } |
1551 |
1575 |
1552 // check for an inherited implementation |
1576 // check for an inherited implementation |
1553 if ((flags() & ABSTRACT) != 0 || |
1577 if (((flags() & ABSTRACT) != 0 && requireConcreteIfInherited) || |
1554 ((other.flags() & ABSTRACT) == 0 && (other.flags() & DEFAULT) == 0) || |
1578 ((other.flags() & ABSTRACT) == 0 && (other.flags() & DEFAULT) == 0) || |
1555 !other.isOverridableIn(origin) || |
1579 !other.isOverridableIn(origin) || |
1556 !this.isMemberOf(origin, types)) |
1580 !this.isMemberOf(origin, types)) |
1557 return false; |
1581 return false; |
1558 |
1582 |