public class NotMethodDefiningType { public static void main(String[] args) { new Bottom().m(); new Bottom().m(""); new Top().m(9); new Mid().m(""); } } class Top { void m(int i){} void m() {} } class Mid extends Top { void m(String s) {} } class Bottom extends Mid { void m() {} void m(String s) {} } /* * test cases * ---- positive, declared in super, so issue message * - first super * - third super * - super's above declarer without method * ---- negative, no false messages * - supers have different parameters * - no warning if pointcut used in declare warning|error? */ /** @testcase PR#41952 warning test for notMethodDefiningType */ aspect A { // warn here before() : call(void Bottom.m()) { } before() : call(void Bottom.m(String)) { } // sigh. get warning here, too declare warning: call(void Bottom.m()) : "avoid warning on pointcut here?"; // no warnings on wildcarded parms or types or empty types before() : call(void m()) { } before() : call(void *.m()) { } before() : call(void Bottom.m(*)) { } before() : call(void Bottom.m(int,..)) { } before() : call(void Bottom.m(.., int)) { } before() : call(void Bottom.m(..)) { } } /* test definition, assuming this file is in the bugs directory. */