Class QuickFixHelper
java.lang.Object
org.sonar.java.checks.helpers.QuickFixHelper
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddParenthesisIfRequired(JavaQuickFix.Builder quickFixBuilder, ExpressionTree expression) static StringcontentForRange(SyntaxToken firstToken, SyntaxToken lastToken, JavaFileScannerContext context) static StringcontentForTree(Tree tree, JavaFileScannerContext context) static StringcontentOfTreeTokens(Tree tree, JavaFileScannerContext context) internalContext(JavaFileScannerContext context) newImportSupplier(JavaFileScannerContext context) Check if a given type "requiredType" is available in the current "context".static InternalJavaIssueBuildernewIssue(JavaFileScannerContext context) static SyntaxTokenstatic Optional<VariableTree> nextVariable(VariableTree variable) Returns the following variable in a mutli-variable declaration.static SyntaxTokenpreviousToken(Tree tree) static Optional<VariableTree> previousVariable(VariableTree current) Returns the preceding variable in a mutli-variable declaration.
-
Method Details
-
newIssue
-
internalContext
-
nextToken
-
previousToken
-
previousVariable
Returns the preceding variable in a mutli-variable declaration.- Parameters:
current- The target variable- Returns:
- An Optional with the preceding variable, Optional.empty otherwise.
-
nextVariable
Returns the following variable in a mutli-variable declaration.- Parameters:
variable- The target variable- Returns:
- An Optional with the following variable, Optional.empty otherwise.
-
contentForTree
-
contentForRange
public static String contentForRange(SyntaxToken firstToken, SyntaxToken lastToken, JavaFileScannerContext context) -
contentOfTreeTokens
-
addParenthesisIfRequired
public static void addParenthesisIfRequired(JavaQuickFix.Builder quickFixBuilder, ExpressionTree expression) -
newImportSupplier
Check if a given type "requiredType" is available in the current "context". Imports are cached to not have to recompute order all the time. A new import is required if the given type:- is not in the same package of the current compilation unit
- is not yet imported
- Parameters:
context- The context of analysis
-