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:
org.sonar.plugins.java.api.JavaCheck,org.sonar.plugins.java.api.JavaFileScanner
- Direct Known Subclasses:
PrintfFailCheck,PrintfMisuseCheck
public abstract class AbstractPrintfChecker extends AbstractMethodDetection
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.sonar.java.matcher.MethodMatcherJAVA_UTIL_LOGGERprotected static List<String>LEVELSprotected static org.sonar.java.matcher.MethodMatcherMESSAGE_FORMATprotected static PatternMESSAGE_FORMAT_PATTERN
-
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, org.sonar.plugins.java.api.tree.MethodInvocationTree mit)protected List<org.sonar.java.matcher.MethodMatcher>getMethodInvocationMatchers()protected List<String>getParameters(String formatString, org.sonar.plugins.java.api.tree.MethodInvocationTree mit)protected abstract voidhandleMessageFormat(org.sonar.plugins.java.api.tree.MethodInvocationTree mit, String formatString, List<org.sonar.plugins.java.api.tree.ExpressionTree> args)protected abstract voidhandlePrintfFormat(org.sonar.plugins.java.api.tree.MethodInvocationTree mit, String formatString, List<org.sonar.plugins.java.api.tree.ExpressionTree> args)protected static booleanisNewArrayWithInitializers(org.sonar.plugins.java.api.tree.ExpressionTree expression)protected voidreportMissingPrevious(org.sonar.plugins.java.api.tree.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
-
-
-
-
Field Detail
-
MESSAGE_FORMAT
protected static final org.sonar.java.matcher.MethodMatcher MESSAGE_FORMAT
-
JAVA_UTIL_LOGGER
protected static final org.sonar.java.matcher.MethodMatcher JAVA_UTIL_LOGGER
-
MESSAGE_FORMAT_PATTERN
protected static final Pattern MESSAGE_FORMAT_PATTERN
-
-
Method Detail
-
getMethodInvocationMatchers
protected List<org.sonar.java.matcher.MethodMatcher> getMethodInvocationMatchers()
- Specified by:
getMethodInvocationMatchersin classAbstractMethodDetection
-
handlePrintfFormat
protected abstract void handlePrintfFormat(org.sonar.plugins.java.api.tree.MethodInvocationTree mit, String formatString, List<org.sonar.plugins.java.api.tree.ExpressionTree> args)
-
handleMessageFormat
protected abstract void handleMessageFormat(org.sonar.plugins.java.api.tree.MethodInvocationTree mit, String formatString, List<org.sonar.plugins.java.api.tree.ExpressionTree> args)
-
isNewArrayWithInitializers
protected static boolean isNewArrayWithInitializers(org.sonar.plugins.java.api.tree.ExpressionTree expression)
-
getMessageFormatIndexes
protected static Set<Integer> getMessageFormatIndexes(String formatString, org.sonar.plugins.java.api.tree.MethodInvocationTree mit)
-
getParameters
protected List<String> getParameters(String formatString, org.sonar.plugins.java.api.tree.MethodInvocationTree mit)
-
reportMissingPrevious
protected void reportMissingPrevious(org.sonar.plugins.java.api.tree.MethodInvocationTree mit)
-
-