2096 * @param sym The method symbol to be checked. |
2096 * @param sym The method symbol to be checked. |
2097 */ |
2097 */ |
2098 void checkOverrideClashes(DiagnosticPosition pos, Type site, MethodSymbol sym) { |
2098 void checkOverrideClashes(DiagnosticPosition pos, Type site, MethodSymbol sym) { |
2099 ClashFilter cf = new ClashFilter(site); |
2099 ClashFilter cf = new ClashFilter(site); |
2100 //for each method m1 that is a member of 'site'... |
2100 //for each method m1 that is a member of 'site'... |
2101 for (Symbol s1 : types.membersClosure(site).getElementsByName(sym.name, cf)) { |
2101 for (Symbol s1 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) { |
2102 //...find another method m2 that is overridden (directly or indirectly) |
2102 //...find another method m2 that is overridden (directly or indirectly) |
2103 //by method 'sym' in 'site' |
2103 //by method 'sym' in 'site' |
2104 for (Symbol s2 : types.membersClosure(site).getElementsByName(sym.name, cf)) { |
2104 for (Symbol s2 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) { |
2105 if (s1 == s2 || !sym.overrides(s2, site.tsym, types, false)) continue; |
2105 if (s1 == s2 || !sym.overrides(s2, site.tsym, types, false)) continue; |
2106 //if (i) the signature of 'sym' is not a subsignature of m1 (seen as |
2106 //if (i) the signature of 'sym' is not a subsignature of m1 (seen as |
2107 //a member of 'site') and (ii) m1 has the same erasure as m2, issue an error |
2107 //a member of 'site') and (ii) m1 has the same erasure as m2, issue an error |
2108 if (!types.isSubSignature(sym.type, types.memberType(site, s1), false) && |
2108 if (!types.isSubSignature(sym.type, types.memberType(site, s1), false) && |
2109 types.hasSameArgs(s1.erasure(types), s2.erasure(types))) { |
2109 types.hasSameArgs(s1.erasure(types), s2.erasure(types))) { |
2132 * @param sym The method symbol to be checked. |
2132 * @param sym The method symbol to be checked. |
2133 */ |
2133 */ |
2134 void checkHideClashes(DiagnosticPosition pos, Type site, MethodSymbol sym) { |
2134 void checkHideClashes(DiagnosticPosition pos, Type site, MethodSymbol sym) { |
2135 ClashFilter cf = new ClashFilter(site); |
2135 ClashFilter cf = new ClashFilter(site); |
2136 //for each method m1 that is a member of 'site'... |
2136 //for each method m1 that is a member of 'site'... |
2137 for (Symbol s : types.membersClosure(site).getElementsByName(sym.name, cf)) { |
2137 for (Symbol s : types.membersClosure(site, true).getElementsByName(sym.name, cf)) { |
2138 //if (i) the signature of 'sym' is not a subsignature of m1 (seen as |
2138 //if (i) the signature of 'sym' is not a subsignature of m1 (seen as |
2139 //a member of 'site') and (ii) 'sym' has the same erasure as m1, issue an error |
2139 //a member of 'site') and (ii) 'sym' has the same erasure as m1, issue an error |
2140 if (!types.isSubSignature(sym.type, types.memberType(site, s), false) && |
2140 if (!types.isSubSignature(sym.type, types.memberType(site, s), false) && |
2141 types.hasSameArgs(s.erasure(types), sym.erasure(types))) { |
2141 types.hasSameArgs(s.erasure(types), sym.erasure(types))) { |
2142 log.error(pos, |
2142 log.error(pos, |