Class AbstractRegexCheckTrackingMatchers

    • Constructor Detail

      • AbstractRegexCheckTrackingMatchers

        public AbstractRegexCheckTrackingMatchers()
    • Method Detail

      • trackedMethodMatchers

        protected abstract MethodMatchers trackedMethodMatchers()
        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.
      • checkRegex

        protected abstract void checkRegex​(org.sonarsource.analyzer.commons.regex.RegexParseResult regexForLiterals,
                                           ExpressionTree methodInvocationOrAnnotation,
                                           List<MethodInvocationTree> trackedMethodsCalled,
                                           boolean didEscape)
        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.
      • checkRegex

        public void checkRegex​(org.sonarsource.analyzer.commons.regex.RegexParseResult regexForLiterals,
                               ExpressionTree methodInvocationOrAnnotation)
        Specified by:
        checkRegex in class AbstractRegexCheck