Package org.sonar.plugins.java.api
Class IssuableSubscriptionVisitor
java.lang.Object
org.sonar.java.ast.visitors.SubscriptionVisitor
org.sonar.plugins.java.api.IssuableSubscriptionVisitor
- All Implemented Interfaces:
JavaCheck,JavaFileScanner
Subscription visitor providing an API to report issues.
-
Field Summary
Fields inherited from class org.sonar.java.ast.visitors.SubscriptionVisitor
context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReport an issue on a specific line.voidaddIssueOnFile(String message) Report an issue at file level.voidreportIssue(Tree tree, String message) Report an issue.voidreportIssue(Tree tree, String message, List<JavaFileScannerContext.Location> flow, Integer cost) Report an issue.voidreportIssue(Tree startTree, Tree endTree, String message) Report an issue.protected voidMethods inherited from class org.sonar.java.ast.visitors.SubscriptionVisitor
leaveFile, leaveNode, nodesToVisit, scanFile, setContext, visitNode, visitToken, visitTriviaMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.sonar.plugins.java.api.JavaFileScanner
scanWithoutParsing
-
Constructor Details
-
IssuableSubscriptionVisitor
public IssuableSubscriptionVisitor()
-
-
Method Details
-
scanTree
- Overrides:
scanTreein classSubscriptionVisitor
-
addIssue
Report an issue on a specific line.- Parameters:
line- line on which to report the issuemessage- Message to display to the user
-
addIssueOnFile
Report an issue at file level.- Parameters:
message- Message to display to the user
-
reportIssue
Report an issue.- Parameters:
tree- syntax node on which to raise the issue.message- Message to display to the user.
-
reportIssue
public void reportIssue(Tree tree, String message, List<JavaFileScannerContext.Location> flow, @Nullable Integer cost) Report an issue.- Parameters:
tree- syntax node on which to raise the issue.message- Message to display to the user.flow- List ofJavaFileScannerContext.Locationto display secondary locations describing the flow leading to the issue. Empty list if the issue does not requires secondary location.cost- computed remediation cost if applicable, null if not.
-
reportIssue
Report an issue.- Parameters:
startTree- syntax node on which to start the highlighting of the issue.endTree- syntax node on which to end the highlighting of the issue.message- Message to display to the user.
-