Package org.sonar.java.checks
Class AbstractPrintfChecker
- java.lang.Object
-
- org.sonar.java.ast.visitors.SubscriptionVisitor
-
- org.sonar.plugins.java.api.IssuableSubscriptionVisitor
-
- org.sonar.java.checks.methods.AbstractMethodDetection
-
- org.sonar.java.checks.AbstractPrintfChecker
-
- All Implemented Interfaces:
JavaCheck,JavaFileScanner
- Direct Known Subclasses:
PrintfFailCheck,PrintfMisuseCheck
public abstract class AbstractPrintfChecker extends AbstractMethodDetection
-
-
Field Summary
Fields Modifier and Type Field Description protected static MethodMatcherJAVA_UTIL_LOGGERprotected static List<String>LEVELSprotected static MethodMatcherMESSAGE_FORMATprotected static PatternMESSAGE_FORMAT_PATTERN-
Fields inherited from class org.sonar.java.ast.visitors.SubscriptionVisitor
context
-
-
Constructor Summary
Constructors Constructor Description AbstractPrintfChecker()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static Set<Integer>argIndexes(List<String> params)protected static StringcleanupDoubleQuote(String formatString)protected static voidcleanupLineSeparator(List<String> params)protected static IntegergetIndex(String param)protected static Set<Integer>getMessageFormatIndexes(String formatString, MethodInvocationTree mit)protected List<MethodMatcher>getMethodInvocationMatchers()protected List<String>getParameters(String formatString, MethodInvocationTree mit)protected abstract voidhandleMessageFormat(MethodInvocationTree mit, String formatString, List<ExpressionTree> args)protected abstract voidhandlePrintfFormat(MethodInvocationTree mit, String formatString, List<ExpressionTree> args)protected static booleanisNewArrayWithInitializers(ExpressionTree expression)protected voidreportMissingPrevious(MethodInvocationTree mit)-
Methods inherited from class org.sonar.java.checks.methods.AbstractMethodDetection
nodesToVisit, onConstructorFound, onMethodInvocationFound, onMethodReferenceFound, visitNode
-
Methods inherited from class org.sonar.plugins.java.api.IssuableSubscriptionVisitor
addIssue, addIssueOnFile, reportIssue, reportIssue, reportIssue, scanTree
-
Methods inherited from class org.sonar.java.ast.visitors.SubscriptionVisitor
hasSemantic, leaveFile, leaveNode, scanFile, setContext, visitToken, visitTrivia
-
-
-
-
Field Detail
-
MESSAGE_FORMAT
protected static final MethodMatcher MESSAGE_FORMAT
-
JAVA_UTIL_LOGGER
protected static final MethodMatcher JAVA_UTIL_LOGGER
-
MESSAGE_FORMAT_PATTERN
protected static final Pattern MESSAGE_FORMAT_PATTERN
-
-
Method Detail
-
getMethodInvocationMatchers
protected List<MethodMatcher> getMethodInvocationMatchers()
- Specified by:
getMethodInvocationMatchersin classAbstractMethodDetection
-
handlePrintfFormat
protected abstract void handlePrintfFormat(MethodInvocationTree mit, String formatString, List<ExpressionTree> args)
-
handleMessageFormat
protected abstract void handleMessageFormat(MethodInvocationTree mit, String formatString, List<ExpressionTree> args)
-
isNewArrayWithInitializers
protected static boolean isNewArrayWithInitializers(ExpressionTree expression)
-
getMessageFormatIndexes
protected static Set<Integer> getMessageFormatIndexes(String formatString, MethodInvocationTree mit)
-
getParameters
protected List<String> getParameters(String formatString, MethodInvocationTree mit)
-
reportMissingPrevious
protected void reportMissingPrevious(MethodInvocationTree mit)
-
-