BugCheckerRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!BugCheckerRules\$).*
as compiler argument.
Table of contents
BugCheckerRefactoringTestHelperIdentity
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("BugCheckerRefactoringTestHelperIdentity")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!BugCheckerRules\$BugCheckerRefactoringTestHelperIdentity).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<BugCheckerRefactoringTestHelper> testBugCheckerRefactoringTestHelperIdentity() {
return ImmutableSet.of(
- BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass())
- .setFixChooser(FixChoosers.FIRST),
- BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass())
- .setImportOrder("static-first"));
+ BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass()),
+ BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass()));
}
BugCheckerRefactoringTestHelperAddInputLinesExpectUnchanged
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("BugCheckerRefactoringTestHelperAddInputLinesExpectUnchanged")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!BugCheckerRules\$BugCheckerRefactoringTestHelperAddInputLinesExpectUnchanged).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
BugCheckerRefactoringTestHelper
testBugCheckerRefactoringTestHelperAddInputLinesExpectUnchanged() {
return BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass())
.addInputLines("A.java", "class A {}")
- .addOutputLines("A.java", "class A {}");
+ .expectUnchanged();
}
ConstantsFormat
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ConstantsFormat")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!BugCheckerRules\$ConstantsFormat).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<String> testConstantsFormat() {
- return ImmutableSet.of(Constants.format("foo"), String.format("\"%s\"", Convert.quote("bar")));
+ return ImmutableSet.of(
+ SourceCode.toStringConstantExpression("foo", /* REPLACEME */ null),
+ SourceCode.toStringConstantExpression("bar", /* REPLACEME */ null));
}
NameContentEquals
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("NameContentEquals")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!BugCheckerRules\$NameContentEquals).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Boolean> testNameContentEquals() {
return ImmutableSet.of(
- ((Name) null).toString().equals("foo".subSequence(0, 1).toString()),
- ((com.sun.tools.javac.util.Name) null).toString().equals("bar"));
+ ((Name) null).contentEquals("foo".subSequence(0, 1)),
+ ((com.sun.tools.javac.util.Name) null).contentEquals("bar"));
}