void () { String s1 = """ class X {{ class A {} class B extends A { static void foo(); } class B2 extends A { static void foo(int a); } class B3 extends A { static void foo(int a, int b); } class C { static void foo(); } B.foo(); B2.foo(1); B3.foo(2,3); C.foo(); }}"""; assertEquals("Find static methods within expr type hierarchy", 3, findMatchesCount(s1, "'_Instance:[regex( *A )].'_Method:[regex( foo )] ( '_Params* )")); String s2 = """ import static java.lang.String.valueOf; class A { void x() { valueOf(1); } } class B { void x() { valueOf(1); } void valueOf(int i) {} }"""; assertEquals("matching implicit class qualifier within hierarchy", 1, findMatchesCount(s2, "'_Q?:*Object .'_m:valueOf ('_a)")); }