SuggestedFixRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$).*as compiler argument.
Table of contents
SuggestedFixToBuilder
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SuggestedFixToBuilder")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$SuggestedFixToBuilder).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
SuggestedFix.Builder testSuggestedFixToBuilder() {
- return SuggestedFix.builder().merge(SuggestedFix.emptyFix());
+ return SuggestedFix.emptyFix().toBuilder();
}SuggestedFixDelete
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SuggestedFixDelete")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$SuggestedFixDelete).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
SuggestedFix testSuggestedFixDelete() {
- return SuggestedFix.builder().delete(null).build();
+ return SuggestedFix.delete(null);
}SuggestedFixReplaceTree
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SuggestedFixReplaceTree")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$SuggestedFixReplaceTree).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
SuggestedFix testSuggestedFixReplaceTree() {
- return SuggestedFix.builder().replace(null, "foo").build();
+ return SuggestedFix.replace(null, "foo");
}SuggestedFixReplaceStartEnd
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SuggestedFixReplaceStartEnd")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$SuggestedFixReplaceStartEnd).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
SuggestedFix testSuggestedFixReplaceStartEnd() {
- return SuggestedFix.builder().replace(1, 2, "foo").build();
+ return SuggestedFix.replace(1, 2, "foo");
}SuggestedFixReplaceTreeStartEnd
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SuggestedFixReplaceTreeStartEnd")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$SuggestedFixReplaceTreeStartEnd).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
SuggestedFix testSuggestedFixReplaceTreeStartEnd() {
- return SuggestedFix.builder().replace(null, "foo", 1, 2).build();
+ return SuggestedFix.replace(null, "foo", 1, 2);
}SuggestedFixSwap
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SuggestedFixSwap")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$SuggestedFixSwap).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
SuggestedFix testSuggestedFixSwap() {
- return SuggestedFix.builder()
- .swap((Tree) null, (ExpressionTree) null, (VisitorState) null)
- .build();
+ return SuggestedFix.swap((Tree) null, (ExpressionTree) null, (VisitorState) null);
}SuggestedFixPrefixWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SuggestedFixPrefixWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$SuggestedFixPrefixWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
SuggestedFix testSuggestedFixPrefixWith() {
- return SuggestedFix.builder().prefixWith(null, "foo").build();
+ return SuggestedFix.prefixWith(null, "foo");
}SuggestedFixPostfixWith
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SuggestedFixPostfixWith")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$SuggestedFixPostfixWith).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
SuggestedFix testSuggestedFixPostfixWith() {
- return SuggestedFix.builder().postfixWith(null, "foo").build();
+ return SuggestedFix.postfixWith(null, "foo");
}