void () { String source = """ class A { Runnable r = System.out::println; Runnable s = this::hashCode; Runnable t = this::new; Runnable u = @AA A::new; static { System.out.println(); } }"""; String pattern1 = "System . out :: println"; assertEquals("should find method reference", 1, findMatchesCount(source, pattern1)); String pattern2 = "this::'_a"; assertEquals("should find method reference 2", 2, findMatchesCount(source, pattern2)); String pattern3 = "'_a::'_b"; assertEquals("should find all method references", 4, findMatchesCount(source, pattern3)); String pattern4 = "@AA A::new"; assertEquals("should find annotated method references", 1, findMatchesCount(source, pattern4)); String pattern5 = "'_X:[exprtype( Runnable )]"; assertEquals("should find Runnable method references", 4, findMatchesCount(source, pattern5)); }