Uses of Class
com.google.errorprone.fixes.SuggestedFix.Builder
Package
Description
Checks added to the java compiler which detect common bug patterns.
Support code for providing automated corrections for defects we find.
-
Uses of SuggestedFix.Builder in com.google.errorprone.bugpatterns
Modifier and TypeClassDescriptionstatic class
Replaces the operators when visiting the binary nodesModifier and TypeMethodDescriptionstatic String
SameNameButDifferent.qualifyType
(VisitorState state, SuggestedFix.Builder fix, com.sun.tools.javac.code.Symbol sym) Try to qualify the type, or return the full name.ShortCircuitBoolean.TreeScannerBinary.visitBinary
(com.sun.source.tree.BinaryTree tree, SuggestedFix.Builder p) -
Uses of SuggestedFix.Builder in com.google.errorprone.fixes
Modifier and TypeMethodDescriptionAdd an import statement as part of this SuggestedFix.SuggestedFix.Builder.addStaticImport
(String importString) Add a static import statement as part of this SuggestedFix.static SuggestedFix.Builder
SuggestedFixes.addValuesToAnnotationArgument
(com.sun.source.tree.AnnotationTree annotation, String parameterName, Collection<String> newValues, VisitorState state) Returns a fix that appendsnewValues
to theparameterName
argument forannotation
, regardless of whether there is already an argument.static SuggestedFix.Builder
SuggestedFix.builder()
SuggestedFix.Builder.delete
(com.sun.source.tree.Tree node) SuggestedFix.Builder.merge
(@Nullable SuggestedFix other) Merges all edits fromother
intothis
.SuggestedFix.Builder.merge
(@Nullable SuggestedFix.Builder other) Merges all edits fromother
intothis
.SuggestedFix.Builder.postfixWith
(com.sun.source.tree.Tree node, String postfix) SuggestedFix.Builder.prefixWith
(com.sun.source.tree.Tree node, String prefix) SuggestedFix.Builder.removeImport
(String importString) Remove an import statement as part of this SuggestedFix.SuggestedFix.Builder.removeStaticImport
(String importString) Remove a static import statement as part of this SuggestedFix.Replace the characters from startPos, inclusive, until endPos, exclusive, with the given string.SuggestedFix.Builder.replace
(com.sun.source.tree.Tree node, String replaceWith, int startPosAdjustment, int endPosAdjustment) Replace a tree node with a string, but adjust the start and end positions as well.SuggestedFix.Builder.setCoalescePolicy
(Replacements.CoalescePolicy coalescePolicy) SuggestedFix.Builder.setShortDescription
(String shortDescription) Sets a custom short description for this fix.SuggestedFix.Builder.swap
(com.sun.source.tree.Tree node1, com.sun.source.tree.Tree node2) SuggestedFix.toBuilder()
static SuggestedFix.Builder
SuggestedFixes.updateAnnotationArgumentValues
(com.sun.source.tree.AnnotationTree annotation, VisitorState state, String parameterName, Collection<String> newValues) Returns a fix that updatesnewValues
to theparameterName
argument forannotation
, regardless of whether there is already an argument.static SuggestedFix.Builder
SuggestedFixes.updateAnnotationArgumentValues
(com.sun.source.tree.AnnotationTree annotation, String parameterName, Collection<String> newValues) Deprecated.Modifier and TypeMethodDescriptionstatic void
SuggestedFixes.addSuppressWarnings
(SuggestedFix.Builder fixBuilder, VisitorState state, String warningToSuppress) ModifiesfixBuilder
to either create a new@SuppressWarnings
element on the closest suppressible node, or addwarningToSuppress
to that node if there's already aSuppressWarnings
annotation there.static void
SuggestedFixes.addSuppressWarnings
(SuggestedFix.Builder fixBuilder, VisitorState state, String warningToSuppress, @Nullable String lineComment) ModifiesfixBuilder
to either create a new@SuppressWarnings
element on the closest suppressible node, or addwarningToSuppress
to that node if there's already aSuppressWarnings
annotation there.static void
SuggestedFixes.addSuppressWarnings
(SuggestedFix.Builder fixBuilder, VisitorState state, String warningToSuppress, @Nullable String lineComment, boolean commentOnNewLine) ModifiesfixBuilder
to either create a new@SuppressWarnings
element on the closest suppressible node, or addwarningToSuppress
to that node if there's already aSuppressWarnings
annotation there.SuggestedFix.Builder.merge
(@Nullable SuggestedFix.Builder other) Merges all edits fromother
intothis
.static String
SuggestedFixes.prettyType
(@Nullable VisitorState state, @Nullable SuggestedFix.Builder existingFix, com.sun.tools.javac.code.Type type) Pretty-prints a Type for use in fixes, qualifying any enclosed type names usingSuggestedFixes.qualifyType(com.google.errorprone.VisitorState, com.google.errorprone.fixes.SuggestedFix.Builder, com.sun.tools.javac.code.Symbol)
}.static void
SuggestedFixes.qualifyDocReference
(SuggestedFix.Builder fix, com.sun.source.util.DocTreePath docPath, VisitorState state) Fully qualifies a javadoc reference, e.g.static String
SuggestedFixes.qualifyStaticImport
(String qualifiedName, SuggestedFix.Builder fix, VisitorState state) Provides a name to use for the (fully qualified) method provided inqualifiedName
, trying to static import it if possible.static String
SuggestedFixes.qualifyType
(VisitorState state, SuggestedFix.Builder fix, com.sun.tools.javac.code.Symbol sym) Returns a human-friendly name of the givenSymbol
for use in fixes.static String
SuggestedFixes.qualifyType
(VisitorState state, SuggestedFix.Builder fix, String typeName) Returns a human-friendly name of the giventypeName
for use in fixes.static String
SuggestedFixes.qualifyType
(VisitorState state, SuggestedFix.Builder fix, TypeMirror type) Returns a human-friendly name of the given type for use in fixes.static void
SuggestedFixes.removeSuppressWarnings
(SuggestedFix.Builder fixBuilder, VisitorState state, String warningToRemove) ModifiesfixBuilder
to either remove awarningToRemove
warning from the closestSuppressWarning
node or remove the entireSuppressWarning
node ifwarningToRemove
is the only warning in that node.static void
SuggestedFixes.replaceDocTree
(SuggestedFix.Builder fix, com.sun.source.util.DocTreePath docPath, String replacement) Replaces the leaf doctree in the given path withreplacement
. -
Uses of SuggestedFix.Builder in com.google.errorprone.refaster
Modifier and TypeMethodDescriptionprotected static Fix
Template.addImports
(Inliner inliner, SuggestedFix.Builder fix)
SuggestedFixes.updateAnnotationArgumentValues(AnnotationTree, VisitorState, String, Collection)
instead