Class SuggestedFix
java.lang.Object
com.google.errorprone.fixes.SuggestedFix
- All Implemented Interfaces:
Fix
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SuggestedFix.Builderbuilder()static SuggestedFixstatic SuggestedFixemptyFix()Creates an emptySuggestedFix.abstract com.google.common.collect.ImmutableSet<String> abstract com.google.common.collect.ImmutableSet<String> com.google.common.collect.ImmutableSet<Replacement> getReplacements(com.sun.tools.javac.tree.EndPosTable endPositions) abstract StringA short description which can be attached to the Fix to differentiate multiple fixes provided to the user.abstract inthashCode()booleanisEmpty()static SuggestedFixmerge(SuggestedFix first, SuggestedFix second, SuggestedFix... more) static Collector<SuggestedFix, ?, SuggestedFix> static SuggestedFixpostfixWith(Tree node, String postfix) static SuggestedFixprefixWith(Tree node, String prefix) static SuggestedFixReplace the characters from startPos, inclusive, until endPos, exclusive, with the given string.static SuggestedFixstatic SuggestedFixReplace a tree node with a string, but adjust the start and end positions as well.static SuggestedFixswap(Tree node1, Tree node2, VisitorState state) toString(com.sun.tools.javac.tree.JCTree.JCCompilationUnit compilationUnit) Methods inherited from class Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Fix
getCoalescePolicy
-
Constructor Details
-
SuggestedFix
public SuggestedFix()
-
-
Method Details
-
isEmpty
-
getImportsToAdd
- Specified by:
getImportsToAddin interfaceFix
-
getImportsToRemove
- Specified by:
getImportsToRemovein interfaceFix
-
toString
-
getShortDescription
Description copied from interface:FixA short description which can be attached to the Fix to differentiate multiple fixes provided to the user.Empty string generates the default description.
- Specified by:
getShortDescriptionin interfaceFix
-
hashCode
-
getReplacements
public com.google.common.collect.ImmutableSet<Replacement> getReplacements(com.sun.tools.javac.tree.EndPosTable endPositions) - Specified by:
getReplacementsin interfaceFix
-
replace
-
replace
Replace the characters from startPos, inclusive, until endPos, exclusive, with the given string.- Parameters:
startPos- The position from which to start replacing, inclusiveendPos- The position at which to end replacing, exclusivereplaceWith- The string to replace with
-
replace
public static SuggestedFix replace(Tree node, String replaceWith, int startPosAdjustment, int endPosAdjustment) Replace a tree node with a string, but adjust the start and end positions as well. For example, if the tree node begins at index 10 and ends at index 30, this call will replace the characters at index 15 through 25 with "replacement":fix.replace(node, "replacement", 5, -5)- Parameters:
node- The tree node to replacereplaceWith- The string to replace withstartPosAdjustment- The adjustment to add to the start position (negative is OK)endPosAdjustment- The adjustment to add to the end position (negative is OK)
-
prefixWith
-
postfixWith
-
delete
-
swap
-
emptyFix
Creates an emptySuggestedFix. -
merge
-
mergeFixes
-
builder
-
toBuilder
-