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((Tree) null).build();
+ return SuggestedFix.delete((Tree) null);
}SuggestedFixReplace2
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SuggestedFixReplace2")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$SuggestedFixReplace2).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
SuggestedFix testSuggestedFixReplace2() {
- return SuggestedFix.builder().replace((Tree) null, "foo").build();
+ return SuggestedFix.replace((Tree) null, "foo");
}SuggestedFixReplace3
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SuggestedFixReplace3")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$SuggestedFixReplace3).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
SuggestedFix testSuggestedFixReplace3() {
- return SuggestedFix.builder().replace(1, 2, "foo").build();
+ return SuggestedFix.replace(1, 2, "foo");
}SuggestedFixReplace4
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SuggestedFixReplace4")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!SuggestedFixRules\$SuggestedFixReplace4).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
SuggestedFix testSuggestedFixReplace4() {
- 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((Tree) null, "foo").build();
+ return SuggestedFix.prefixWith((Tree) 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((Tree) null, "foo").build();
+ return SuggestedFix.postfixWith((Tree) null, "foo");
}