diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/SuggestedFixRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/SuggestedFixRules.java index 3ce33426148..801417ee5a8 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/SuggestedFixRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/SuggestedFixRules.java @@ -11,6 +11,19 @@ final class SuggestedFixRules { private SuggestedFixRules() {} + /** Prefer {@link SuggestedFix#delete(Tree)} over more contrived alternatives. */ + static final class SuggestedFixDelete { + @BeforeTemplate + SuggestedFix before(Tree tree) { + return SuggestedFix.builder().delete(tree).build(); + } + + @AfterTemplate + SuggestedFix after(Tree tree) { + return SuggestedFix.delete(tree); + } + } + /** Prefer {@link SuggestedFix#replace(Tree, String)}} over more contrived alternatives. */ static final class SuggestedFixReplaceTree { @BeforeTemplate @@ -90,17 +103,4 @@ SuggestedFix after(Tree tree, String postfix) { return SuggestedFix.postfixWith(tree, postfix); } } - - /** Prefer {@link SuggestedFix#delete(Tree)} over more contrived alternatives. */ - static final class SuggestedFixDelete { - @BeforeTemplate - SuggestedFix before(Tree tree) { - return SuggestedFix.builder().delete(tree).build(); - } - - @AfterTemplate - SuggestedFix after(Tree tree) { - return SuggestedFix.delete(tree); - } - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestInput.java index 9cda7968092..5641bb0c2ed 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestInput.java @@ -5,6 +5,10 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase; final class SuggestFixRulesTest implements RefasterRuleCollectionTestCase { + SuggestedFix testSuggestedFixDelete() { + return SuggestedFix.builder().delete(null).build(); + } + SuggestedFix testSuggestedFixReplaceTree() { return SuggestedFix.builder().replace(null, "foo").build(); } @@ -28,8 +32,4 @@ SuggestedFix testSuggestedFixPrefixWith() { SuggestedFix testSuggestedFixPostfixWith() { return SuggestedFix.builder().postfixWith(null, "foo").build(); } - - SuggestedFix testSuggestedFixDelete() { - return SuggestedFix.builder().delete((Tree) null).build(); - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java index 32cadb3b9ab..e49929b52ec 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java @@ -6,6 +6,10 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase; final class SuggestFixRulesTest implements RefasterRuleCollectionTestCase { + SuggestedFix testSuggestedFixDelete() { + return SuggestedFix.delete(null); + } + SuggestedFix testSuggestedFixReplaceTree() { return Suggestions.replace(null, "foo"); } @@ -29,8 +33,4 @@ SuggestedFix testSuggestedFixPrefixWith() { SuggestedFix testSuggestedFixPostfixWith() { return Suggestions.postfixWith(null, "foo"); } - - SuggestedFix testSuggestedFixDelete() { - return SuggestedFix.delete((Tree) null); - } }