diff --git a/.github/release.yml b/.github/release.yml
index 11251c5533..bbd41aea52 100644
--- a/.github/release.yml
+++ b/.github/release.yml
@@ -3,7 +3,7 @@ changelog:
labels:
- "ignore-changelog"
categories:
- - title: ":rocket: New Error Prone checks and Refaster templates"
+ - title: ":rocket: New Error Prone checks and Refaster rules"
labels:
- "new feature"
- title: ":sparkles: Improvements"
diff --git a/README.md b/README.md
index 9aed90153b..ccd1ab3029 100644
--- a/README.md
+++ b/README.md
@@ -63,7 +63,7 @@ it:
error-prone-contrib${error-prone-support.version}
-
+
tech.picnic.error-prone-supportrefaster-runner
@@ -122,7 +122,7 @@ $ mvn clean install
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
-[WARNING] Example.java:[9,34] [tech.picnic.errorprone.refastertemplates.BigDecimalTemplates.BigDecimalZero]
+[WARNING] Example.java:[9,34] [tech.picnic.errorprone.refasterrules.BigDecimalRules.BigDecimalZero]
Did you mean 'return BigDecimal.ZERO;'?
[WARNING] Example.java:[13,35] [IdentityConversion] This method invocation appears redundant; remove it or suppress this warning and add a comment explaining its purpose
(see https://error-prone.picnic.tech/bugpatterns/IdentityConversion)
@@ -136,12 +136,12 @@ Two things are kicking in here:
1. An Error Prone [`BugChecker`][error-prone-bugchecker] that flags unnecessary
[identity conversions][bug-checks-identity-conversion].
-2. A [Refaster][refaster] template capable of
- [rewriting][refaster-templates-bigdecimal] expressions of the form
+2. A [Refaster][refaster] rule capable of
+ [rewriting][refaster-rules-bigdecimal] expressions of the form
`BigDecimal.valueOf(0)` and `new BigDecimal(0)` to `BigDecimal.ZERO`.
Be sure to check out all [bug checks][bug-checks] and [refaster
-templates][refaster-templates].
+rules][refaster-rules].
## 👷 Developing Error Prone Support
@@ -227,5 +227,5 @@ guidelines][contributing].
[pitest-maven]: https://pitest.org/quickstart/maven
[pr-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
[refaster]: https://errorprone.info/docs/refaster
-[refaster-templates-bigdecimal]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/BigDecimalTemplates.java
-[refaster-templates]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/
+[refaster-rules-bigdecimal]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/BigDecimalRules.java
+[refaster-rules]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/
diff --git a/error-prone-contrib/README.md b/error-prone-contrib/README.md
index ace42e7da4..77ee5c6f85 100644
--- a/error-prone-contrib/README.md
+++ b/error-prone-contrib/README.md
@@ -267,7 +267,7 @@ Refaster's expressiveness:
motivating example, see the two subtly different loop definitions in
`CollectionRemoveAllFromCollectionExpression`.
- Figure out why Refaster sometimes doesn't match the correct generic overload.
- See the `AssertThatIterableHasOneComparableElementEqualTo` template for an
+ See the `AssertThatIterableHasOneComparableElementEqualTo` rule for an
example.
[autorefactor]: https://autorefactor.org
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java
index 3859e9333d..bce994e816 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java
@@ -24,7 +24,7 @@
/**
* A {@link BugChecker} that flags AssertJ {@code isEqualTo(null)} checks for simplification.
*
- *
This bug checker cannot be replaced with a simple Refaster template, as the Refaster approach
+ *
This bug checker cannot be replaced with a simple Refaster rule, as the Refaster approach
* would require that all overloads of {@link org.assertj.core.api.Assert#isEqualTo(Object)} (such
* as {@link org.assertj.core.api.AbstractStringAssert#isEqualTo(String)}) are explicitly
* enumerated. This bug checker generically matches all such current and future overloads.
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MissingRefasterAnnotation.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MissingRefasterAnnotation.java
index efc8e9c009..74e92d95a2 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MissingRefasterAnnotation.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MissingRefasterAnnotation.java
@@ -25,7 +25,7 @@
/** A {@link BugChecker} that flags likely missing Refaster annotations. */
@AutoService(BugChecker.class)
@BugPattern(
- summary = "The Refaster template contains a method without any Refaster annotations",
+ summary = "The Refaster rule contains a method without any Refaster annotations",
link = BUG_PATTERNS_BASE_URL + "MissingRefasterAnnotation",
linkType = CUSTOM,
severity = WARNING,
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java
index e9e4948674..0e636b02e5 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java
@@ -22,8 +22,8 @@
/**
* A {@link BugChecker} that flags unnecessary {@link Refaster#anyOf(Object[])} usages.
*
- *
Note that this logic can't be implemented as a Refaster template, as the {@link Refaster}
- * class is treated specially.
+ *
Note that this logic can't be implemented as a Refaster rule, as the {@link Refaster} class is
+ * treated specially.
*/
@AutoService(BugChecker.class)
@BugPattern(
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterTemplateModifiers.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterRuleModifiers.java
similarity index 93%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterTemplateModifiers.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterRuleModifiers.java
index 930baee235..fd016da91a 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterTemplateModifiers.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterRuleModifiers.java
@@ -35,11 +35,11 @@
@AutoService(BugChecker.class)
@BugPattern(
summary = "Refaster class and method definitions should specify a canonical set of modifiers",
- link = BUG_PATTERNS_BASE_URL + "RefasterTemplateModifiers",
+ link = BUG_PATTERNS_BASE_URL + "RefasterRuleModifiers",
linkType = CUSTOM,
severity = SUGGESTION,
tags = STYLE)
-public final class RefasterTemplateModifiers extends BugChecker
+public final class RefasterRuleModifiers extends BugChecker
implements ClassTreeMatcher, MethodTreeMatcher {
private static final long serialVersionUID = 1L;
private static final Matcher BEFORE_TEMPLATE_METHOD = hasAnnotation(BeforeTemplate.class);
@@ -85,8 +85,8 @@ private static SuggestedFix suggestCanonicalModifiers(ClassTree tree, VisitorSta
if (!hasMatchingMember(tree, PLACEHOLDER_METHOD, state)) {
/*
- * Templates without a `@Placeholder` method should be `final`. Note that Refaster enforces
- * that `@Placeholder` methods are `abstract`, so templates _with_ such a method will
+ * Rules without a `@Placeholder` method should be `final`. Note that Refaster enforces
+ * that `@Placeholder` methods are `abstract`, so rules _with_ such a method will
* naturally be `abstract` and non-`final`.
*/
modifiersToAdd.add(Modifier.FINAL);
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBigDecimalTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJBigDecimalRules.java
similarity index 82%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBigDecimalTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJBigDecimalRules.java
index aea7797008..272b3ab194 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBigDecimalTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJBigDecimalRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static org.assertj.core.data.Offset.offset;
import static org.assertj.core.data.Percentage.withPercentage;
@@ -11,17 +11,17 @@
import org.assertj.core.api.BigDecimalAssert;
/**
- * Refaster templates related to AssertJ assertions over {@link BigDecimal}s.
+ * Refaster rules related to AssertJ assertions over {@link BigDecimal}s.
*
- *
Note that, contrary to collections of Refaster templates for other {@link
- * org.assertj.core.api.NumberAssert} subtypes, these templates do not rewrite to/from {@link
+ *
Note that, contrary to collections of Refaster rules for other {@link
+ * org.assertj.core.api.NumberAssert} subtypes, these rules do not rewrite to/from {@link
* BigDecimalAssert#isEqualTo(Object)} and {@link BigDecimalAssert#isNotEqualTo(Object)}. This is
* because {@link BigDecimal#equals(Object)} considers not only the numeric value of compared
* instances, but also their scale. As a result various seemingly straightforward transformations
* would actually subtly change the assertion's semantics.
*/
-final class AssertJBigDecimalTemplates {
- private AssertJBigDecimalTemplates() {}
+final class AssertJBigDecimalRules {
+ private AssertJBigDecimalRules() {}
static final class AbstractBigDecimalAssertIsEqualByComparingTo {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBigIntegerTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJBigIntegerRules.java
similarity index 95%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBigIntegerTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJBigIntegerRules.java
index 6394d1cda0..7b3ad736ca 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBigIntegerTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJBigIntegerRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static org.assertj.core.data.Offset.offset;
import static org.assertj.core.data.Percentage.withPercentage;
@@ -11,8 +11,8 @@
// XXX: If we add a rule that drops unnecessary `L` suffixes from literal longs, then the `0L`/`1L`
// cases below can go.
-final class AssertJBigIntegerTemplates {
- private AssertJBigIntegerTemplates() {}
+final class AssertJBigIntegerRules {
+ private AssertJBigIntegerRules() {}
static final class AbstractBigIntegerAssertIsEqualTo {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBooleanTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJBooleanRules.java
similarity index 95%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBooleanTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJBooleanRules.java
index 6f56835c3f..9c28353c63 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBooleanTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJBooleanRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.assertj.core.api.Assertions.assertThat;
@@ -9,8 +9,8 @@
import com.google.errorprone.refaster.annotation.UseImportPolicy;
import org.assertj.core.api.AbstractBooleanAssert;
-final class AssertJBooleanTemplates {
- private AssertJBooleanTemplates() {}
+final class AssertJBooleanRules {
+ private AssertJBooleanRules() {}
static final class AbstractBooleanAssertIsEqualTo {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJByteTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJByteRules.java
similarity index 94%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJByteTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJByteRules.java
index 220e3001e7..1c1134c387 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJByteTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJByteRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static org.assertj.core.data.Offset.offset;
import static org.assertj.core.data.Percentage.withPercentage;
@@ -8,8 +8,8 @@
import com.google.errorprone.refaster.annotation.BeforeTemplate;
import org.assertj.core.api.AbstractByteAssert;
-final class AssertJByteTemplates {
- private AssertJByteTemplates() {}
+final class AssertJByteRules {
+ private AssertJByteRules() {}
static final class AbstractByteAssertIsEqualTo {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJCharSequenceTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJCharSequenceRules.java
similarity index 92%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJCharSequenceTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJCharSequenceRules.java
index f528b7d285..545b7fec08 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJCharSequenceTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJCharSequenceRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.assertj.core.api.Assertions.assertThat;
@@ -9,8 +9,8 @@
import com.google.errorprone.refaster.annotation.UseImportPolicy;
import org.assertj.core.api.AbstractAssert;
-final class AssertJCharSequenceTemplates {
- private AssertJCharSequenceTemplates() {}
+final class AssertJCharSequenceRules {
+ private AssertJCharSequenceRules() {}
static final class AssertThatCharSequenceIsEmpty {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJComparableRules.java
similarity index 95%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJComparableRules.java
index 2d63f665da..ea92d58fb6 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJComparableRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.assertj.core.api.Assertions.assertThat;
@@ -9,8 +9,8 @@
import org.assertj.core.api.AbstractComparableAssert;
import org.assertj.core.api.AbstractIntegerAssert;
-final class AssertJComparableTemplates {
- private AssertJComparableTemplates() {}
+final class AssertJComparableRules {
+ private AssertJComparableRules() {}
static final class AssertThatIsEqualByComparingTo> {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJDoubleTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJDoubleRules.java
similarity index 95%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJDoubleTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJDoubleRules.java
index 44dc57b014..624018ffd9 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJDoubleTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJDoubleRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static org.assertj.core.data.Offset.offset;
import static org.assertj.core.data.Percentage.withPercentage;
@@ -9,8 +9,8 @@
import org.assertj.core.api.AbstractDoubleAssert;
import org.assertj.core.data.Offset;
-final class AssertJDoubleTemplates {
- private AssertJDoubleTemplates() {}
+final class AssertJDoubleRules {
+ private AssertJDoubleRules() {}
static final class AbstractDoubleAssertIsCloseToWithOffset {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJEnumerableTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJEnumerableRules.java
similarity index 93%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJEnumerableTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJEnumerableRules.java
index 7f20919951..a891bfbc06 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJEnumerableTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJEnumerableRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import com.google.common.collect.Iterables;
import com.google.errorprone.refaster.Refaster;
@@ -7,8 +7,8 @@
import java.util.Collection;
import org.assertj.core.api.EnumerableAssert;
-final class AssertJEnumerableTemplates {
- private AssertJEnumerableTemplates() {}
+final class AssertJEnumerableRules {
+ private AssertJEnumerableRules() {}
static final class EnumerableAssertIsEmpty {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJFloatRules.java
similarity index 95%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJFloatRules.java
index 6de54b99cb..8952ca4f2b 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJFloatRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static org.assertj.core.data.Offset.offset;
import static org.assertj.core.data.Percentage.withPercentage;
@@ -9,8 +9,8 @@
import org.assertj.core.api.AbstractFloatAssert;
import org.assertj.core.data.Offset;
-final class AssertJFloatTemplates {
- private AssertJFloatTemplates() {}
+final class AssertJFloatRules {
+ private AssertJFloatRules() {}
static final class AbstractFloatAssertIsCloseToWithOffset {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJIntegerRules.java
similarity index 94%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJIntegerRules.java
index f46ac40564..d134bfe6c8 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJIntegerRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static org.assertj.core.data.Offset.offset;
import static org.assertj.core.data.Percentage.withPercentage;
@@ -8,8 +8,8 @@
import com.google.errorprone.refaster.annotation.BeforeTemplate;
import org.assertj.core.api.AbstractIntegerAssert;
-final class AssertJIntegerTemplates {
- private AssertJIntegerTemplates() {}
+final class AssertJIntegerRules {
+ private AssertJIntegerRules() {}
static final class AbstractIntegerAssertIsEqualTo {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJLongTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJLongRules.java
similarity index 94%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJLongTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJLongRules.java
index e992886dff..3ac9275fc2 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJLongTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJLongRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static org.assertj.core.data.Offset.offset;
import static org.assertj.core.data.Percentage.withPercentage;
@@ -8,8 +8,8 @@
import com.google.errorprone.refaster.annotation.BeforeTemplate;
import org.assertj.core.api.AbstractLongAssert;
-final class AssertJLongTemplates {
- private AssertJLongTemplates() {}
+final class AssertJLongRules {
+ private AssertJLongRules() {}
static final class AbstractLongAssertIsEqualTo {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJMapTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJMapRules.java
similarity index 90%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJMapTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJMapRules.java
index 566caa3265..dfbd303ea3 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJMapTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJMapRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import com.google.common.collect.ImmutableMap;
import com.google.errorprone.refaster.annotation.AfterTemplate;
@@ -6,8 +6,8 @@
import java.util.Map;
import org.assertj.core.api.AbstractMapAssert;
-final class AssertJMapTemplates {
- private AssertJMapTemplates() {}
+final class AssertJMapRules {
+ private AssertJMapRules() {}
static final class AbstractMapAssertContainsExactlyInAnyOrderEntriesOf {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJNumberTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJNumberRules.java
similarity index 98%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJNumberTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJNumberRules.java
index 0c7f08b6aa..fac67d6068 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJNumberTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJNumberRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.assertj.core.api.Assertions.assertThat;
@@ -21,8 +21,8 @@
import org.assertj.core.api.NumberAssert;
import tech.picnic.errorprone.refaster.matchers.IsCharacter;
-final class AssertJNumberTemplates {
- private AssertJNumberTemplates() {}
+final class AssertJNumberRules {
+ private AssertJNumberRules() {}
static final class NumberAssertIsPositive {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJObjectTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJObjectRules.java
similarity index 95%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJObjectTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJObjectRules.java
index 458a4c2c66..b5122b7296 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJObjectTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJObjectRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.assertj.core.api.Assertions.assertThat;
@@ -11,8 +11,8 @@
import org.assertj.core.api.AbstractStringAssert;
import org.assertj.core.api.ObjectAssert;
-final class AssertJObjectTemplates {
- private AssertJObjectTemplates() {}
+final class AssertJObjectRules {
+ private AssertJObjectRules() {}
static final class AssertThatIsInstanceOf {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJOptionalTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJOptionalRules.java
similarity index 97%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJOptionalTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJOptionalRules.java
index 6769749cf5..f14bef43ad 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJOptionalTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJOptionalRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.assertj.core.api.Assertions.assertThat;
@@ -15,8 +15,8 @@
import org.assertj.core.api.ObjectAssert;
import org.assertj.core.api.OptionalAssert;
-final class AssertJOptionalTemplates {
- private AssertJOptionalTemplates() {}
+final class AssertJOptionalRules {
+ private AssertJOptionalRules() {}
static final class AssertThatOptional {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJPrimitiveTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJPrimitiveRules.java
similarity index 96%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJPrimitiveTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJPrimitiveRules.java
index b58a703c71..7635e37037 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJPrimitiveTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJPrimitiveRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.assertj.core.api.Assertions.assertThat;
@@ -10,8 +10,8 @@
import org.assertj.core.api.AbstractBooleanAssert;
import org.assertj.core.api.AbstractDoubleAssert;
-final class AssertJPrimitiveTemplates {
- private AssertJPrimitiveTemplates() {}
+final class AssertJPrimitiveRules {
+ private AssertJPrimitiveRules() {}
static final class AssertThatIsEqualTo {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJRules.java
similarity index 99%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJRules.java
index e941254bb1..4da5ba9c92 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.assertj.core.api.Assertions.assertThat;
@@ -55,7 +55,7 @@
import org.assertj.core.api.OptionalLongAssert;
import tech.picnic.errorprone.refaster.matchers.IsArray;
-/** Refaster templates related to AssertJ expressions and statements. */
+/** Refaster rules related to AssertJ expressions and statements. */
// XXX: Most `AbstractIntegerAssert` rules can also be applied for other primitive types. Generate
// these in separate files.
// XXX: Also do for BigInteger/BigDecimal?
@@ -63,7 +63,7 @@
// ^ And variants.
// XXX: Consider splitting this class into multiple classes.
// XXX: Some of these rules may not apply given the updated TestNG rewrite rules. Review.
-// XXX: For the templates that "unwrap" explicitly enumerated collections, also introduce variants
+// XXX: For the rules that "unwrap" explicitly enumerated collections, also introduce variants
// with explicitly enumerated sorted collections. (Requires that the type bound is Comparable.)
// XXX: Handle `.isEqualTo(explicitlyEnumeratedCollection)`. Can be considered equivalent to
// `.containsOnly(elements)`. (This does mean the auto-generated code needs to be more advanced.
@@ -101,7 +101,7 @@
// (etc.)
// XXX: Look into using Assertions#contentOf(URL url, Charset charset) instead of our own test
// method.
-// XXX: Write Optional templates also for `OptionalInt` and variants.
+// XXX: Write `Optional` rules also for `OptionalInt` and variants.
// XXX: Write plugin to flag `assertThat(compileTimeConstant)` occurrences. Also other likely
// candidates, such as `assertThat(ImmutableSet(foo, bar)).XXX`
// XXX: Write generic plugin to replace explicit array parameters with varargs (`new int[] {1, 2}`
@@ -118,10 +118,10 @@
// XXX: `assertThat(ImmutableList.sortedCopyOf(cmp, values)).somethingExactOrder` -> just compare
// "in any order".
// XXX: Turns out a lot of this is also covered by https://github.com/palantir/assertj-automation.
-// See how we can combine these things. Do note that (at present) their Refaster templates don't
-// show up as Error Prone checks. So we'd have to build an integration for that.
-final class AssertJTemplates {
- private AssertJTemplates() {}
+// See how we can combine these things. Do note that (at present) their Refaster rules don't show up
+// as Error Prone checks. So we'd have to build an integration for that.
+final class AssertJRules {
+ private AssertJRules() {}
//
// OptionalDouble
@@ -491,7 +491,7 @@ IterableAssert after(Iterable iterable, T element) {
}
// XXX: This overload is here because `assertThat` has an overload for `Comparable` types.
- // Unfortunately this still doesn't convince Refaster to match this template in the context of
+ // Unfortunately this still doesn't convince Refaster to match this rule in the context of
// Comparable types. Figure out why! Note that this also affects the `AssertThatOptional` rule.
static final class AssertThatIterableHasOneComparableElementEqualTo<
S extends Comparable super S>, T extends S> {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJShortTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJShortRules.java
similarity index 94%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJShortTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJShortRules.java
index 017f897b93..a09e34ca2b 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJShortTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJShortRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static org.assertj.core.data.Offset.offset;
import static org.assertj.core.data.Percentage.withPercentage;
@@ -8,8 +8,8 @@
import com.google.errorprone.refaster.annotation.BeforeTemplate;
import org.assertj.core.api.AbstractShortAssert;
-final class AssertJShortTemplates {
- private AssertJShortTemplates() {}
+final class AssertJShortRules {
+ private AssertJShortRules() {}
static final class AbstractShortAssertIsEqualTo {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJStringTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJStringRules.java
similarity index 95%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJStringTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJStringRules.java
index c217193bf5..d149d3b1ff 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJStringTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJStringRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.assertj.core.api.Assertions.assertThat;
@@ -9,8 +9,8 @@
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.AbstractStringAssert;
-final class AssertJStringTemplates {
- private AssertJStringTemplates() {}
+final class AssertJStringRules {
+ private AssertJStringRules() {}
static final class AbstractStringAssertStringIsEmpty {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJThrowingCallableTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJThrowingCallableRules.java
similarity index 97%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJThrowingCallableTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJThrowingCallableRules.java
index 14ebac29d5..f221f66425 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJThrowingCallableTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJThrowingCallableRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -18,16 +18,16 @@
import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
/**
- * Refaster templates related to AssertJ assertions over expressions that may throw a {@link
- * Throwable} subtype.
+ * Refaster rules related to AssertJ assertions over expressions that may throw a {@link Throwable}
+ * subtype.
*
*
For reasons of consistency we prefer {@link
* org.assertj.core.api.Assertions#assertThatThrownBy} over static methods for specific exception
* types. Note that only the most common assertion expressions are rewritten here; covering all
* cases would require the implementation of an Error Prone check instead.
*/
-final class AssertJThrowingCallableTemplates {
- private AssertJThrowingCallableTemplates() {}
+final class AssertJThrowingCallableRules {
+ private AssertJThrowingCallableRules() {}
static final class AssertThatThrownByIllegalArgumentException {
@BeforeTemplate
@@ -429,8 +429,8 @@ static final class AssertThatThrownByHasMessageParameters {
}
}
- // XXX: Drop this template in favour of a generic Error Prone check that flags
- // `String.format(...)` arguments to a wide range of format methods.
+ // XXX: Drop this rule in favour of a generic Error Prone check that flags `String.format(...)`
+ // arguments to a wide range of format methods.
static final class AbstractThrowableAssertHasMessage {
@BeforeTemplate
AbstractThrowableAssert, ? extends Throwable> before(
@@ -449,8 +449,8 @@ static final class AbstractThrowableAssertHasMessage {
}
}
- // XXX: Drop this template in favour of a generic Error Prone check that flags
- // `String.format(...)` arguments to a wide range of format methods.
+ // XXX: Drop this rule in favour of a generic Error Prone check that flags `String.format(...)`
+ // arguments to a wide range of format methods.
static final class AbstractThrowableAssertWithFailMessage {
@BeforeTemplate
AbstractThrowableAssert, ? extends Throwable> before(
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssortedTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssortedRules.java
similarity index 94%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssortedTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssortedRules.java
index 62ec075c2a..872f9eced8 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssortedTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssortedRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.common.base.Preconditions.checkElementIndex;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
@@ -30,11 +30,11 @@
import javax.annotation.Nullable;
/**
- * Assorted Refaster templates that do not (yet) belong in one of the other classes with more
- * topical Refaster templates.
+ * Assorted Refaster rules that do not (yet) belong in one of the other classes with more topical
+ * Refaster rules.
*/
-final class AssortedTemplates {
- private AssortedTemplates() {}
+final class AssortedRules {
+ private AssortedRules() {}
/** Prefer {@link Objects#checkIndex(int, int)} over the Guava alternative. */
static final class CheckIndex {
@@ -117,7 +117,7 @@ T after(Iterator iterator, T defaultValue) {
}
/** Don't unnecessarily repeat boolean expressions. */
- // XXX: This template captures only the simplest case. `@AlsoNegation` doesn't help. Consider
+ // XXX: This rule captures only the simplest case. `@AlsoNegation` doesn't help. Consider
// contributing a Refaster patch, which handles the negation in the `@BeforeTemplate` more
// intelligently.
static final class LogicalImplication {
@@ -172,8 +172,8 @@ boolean after(Set set1, Set set2) {
* Collections#disjoint(Collection, Collection)}.
*/
// XXX: Other copy operations could be elided too, but these are most common after application of
- // the `DisjointSets` template defined above. If we ever introduce a generic "makes a copy"
- // stand-in, use it here.
+ // the `DisjointSets` rule defined above. If we ever introduce a generic "makes a copy" stand-in,
+ // use it here.
static final class DisjointCollections {
@BeforeTemplate
boolean before(Collection collection1, Collection collection2) {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/BigDecimalTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/BigDecimalRules.java
similarity index 89%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/BigDecimalTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/BigDecimalRules.java
index e6169e9b46..7f27917660 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/BigDecimalTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/BigDecimalRules.java
@@ -1,13 +1,13 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import com.google.errorprone.refaster.Refaster;
import com.google.errorprone.refaster.annotation.AfterTemplate;
import com.google.errorprone.refaster.annotation.BeforeTemplate;
import java.math.BigDecimal;
-/** Refaster templates related to expressions dealing with {@link BigDecimal}s. */
-final class BigDecimalTemplates {
- private BigDecimalTemplates() {}
+/** Refaster rules related to expressions dealing with {@link BigDecimal}s. */
+final class BigDecimalRules {
+ private BigDecimalRules() {}
/** Prefer using the constant {@link BigDecimal#ZERO} when possible. */
static final class BigDecimalZero {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/CollectionTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/CollectionRules.java
similarity index 98%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/CollectionTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/CollectionRules.java
index 55f8a100a0..e02c12c2a2 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/CollectionTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/CollectionRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
@@ -20,11 +20,11 @@
import java.util.function.IntFunction;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with (arbitrary) collections. */
+/** Refaster rules related to expressions dealing with (arbitrary) collections. */
// XXX: There are other Guava `Iterables` methods that should not be called if the input is known to
// be a `Collection`. Add those here.
-final class CollectionTemplates {
- private CollectionTemplates() {}
+final class CollectionRules {
+ private CollectionRules() {}
/**
* Prefer {@link Collection#isEmpty()} over alternatives that consult the collection's size or are
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ComparatorTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ComparatorRules.java
similarity index 97%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ComparatorTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ComparatorRules.java
index c088b8fa82..3a1e94d32b 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ComparatorTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ComparatorRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static java.util.Comparator.comparing;
@@ -25,9 +25,9 @@
import java.util.function.ToIntFunction;
import java.util.function.ToLongFunction;
-/** Refaster templates related to expressions dealing with {@link Comparator}s. */
-final class ComparatorTemplates {
- private ComparatorTemplates() {}
+/** Refaster rules related to expressions dealing with {@link Comparator}s. */
+final class ComparatorRules {
+ private ComparatorRules() {}
/** Prefer {@link Comparator#naturalOrder()} over more complicated constructs. */
static final class NaturalOrder> {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/DoubleStreamTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/DoubleStreamRules.java
similarity index 97%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/DoubleStreamTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/DoubleStreamRules.java
index 32ab0fbeaa..7e8e007b19 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/DoubleStreamTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/DoubleStreamRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import com.google.common.collect.Streams;
import com.google.errorprone.refaster.Refaster;
@@ -13,9 +13,9 @@
import java.util.stream.DoubleStream;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link DoubleStream}s. */
-final class DoubleStreamTemplates {
- private DoubleStreamTemplates() {}
+/** Refaster rules related to expressions dealing with {@link DoubleStream}s. */
+final class DoubleStreamRules {
+ private DoubleStreamRules() {}
/** Don't unnecessarily call {@link Streams#concat(DoubleStream...)}. */
static final class ConcatOneDoubleStream {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/EqualityTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/EqualityRules.java
similarity index 94%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/EqualityTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/EqualityRules.java
index 3cb561b11a..6aaccd1d4d 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/EqualityTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/EqualityRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import com.google.errorprone.refaster.Refaster;
import com.google.errorprone.refaster.annotation.AfterTemplate;
@@ -7,9 +7,9 @@
import java.util.Objects;
import java.util.function.Predicate;
-/** Refaster templates related to expressions dealing with (in)equalities. */
-final class EqualityTemplates {
- private EqualityTemplates() {}
+/** Refaster rules related to expressions dealing with (in)equalities. */
+final class EqualityRules {
+ private EqualityRules() {}
/** Prefer reference-based quality for enums. */
// Primitive value comparisons are not listed, because Error Prone flags those out of the box.
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListMultimapTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableListMultimapRules.java
similarity index 97%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListMultimapTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableListMultimapRules.java
index e1da7db817..87fc03db95 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListMultimapTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableListMultimapRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.common.collect.ImmutableListMultimap.flatteningToImmutableListMultimap;
import static com.google.common.collect.ImmutableListMultimap.toImmutableListMultimap;
@@ -25,9 +25,9 @@
import java.util.function.Function;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link ImmutableListMultimap}s. */
-final class ImmutableListMultimapTemplates {
- private ImmutableListMultimapTemplates() {}
+/** Refaster rules related to expressions dealing with {@link ImmutableListMultimap}s. */
+final class ImmutableListMultimapRules {
+ private ImmutableListMultimapRules() {}
/**
* Prefer {@link ImmutableListMultimap#builder()} over the associated constructor on constructions
@@ -70,7 +70,7 @@ ImmutableListMultimap after() {
* alternatives.
*/
// XXX: One can define variants for more than one key-value pair, but at some point the builder
- // actually produces nicer code. So it's not clear we should add Refaster templates for those
+ // actually produces nicer code. So it's not clear we should add Refaster rules for those
// variants.
static final class PairToImmutableListMultimap {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableListRules.java
similarity index 96%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableListRules.java
index 082fadf231..de9aca4deb 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableListRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
@@ -21,9 +21,9 @@
import java.util.List;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link ImmutableList}s. */
-final class ImmutableListTemplates {
- private ImmutableListTemplates() {}
+/** Refaster rules related to expressions dealing with {@link ImmutableList}s. */
+final class ImmutableListRules {
+ private ImmutableListRules() {}
/** Prefer {@link ImmutableList#builder()} over the associated constructor. */
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
@@ -154,7 +154,7 @@ ImmutableList after(Stream stream) {
* communicate the immutability of the resulting list at the type level.
*/
// XXX: The `Stream` variant may be too contrived to warrant inclusion. Review its usage if/when
- // this and similar Refaster templates are replaced with an Error Prone check.
+ // this and similar Refaster rules are replaced with an Error Prone check.
static final class ImmutableListOf {
@BeforeTemplate
List before() {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMapTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableMapRules.java
similarity index 98%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMapTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableMapRules.java
index ad9a4e3a70..2d1906983f 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMapTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableMapRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
@@ -22,9 +22,9 @@
import java.util.function.Function;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link ImmutableMap}s. */
-final class ImmutableMapTemplates {
- private ImmutableMapTemplates() {}
+/** Refaster rules related to expressions dealing with {@link ImmutableMap}s. */
+final class ImmutableMapRules {
+ private ImmutableMapRules() {}
/** Prefer {@link ImmutableMap#builder()} over the associated constructor. */
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
@@ -313,7 +313,7 @@ ImmutableMap after(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V
}
}
- // XXX: Add a template for this:
+ // XXX: Add a rule for this:
// Maps.transformValues(streamOfEntries.collect(groupBy(fun)), ImmutableMap::copyOf)
// ->
// streamOfEntries.collect(groupBy(fun, toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)))
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMultisetTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableMultisetRules.java
similarity index 93%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMultisetTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableMultisetRules.java
index d60264965f..07802c7741 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMultisetTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableMultisetRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.common.collect.ImmutableMultiset.toImmutableMultiset;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
@@ -14,9 +14,9 @@
import java.util.Iterator;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link ImmutableMultiset}s. */
-final class ImmutableMultisetTemplates {
- private ImmutableMultisetTemplates() {}
+/** Refaster rules related to expressions dealing with {@link ImmutableMultiset}s. */
+final class ImmutableMultisetRules {
+ private ImmutableMultisetRules() {}
/** Prefer {@link ImmutableMultiset#builder()} over the associated constructor. */
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetMultimapTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSetMultimapRules.java
similarity index 97%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetMultimapTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSetMultimapRules.java
index ed991be8ef..8272c05b57 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetMultimapTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSetMultimapRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.common.collect.ImmutableSetMultimap.flatteningToImmutableSetMultimap;
import static com.google.common.collect.ImmutableSetMultimap.toImmutableSetMultimap;
@@ -22,9 +22,9 @@
import java.util.function.Function;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link ImmutableSetMultimap}s. */
-final class ImmutableSetMultimapTemplates {
- private ImmutableSetMultimapTemplates() {}
+/** Refaster rules related to expressions dealing with {@link ImmutableSetMultimap}s. */
+final class ImmutableSetMultimapRules {
+ private ImmutableSetMultimapRules() {}
/** Prefer {@link ImmutableSetMultimap#builder()} over the associated constructor. */
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
@@ -56,7 +56,7 @@ ImmutableSetMultimap after() {
/** Prefer {@link ImmutableSetMultimap#of(Object, Object)} over more contrived alternatives. */
// XXX: One can define variants for more than one key-value pair, but at some point the builder
- // actually produces nicer code. So it's not clear we should add Refaster templates for those
+ // actually produces nicer code. So it's not clear we should add Refaster rules for those
// variants.
static final class PairToImmutableSetMultimap {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSetRules.java
similarity index 95%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSetRules.java
index b710f4e7a1..b7159b886a 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSetRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
@@ -18,9 +18,9 @@
import java.util.Set;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link ImmutableSet}s. */
-final class ImmutableSetTemplates {
- private ImmutableSetTemplates() {}
+/** Refaster rules related to expressions dealing with {@link ImmutableSet}s. */
+final class ImmutableSetRules {
+ private ImmutableSetRules() {}
/** Prefer {@link ImmutableSet#builder()} over the associated constructor. */
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
@@ -104,7 +104,7 @@ ImmutableSet after(SetView set) {
* communicate the immutability of the resulting set at the type level.
*/
// XXX: The `Stream` variant may be too contrived to warrant inclusion. Review its usage if/when
- // this and similar Refaster templates are replaced with an Error Prone check.
+ // this and similar Refaster rules are replaced with an Error Prone check.
static final class ImmutableSetOf {
@BeforeTemplate
Set before() {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSortedMapTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSortedMapRules.java
similarity index 95%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSortedMapTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSortedMapRules.java
index e5e265d684..ff03163cad 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSortedMapTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSortedMapRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.common.collect.ImmutableSortedMap.toImmutableSortedMap;
import static java.util.Comparator.naturalOrder;
@@ -14,9 +14,9 @@
import java.util.Map;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link ImmutableSortedMap}s. */
-final class ImmutableSortedMapTemplates {
- private ImmutableSortedMapTemplates() {}
+/** Refaster rules related to expressions dealing with {@link ImmutableSortedMap}s. */
+final class ImmutableSortedMapRules {
+ private ImmutableSortedMapRules() {}
/** Prefer {@link ImmutableSortedMap#orderedBy(Comparator)} over the associated constructor. */
static final class ImmutableSortedMapBuilder {
@@ -82,7 +82,7 @@ ImmutableSortedMap after() {
/** Prefer {@link ImmutableSortedMap#of(Object, Object)} over more contrived alternatives. */
// XXX: One can define variants for more than one key-value pair, but at some point the builder
- // actually produces nicer code. So it's not clear we should add Refaster templates for those
+ // actually produces nicer code. So it's not clear we should add Refaster rules for those
// variants.
// XXX: We could also rewrite builders with non-natural orders, but that would affect
// `ImmutableSortedMap#comparator()`.
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSortedMultisetTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSortedMultisetRules.java
similarity index 95%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSortedMultisetTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSortedMultisetRules.java
index 68252ae21d..0e8a252223 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSortedMultisetTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSortedMultisetRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.common.collect.ImmutableSortedMultiset.toImmutableSortedMultiset;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
@@ -16,9 +16,9 @@
import java.util.Iterator;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link ImmutableSortedMultiset}s. */
-final class ImmutableSortedMultisetTemplates {
- private ImmutableSortedMultisetTemplates() {}
+/** Refaster rules related to expressions dealing with {@link ImmutableSortedMultiset}s. */
+final class ImmutableSortedMultisetRules {
+ private ImmutableSortedMultisetRules() {}
/**
* Prefer {@link ImmutableSortedMultiset#orderedBy(Comparator)} over the associated constructor.
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSortedSetTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSortedSetRules.java
similarity index 95%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSortedSetTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSortedSetRules.java
index bac035d3b0..627fdf7c0f 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSortedSetTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableSortedSetRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
@@ -16,9 +16,9 @@
import java.util.Iterator;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link ImmutableSortedSet}s. */
-final class ImmutableSortedSetTemplates {
- private ImmutableSortedSetTemplates() {}
+/** Refaster rules related to expressions dealing with {@link ImmutableSortedSet}s. */
+final class ImmutableSortedSetRules {
+ private ImmutableSortedSetRules() {}
/** Prefer {@link ImmutableSortedSet#orderedBy(Comparator)} over the associated constructor. */
static final class ImmutableSortedSetBuilder {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/IntStreamTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/IntStreamRules.java
similarity index 97%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/IntStreamTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/IntStreamRules.java
index 52d8bb2d66..382f5d332b 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/IntStreamTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/IntStreamRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import com.google.common.collect.Streams;
import com.google.errorprone.refaster.Refaster;
@@ -13,9 +13,9 @@
import java.util.stream.IntStream;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link IntStream}s. */
-final class IntStreamTemplates {
- private IntStreamTemplates() {}
+/** Refaster rules related to expressions dealing with {@link IntStream}s. */
+final class IntStreamRules {
+ private IntStreamRules() {}
/** Prefer {@link IntStream#range(int, int)} over the more contrived alternative. */
static final class IntStreamClosedOpenRange {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/JUnitTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/JUnitRules.java
similarity index 82%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/JUnitTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/JUnitRules.java
index 3386787e95..b2c5942856 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/JUnitTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/JUnitRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.junit.jupiter.params.provider.Arguments.arguments;
@@ -9,9 +9,9 @@
import com.google.errorprone.refaster.annotation.UseImportPolicy;
import org.junit.jupiter.params.provider.Arguments;
-/** Refaster templates related to JUnit expressions and statements. */
-final class JUnitTemplates {
- private JUnitTemplates() {}
+/** Refaster rules related to JUnit expressions and statements. */
+final class JUnitRules {
+ private JUnitRules() {}
/** Prefer statically imported {@link Arguments#arguments} over {@link Arguments#of} calls. */
static final class ArgumentsEnumeration {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/LongStreamTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/LongStreamRules.java
similarity index 97%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/LongStreamTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/LongStreamRules.java
index 2cefe257f3..45b4c0da30 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/LongStreamTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/LongStreamRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import com.google.common.collect.Streams;
import com.google.errorprone.refaster.Refaster;
@@ -13,9 +13,9 @@
import java.util.stream.LongStream;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link LongStream}s. */
-final class LongStreamTemplates {
- private LongStreamTemplates() {}
+/** Refaster rules related to expressions dealing with {@link LongStream}s. */
+final class LongStreamRules {
+ private LongStreamRules() {}
/** Prefer {@link LongStream#range(long, long)} over the more contrived alternative. */
static final class LongStreamClosedOpenRange {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/MapEntryTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MapEntryRules.java
similarity index 94%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/MapEntryTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MapEntryRules.java
index d01d621563..27d3af80c3 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/MapEntryTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MapEntryRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static java.util.Comparator.comparing;
@@ -15,9 +15,9 @@
import java.util.Comparator;
import java.util.Map;
-/** Refaster templates related to expressions dealing with {@link Map.Entry} instances. */
-final class MapEntryTemplates {
- private MapEntryTemplates() {}
+/** Refaster rules related to expressions dealing with {@link Map.Entry} instances. */
+final class MapEntryRules {
+ private MapEntryRules() {}
/**
* Prefer {@link Map#entry(Object, Object)} over alternative ways to create an immutable map
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/MockitoTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MockitoRules.java
similarity index 87%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/MockitoTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MockitoRules.java
index 3b67c27046..b17af9b514 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/MockitoTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MockitoRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static org.mockito.Mockito.never;
@@ -11,9 +11,9 @@
import org.mockito.Mockito;
import org.mockito.verification.VerificationMode;
-/** Refaster templates related to Mockito expressions and statements. */
-final class MockitoTemplates {
- private MockitoTemplates() {}
+/** Refaster rules related to Mockito expressions and statements. */
+final class MockitoRules {
+ private MockitoRules() {}
/**
* Prefer {@link Mockito#never()}} over explicitly specifying that the associated invocation must
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/MultimapTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MultimapRules.java
similarity index 89%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/MultimapTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MultimapRules.java
index 9e0f45e31a..ff64ad784c 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/MultimapTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MultimapRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
@@ -9,9 +9,9 @@
import java.util.Set;
import javax.annotation.Nullable;
-/** Refaster templates related to expressions dealing with {@link Multimap}s. */
-final class MultimapTemplates {
- private MultimapTemplates() {}
+/** Refaster rules related to expressions dealing with {@link Multimap}s. */
+final class MultimapRules {
+ private MultimapRules() {}
/** Prefer {@link Multimap#keySet()} over more contrived alternatives. */
static final class MultimapKeySet {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/NullTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/NullRules.java
similarity index 92%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/NullTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/NullRules.java
index d5b8c22d23..770843886c 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/NullTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/NullRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static java.util.Objects.requireNonNullElse;
@@ -11,9 +11,9 @@
import java.util.function.Predicate;
import javax.annotation.Nullable;
-/** Refaster templates related to expressions dealing with (possibly) null values. */
-final class NullTemplates {
- private NullTemplates() {}
+/** Refaster rules related to expressions dealing with (possibly) null values. */
+final class NullRules {
+ private NullRules() {}
/** Prefer the {@code ==} operator over {@link Objects#isNull(Object)}. */
static final class IsNull {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/OptionalTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/OptionalRules.java
similarity index 97%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/OptionalTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/OptionalRules.java
index 113159d98c..7c990060a5 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/OptionalTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/OptionalRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
@@ -18,9 +18,9 @@
import java.util.stream.Stream;
import javax.annotation.Nullable;
-/** Refaster templates related to expressions dealing with {@link Optional}s. */
-final class OptionalTemplates {
- private OptionalTemplates() {}
+/** Refaster rules related to expressions dealing with {@link Optional}s. */
+final class OptionalRules {
+ private OptionalRules() {}
static final class OptionalOfNullable {
// XXX: Refaster should be smart enough to also rewrite occurrences in which there are
@@ -78,8 +78,8 @@ T after(Optional optional) {
}
/** Prefer {@link Optional#orElseThrow()} over the less explicit {@link Optional#get()}. */
- // XXX: This template is analogous to `OptionalOrElseThrow` above. Arguably this is its
- // generalization. If/when Refaster is extended to understand this, delete the template above.
+ // XXX: This rule is analogous to `OptionalOrElseThrow` above. Arguably this is its
+ // generalization. If/when Refaster is extended to understand this, delete the rule above.
static final class OptionalOrElseThrowMethodReference {
@BeforeTemplate
Function, T> before() {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/PrimitiveTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/PrimitiveRules.java
similarity index 89%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/PrimitiveTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/PrimitiveRules.java
index 622d2538c8..041abec002 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/PrimitiveTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/PrimitiveRules.java
@@ -1,12 +1,12 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import com.google.common.primitives.Ints;
import com.google.errorprone.refaster.annotation.AfterTemplate;
import com.google.errorprone.refaster.annotation.BeforeTemplate;
-/** Refaster templates related to expressions dealing with primitives. */
-final class PrimitiveTemplates {
- private PrimitiveTemplates() {}
+/** Refaster rules related to expressions dealing with primitives. */
+final class PrimitiveRules {
+ private PrimitiveRules() {}
/** Avoid contrived ways of expressing the "less than" relationship. */
static final class LessThan {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ReactorTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java
similarity index 97%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ReactorTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java
index 68391d463e..e03b521533 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ReactorTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.common.collect.MoreCollectors.toOptional;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
@@ -27,9 +27,9 @@
import reactor.test.publisher.PublisherProbe;
import tech.picnic.errorprone.refaster.matchers.ThrowsCheckedException;
-/** Refaster templates related to Reactor expressions and statements. */
-final class ReactorTemplates {
- private ReactorTemplates() {}
+/** Refaster rules related to Reactor expressions and statements. */
+final class ReactorRules {
+ private ReactorRules() {}
/**
* Prefer {@link Mono#fromSupplier(Supplier)} over {@link Mono#fromCallable(Callable)} where
@@ -95,7 +95,7 @@ Flux after(Throwable throwable) {
/**
* Don't unnecessarily pass {@link Mono#error(Supplier)} a method reference or lambda expression.
*/
- // XXX: Drop this rule once the more general rule `AssortedTemplates#SupplierAsSupplier` works
+ // XXX: Drop this rule once the more general rule `AssortedRules#SupplierAsSupplier` works
// reliably.
static final class MonoErrorSupplier {
@BeforeTemplate
@@ -112,7 +112,7 @@ Mono after(Supplier supplier) {
/**
* Don't unnecessarily pass {@link Flux#error(Supplier)} a method reference or lambda expression.
*/
- // XXX: Drop this rule once the more general rule `AssortedTemplates#SupplierAsSupplier` works
+ // XXX: Drop this rule once the more general rule `AssortedRules#SupplierAsSupplier` works
// reliably.
static final class FluxErrorSupplier {
@BeforeTemplate
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/RxJava2AdapterTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/RxJava2AdapterRules.java
similarity index 96%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/RxJava2AdapterTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/RxJava2AdapterRules.java
index 5384b9fbf7..b03245c7b1 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/RxJava2AdapterTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/RxJava2AdapterRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import com.google.errorprone.refaster.Refaster;
import com.google.errorprone.refaster.annotation.AfterTemplate;
@@ -14,9 +14,9 @@
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
-/** Refaster templates related to expressions dealing with {@link RxJava2Adapter}. */
-final class RxJava2AdapterTemplates {
- private RxJava2AdapterTemplates() {}
+/** Refaster rules related to expressions dealing with {@link RxJava2Adapter}. */
+final class RxJava2AdapterRules {
+ private RxJava2AdapterRules() {}
/** Use the fluent API style when using {@link RxJava2Adapter#completableToMono}. */
static final class CompletableToMono {
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/StreamTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StreamRules.java
similarity index 98%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/StreamTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StreamRules.java
index 375d67f622..336393e151 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/StreamTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StreamRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
import static java.util.Comparator.naturalOrder;
@@ -23,9 +23,9 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-/** Refaster templates related to expressions dealing with {@link Stream}s. */
-final class StreamTemplates {
- private StreamTemplates() {}
+/** Refaster rules related to expressions dealing with {@link Stream}s. */
+final class StreamRules {
+ private StreamRules() {}
/**
* Prefer {@link Collectors#joining()} over {@link Collectors#joining(CharSequence)} with an empty
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/StringTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StringRules.java
similarity index 94%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/StringTemplates.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StringRules.java
index 7b7707bfed..3e01463f68 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/StringTemplates.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StringRules.java
@@ -1,4 +1,4 @@
-package tech.picnic.errorprone.refastertemplates;
+package tech.picnic.errorprone.refasterrules;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.stream.Collectors.joining;
@@ -18,10 +18,10 @@
import java.util.function.Function;
import javax.annotation.Nullable;
-/** Refaster templates related to expressions dealing with {@link String}s. */
+/** Refaster rules related to expressions dealing with {@link String}s. */
// XXX: Should we prefer `s -> !s.isEmpty()` or `not(String::isEmpty)`?
-final class StringTemplates {
- private StringTemplates() {}
+final class StringRules {
+ private StringRules() {}
/** Prefer {@link String#isEmpty()} over alternatives that consult the string's length. */
static final class StringIsEmpty {
@@ -128,8 +128,8 @@ String after(Object object) {
* Prefer direct delegation to {@link String#valueOf(Object)} over the indirection introduced by
* {@link Objects#toString(Object)}.
*/
- // XXX: This template is analogous to `StringValueOf` above. Arguably this is its generalization.
- // If/when Refaster is extended to understand this, delete the template above.
+ // XXX: This rule is analogous to `StringValueOf` above. Arguably this is its generalization.
+ // If/when Refaster is extended to understand this, delete the rule above.
static final class StringValueOfMethodReference {
@BeforeTemplate
Function