Class UnusedGroupNamesCheck

All Implemented Interfaces:
RegexCheck, JavaCheck, JavaFileScanner

public class UnusedGroupNamesCheck extends AbstractRegexCheckTrackingMatchers
  • Constructor Details

    • UnusedGroupNamesCheck

      public UnusedGroupNamesCheck()
  • Method Details

    • trackedMethodMatchers

      protected MethodMatchers trackedMethodMatchers()
      Description copied from class: AbstractRegexCheckTrackingMatchers
      The methods for which we want to know whether they're invoked on the given regex. These should either be methods of the Pattern or Matcher class or part of REGEX_METHODS.
      Specified by:
      trackedMethodMatchers in class AbstractRegexCheckTrackingMatchers
    • checkRegex

      protected void checkRegex(org.sonarsource.analyzer.commons.regex.RegexParseResult regexForLiterals, ExpressionTree methodInvocationOrAnnotation, List<MethodInvocationTree> trackedMethodsCalled, boolean didEscape)
      Specified by:
      checkRegex in class AbstractRegexCheckTrackingMatchers
      Parameters:
      regexForLiterals - The regex to be checked
      methodInvocationOrAnnotation - The method invocation or annotation that the regex string is passed to
      trackedMethodsCalled - The list of method invocations performed on the Pattern or Matcher object associated with the regex (only taking into account methods returned by trackedMethodMatchers)
      didEscape - Whether or not the regex escaped the method in which it was created (via return, being assigned to a non-local variable or being passed to a different method). If true, trackedMethodsCalled may not be exhaustive.