Uses of Class
com.google.errorprone.fixes.SuggestedFix
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 in com.google.errorprone.bugpatterns
Modifier and TypeMethodDescriptionprotected static @Nullable SuggestedFix
SelfEquals.fieldFix
(com.sun.source.tree.Tree toReplace, VisitorState state) -
Uses of SuggestedFix in com.google.errorprone.bugpatterns.threadsafety
Modifier and TypeMethodDescriptiondefault Description
ImmutableAnalysis.ViolationReporter.report
(com.sun.source.tree.Tree tree, ThreadSafety.Violation info, Optional<SuggestedFix> suggestedFix) -
Uses of SuggestedFix in com.google.errorprone.fixes
Modifier and TypeMethodDescriptionstatic SuggestedFix
SuggestedFixes.addMembers
(com.sun.source.tree.ClassTree classTree, VisitorState state, SuggestedFixes.AdditionPosition where, String firstMember, String... otherMembers) Returns aFix
that adds members defined byfirstMember
(and optionallyotherMembers
) to the class referenced byclassTree
.static SuggestedFix
SuggestedFixes.addMembers
(com.sun.source.tree.ClassTree classTree, VisitorState state, String firstMember, String... otherMembers) Returns aFix
that adds members defined byfirstMember
(and optionallyotherMembers
) to the end of the class referenced byclassTree
.static SuggestedFix
SuggestedFixes.addSuppressWarnings
(VisitorState state, String warningToSuppress) Returns a fix that adds a@SuppressWarnings(warningToSuppress)
to the closest suppressible element to the node pointed at bystate.getPath()
.static SuggestedFix
SuggestedFixes.addSuppressWarnings
(VisitorState state, String warningToSuppress, @Nullable String lineComment) Returns a fix that adds a@SuppressWarnings(warningToSuppress)
to the closest suppressible element to the node pointed at bystate.getPath()
, optionally suffixing the suppression with a comment suffix (e.g.SuggestedFix.Builder.build()
static SuggestedFix
SuggestedFix.delete
(com.sun.source.tree.Tree node) static SuggestedFix
SuggestedFix.emptyFix()
Creates an emptySuggestedFix
.static SuggestedFix
SuggestedFix.merge
(SuggestedFix first, SuggestedFix second, SuggestedFix... more) static SuggestedFix
SuggestedFix.postfixWith
(com.sun.source.tree.Tree node, String postfix) static SuggestedFix
SuggestedFix.prefixWith
(com.sun.source.tree.Tree node, String prefix) static SuggestedFix
SuggestedFixes.removeElement
(com.sun.source.tree.Tree tree, List<? extends com.sun.source.tree.Tree> trees, VisitorState state) Removestree
fromtrees
, assuming thattrees
represents a comma-separated list of expressions containingtree
.static SuggestedFix
SuggestedFixes.renameMethod
(com.sun.source.tree.MethodTree tree, String replacement, VisitorState state) Be warned, only changes method name at the declaration.static SuggestedFix
SuggestedFixes.renameMethodInvocation
(com.sun.source.tree.MethodInvocationTree tree, String replacement, VisitorState state) Replaces the name of the method being invoked intree
withreplacement
.static SuggestedFix
SuggestedFixes.renameMethodWithInvocations
(com.sun.source.tree.MethodTree tree, String replacement, VisitorState state) Renames the givenMethodTree
and its usages in the current compilation unit toreplacement
.static SuggestedFix
SuggestedFixes.renameTypeParameter
(com.sun.source.tree.TypeParameterTree typeParameter, com.sun.source.tree.Tree owningTree, String typeVarReplacement, VisitorState state) Renames a type parametertypeParameter
owned byowningTree
totypeVarReplacement
.static SuggestedFix
SuggestedFixes.renameVariable
(com.sun.source.tree.VariableTree tree, String replacement, VisitorState state) Renames the givenVariableTree
and its usages in the current compilation unit toreplacement
.static SuggestedFix
SuggestedFixes.renameVariableUsages
(com.sun.source.tree.VariableTree tree, String replacement, VisitorState state) Renames usage of the givenVariableTree
in the current compilation unit toreplacement
.static SuggestedFix
Replace the characters from startPos, inclusive, until endPos, exclusive, with the given string.static SuggestedFix
static SuggestedFix
SuggestedFix.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.static SuggestedFix
SuggestedFixes.replaceIncludingComments
(com.sun.source.util.TreePath path, String replacement, VisitorState state) Replaces the tree atpath
along with any Javadocs/associated single-line comments.static SuggestedFix
SuggestedFix.swap
(com.sun.source.tree.Tree node1, com.sun.source.tree.Tree node2) Modifier and TypeMethodDescriptionstatic Optional
<SuggestedFix> SuggestedFixes.addMembers
(com.sun.source.tree.ClassTree classTree, VisitorState state, SuggestedFixes.AdditionPosition where, Iterable<String> members) static Optional
<SuggestedFix> SuggestedFixes.addModifiers
(com.sun.source.tree.Tree tree, VisitorState state, Modifier... modifiers) Adds modifiers to the given class, method, or field declaration.static Optional
<SuggestedFix> SuggestedFixes.addModifiers
(com.sun.source.tree.Tree tree, com.sun.source.tree.ModifiersTree originalModifiers, VisitorState state, Set<Modifier> modifiers) Adds modifiers to the given declaration and corresponding modifiers tree.com.google.common.collect.ImmutableList
<SuggestedFix> BranchedSuggestedFixes.getFixes()
static Optional
<SuggestedFix> SuggestedFixes.removeModifiers
(com.sun.source.tree.ModifiersTree originalModifiers, VisitorState state, Set<Modifier> toRemove) Removes modifiers to the given declaration and corresponding modifiers tree.static Optional
<SuggestedFix> SuggestedFixes.removeModifiers
(com.sun.source.tree.Tree tree, VisitorState state, Modifier... modifiers) Removes modifiers from the given class, method, or field declaration.static Optional
<SuggestedFix> SuggestedFixes.suggestExemptingAnnotation
(String exemptingAnnotation, com.sun.source.util.TreePath where, VisitorState state) Create a fix to add a suppression annotation on the surrounding class.Modifier and TypeMethodDescriptionBranchedSuggestedFixes.Builder.addOption
(SuggestedFix fix) SuggestedFix.Builder.merge
(@Nullable SuggestedFix other) Merges all edits fromother
intothis
.static SuggestedFix
SuggestedFix.merge
(SuggestedFix first, SuggestedFix second, SuggestedFix... more) BranchedSuggestedFixes.Builder.startWith
(SuggestedFix fix)