@Test void inner_classes() throws Exception { MethodMatchers anyArg = MethodMatcherFactory.methodMatchers("org.sonar.test.Outer$Inner#foo"); MethodVisitor visitor = new MethodVisitor(); visitor.add(anyArg); scanWithVisitor(visitor, TestUtils.inputFile("src/test/files/matcher/InnerClass.java")); assertThat(visitor.count(anyArg)).isEqualTo(1); }
public static MethodMatchers methodMatchers(String descriptor) { Matcher matcher = METHOD_PATTERN.matcher(descriptor); if (!matcher.find()) { throw new IllegalArgumentException("Illegal method specification: " + descriptor); } MethodMatchers.ParametersBuilder methodMatcher = MethodMatchers.create().ofTypes(matcher.group(1)).names(matcher.group(2)); return collectArguments(descriptor, matcher, 3, methodMatcher); }
MethodMatcherFactory { public static MethodMatchers methodMatchers(String descriptor) { Matcher matcher = METHOD_PATTERN.matcher(descriptor); if (!matcher.find()) { throw new IllegalArgumentException("Illegal method specification: " + descriptor); } MethodMatchers.ParametersBuilder methodMatcher = MethodMatchers.create().ofTypes(matcher.group(1)).names(matcher.group(2)); return collectArguments(descriptor, matcher, 3, methodMatcher); } }
MethodMatcherFactory { public static MethodMatchers methodMatchers(String descriptor) { Matcher matcher = METHOD_PATTERN.matcher(descriptor); if (!matcher.find()) { throw new IllegalArgumentException("Illegal method specification: " + descriptor); } MethodMatchers.ParametersBuilder methodMatcher = MethodMatchers.create().ofTypes(matcher.group(1)).names(matcher.group(2)); return collectArguments(descriptor, matcher, 3, methodMatcher); } private  MethodMatcherFactory(); }
MethodMatcherFactory { public static MethodMatchers methodMatchers(String descriptor) { Matcher matcher = METHOD_PATTERN.matcher(descriptor); if (!matcher.find()) { throw new IllegalArgumentException("Illegal method specification: " + descriptor); } MethodMatchers.ParametersBuilder methodMatcher = MethodMatchers.create().ofTypes(matcher.group(1)).names(matcher.group(2)); return collectArguments(descriptor, matcher, 3, methodMatcher); } private  MethodMatcherFactory(); static MethodMatchers constructorMatcher(String descriptor); static MethodMatchers methodMatchers(String descriptor); static MethodMatchers collectArguments(String descriptor, Matcher initialMatcher, int groupOffset, MethodMatchers.ParametersBuilder methodMatcher); }
MethodMatcherFactory { public static MethodMatchers methodMatchers(String descriptor) { Matcher matcher = METHOD_PATTERN.matcher(descriptor); if (!matcher.find()) { throw new IllegalArgumentException("Illegal method specification: " + descriptor); } MethodMatchers.ParametersBuilder methodMatcher = MethodMatchers.create().ofTypes(matcher.group(1)).names(matcher.group(2)); return collectArguments(descriptor, matcher, 3, methodMatcher); } private  MethodMatcherFactory(); static MethodMatchers constructorMatcher(String descriptor); static MethodMatchers methodMatchers(String descriptor); static MethodMatchers collectArguments(String descriptor, Matcher initialMatcher, int groupOffset, MethodMatchers.ParametersBuilder methodMatcher);  }