8.51.0 release (2025-04-25)
Total recipe count: 3707
info
This changelog only shows what recipes have been added, removed, or changed. OpenRewrite may do releases that do not include these types of changes. To see these changes, please go to the releases page.
New Recipes
- io.moderne.java.spring.boot3.UpgradeSpringCloudAWSToSpringBoot_3_4: Upgrade the Spring Cloud AWS dependency to a version compatible with Spring Boot 3.4.
- org.openrewrite.apache.commons.lang3.UseStandardCharsets: Prefer the Java standard library's
java.nio.charset.StandardCharsets
overorg.apache.commons.lang3.CharEncoding
. - org.openrewrite.gradle.gradle8.JacocoReportDeprecations: Set the
enabled
torequired
and thedestination
tooutputLocation
for Reports deprecations that were removed in gradle 8. See the gradle docs on this topic. - org.openrewrite.java.ChangePackageInStringLiteral: A recipe that will rename a package name in String literals.
- org.openrewrite.java.ChangeTypeInStringLiteral: Change a given type to another when used in a String literal.
- org.openrewrite.java.dependencies.search.FindMinimumJUnitVersion: A recipe to find the minimum version of JUnit dependencies. This recipe is designed to return the minimum version of JUnit in a project. It will search for JUnit 4 and JUnit 5 dependencies in the project. If both versions are found, it will return the minimum version of JUnit 4. If a minimumVersion is provided, the recipe will search to see if the minimum version of JUnit used by the project is no lower than the minimumVersion. For example: if the minimumVersion is 4, and the project has JUnit 4.12 and JUnit 5.7, the recipe will return JUnit 4.12. If the project has only JUnit 5.7, the recipe will return JUnit 5.7. Another example: if the minimumVersion is 5, and the project has JUnit 4.12 and JUnit 5.7, the recipe will not return any results.
- org.openrewrite.java.migrate.BounceCastleFromJdk15OntoJdk18On: This recipe will upgrade BouncyCastle dependencies from -jdk15on to -jdk18on.
- org.openrewrite.java.migrate.jakarta.Faces4xMigrationToFaces41x: Jakarta EE 11 uses Faces 4.1 a minor upgrade.
- org.openrewrite.java.migrate.jakarta.JakartaEE11: These recipes help with the Migration to Jakarta EE 11, flagging and updating deprecated methods.
- org.openrewrite.java.migrate.jakarta.OmniFacesNamespaceMigration: Find and replace legacy OmniFaces namespaces.
- org.openrewrite.java.migrate.jakarta.UpdateJakartaFacesApi41: Update Jakarta EE Java Faces Dependencies to 4.1.x.
- org.openrewrite.java.migrate.jakarta.UpdateJakartaPlatform11: Update Jakarta EE Platform Dependencies to 11.0.x.
- org.openrewrite.java.migrate.jakarta.UpgradeFaces41OpenSourceLibraries: Upgrade OmniFaces and MyFaces/Mojarra libraries to Jakarta EE11 versions.
- org.openrewrite.java.migrate.lombok.AdoptLombokGetterMethodNames: Rename methods that are effectively getter to the name Lombok would give them.
Limitations:
- If two methods in a class are effectively the same getter then one's name will be corrected and the others name will be left as it is.
- If the correct name for a method is already taken by another method then the name will not be corrected.
- Method name swaps or circular renaming within a class cannot be performed because the names block each other.
E.g.
int getFoo() { return ba; } int getBa() { return foo; }
stays as it is.
- org.openrewrite.java.recipes.ExamplesExtractor: Extract the before/after sources from tests annotated with
@DocumentExample
, and generate a YAML file with those examples to be shown in the documentation to show usage. - org.openrewrite.java.recipes.JavaRecipeBestPractices: Best practices for Java recipe development.
- org.openrewrite.java.recipes.RecipeNullabilityBestPractices: Use JSpecify nullable annotations; drop Nonnull annotations; use
NullMarked
onpackage-info.java
instead. - org.openrewrite.java.recipes.RecipeTestingBestPractices: Best practices for testing recipes.
- org.openrewrite.java.recipes.SourceSpecTextBlockNewLine: Text blocks that assert before and after source code should have a new line after it is closed.
- org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes: Adopt AssertJ BigInteger Assertions. Favor semantically explicit methods (e.g.
myBigInteger.isZero()
overmyBigInteger.isEqualTo(0)
). - org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsEqualToRecipe: Replace
isCloseTo
withisEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsNotEqualToRecipe: Replace
isNotCloseTo
withisNotEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsNotZeroRecipe: Replace
isNotEqualTo(0)
withisNotZero()
. - org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsOneRecipe: Replace
isEqualTo(1)
withisOne()
. - org.openrewrite.java.testing.assertj.AssertJBigIntegerRulesRecipes$AbstractBigIntegerAssertIsZeroRecipe: Replace
isEqualTo(0)
withisZero()
. - org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes: Adopt AssertJ Byte Assertions. Favor semantically explicit methods (e.g.
myByte.isZero()
overmyByte.isEqualTo(0)
). - org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsEqualToRecipe: Replace
isCloseTo
withisEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsNotEqualToRecipe: Replace
isNotCloseTo
withisNotEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsNotZeroRecipe: Replace
isNotEqualTo(0)
withisNotZero()
. - org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsOneRecipe: Replace
isEqualTo(1)
withisOne()
. - org.openrewrite.java.testing.assertj.AssertJByteRulesRecipes$AbstractByteAssertIsZeroRecipe: Replace
isEqualTo(0)
withisZero()
. - org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes: Adopt AssertJ Double Assertions. Favor semantically explicit methods (e.g.
myDouble.isZero()
overmyDouble.isEqualTo(0.0)
). - org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsCloseToWithOffsetRecipe: Replace
isEqualTo
withisCloseTo
whenoffset
orpercentage
is provided. - org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsEqualToRecipe: Replace
isCloseTo
withisEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsNotEqualToRecipe: Replace
isNotCloseTo
withisNotEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsNotZeroRecipe: Replace
isNotEqualTo(0)
withisNotZero()
. - org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsOneRecipe: Replace
isEqualTo(1)
withisOne()
. - org.openrewrite.java.testing.assertj.AssertJDoubleRulesRecipes$AbstractDoubleAssertIsZeroRecipe: Replace
isEqualTo(0)
withisZero()
. - org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes: Adopt AssertJ Float Assertions. Favor semantically explicit methods (e.g.
myFloat.isZero()
overmyFloat.isEqualTo(0.0f)
). - org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsCloseToWithOffsetRecipe: Replace
isEqualTo
withisCloseTo
whenoffset
orpercentage
is provided. - org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsEqualToRecipe: Replace
isCloseTo
withisEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsNotEqualToRecipe: Replace
isNotCloseTo
withisNotEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsNotZeroRecipe: Replace
isNotEqualTo(0)
withisNotZero()
. - org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsOneRecipe: Replace
isEqualTo(1)
withisOne()
. - org.openrewrite.java.testing.assertj.AssertJFloatRulesRecipes$AbstractFloatAssertIsZeroRecipe: Replace
isEqualTo(0)
withisZero()
. - org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes: Adopt AssertJ Integer Assertions. Favor semantically explicit methods (e.g.
myInteger.isZero()
overmyInteger.isEqualTo(0)
). - org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsEqualToRecipe: Replace
isCloseTo
withisEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsNotEqualToRecipe: Replace
isNotCloseTo
withisNotEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsNotZeroRecipe: Replace
isNotEqualTo(0)
withisNotZero()
. - org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsOneRecipe: Replace
isEqualTo(1)
withisOne()
. - org.openrewrite.java.testing.assertj.AssertJIntegerRulesRecipes$AbstractIntegerAssertIsZeroRecipe: Replace
isEqualTo(0)
withisZero()
. - org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes: Adopt AssertJ Long Assertions. Favor semantically explicit methods (e.g.
myLong.isZero()
overmyLong.isEqualTo(0)
). - org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsEqualToRecipe: Replace
isCloseTo
withisEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsNotEqualToRecipe: Replace
isNotCloseTo
withisNotEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsNotZeroRecipe: Replace
isNotEqualTo(0)
withisNotZero()
. - org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsOneRecipe: Replace
isEqualTo(1)
withisOne()
. - org.openrewrite.java.testing.assertj.AssertJLongRulesRecipes$AbstractLongAssertIsZeroRecipe: Replace
isEqualTo(0)
withisZero()
. - org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes: Adopt AssertJ Short Assertions. Favor semantically explicit methods (e.g.
myShort.isZero()
overmyShort.isEqualTo(0)
). - org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsEqualToRecipe: Replace
isCloseTo
withisEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsNotEqualToRecipe: Replace
isNotCloseTo
withisNotEqualTo
whenoffset
orpercentage
is zero. - org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsNotZeroRecipe: Replace
isNotEqualTo(0)
withisNotZero()
. - org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsOneRecipe: Replace
isEqualTo(1)
withisOne()
. - org.openrewrite.java.testing.assertj.AssertJShortRulesRecipes$AbstractShortAssertIsZeroRecipe: Replace
isEqualTo(0)
withisZero()
. - org.openrewrite.java.testing.junit5.EnvironmentVariables: Replaces usage of the JUnit 4
@Rule EnvironmentVariables
with the JUnit 5-compatibleSystemStubsExtension
and@SystemStub EnvironmentVariables
from the System Stubs library. - org.openrewrite.java.testing.mockito.MockitoJUnitRunnerToExtension: Replace JUnit 4 MockitoJUnitRunner annotations with JUnit 5
@ExtendWith(MockitoExtension.class)
using the appropriate strictness levels (LENIENT, WARN, STRICT_STUBS). - org.openrewrite.java.testing.mockito.RemoveInitMocksIfRunnersSpecified: Remove
MockitoAnnotations.initMocks(this)
if specified class-level JUnit runners@RunWith(MockitoJUnitRunner.class)
or@ExtendWith(MockitoExtension.class)
. - org.openrewrite.java.testing.mockito.ReplaceInitMockToOpenMock: Replace
MockitoAnnotations.initMocks(this)
toMockitoAnnotations.openMocks(this)
and generateAutoCloseable
mocks. - org.openrewrite.maven.plugin.DependencyPluginGoalResolveSources: Migrate from
sources
toresolve-sources
for themaven-dependency-plugin
. - software.amazon.awssdk.v2migration.S3AddImportsAndComments: Add imports and comments to unsupported S3 transforms.
- software.amazon.awssdk.v2migration.S3TypesToV2: Change S3 types to v2.
- software.amazon.awssdk.v2migration.openrewrite.ChangeMethodInvocationReturnType: Changes the return type of a method invocation.
- tech.picnic.errorprone.refasterrules.AssertJComparableRulesRecipes: Refaster template recipes for
tech.picnic.errorprone.refasterrules.AssertJComparableRules
. Source. - tech.picnic.errorprone.refasterrules.AssertJComparableRulesRecipes$AssertThatIsEqualByComparingToRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsEqualByComparingTo<T extends Comparable<? super T>> {
@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isEqualTo(0);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isEqualByComparingTo(expected);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJComparableRulesRecipes$AssertThatIsGreaterThanOrEqualToRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsGreaterThanOrEqualTo<T extends Comparable<? super T>> {
@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isNotNegative();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isGreaterThanOrEqualTo(expected);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJComparableRulesRecipes$AssertThatIsGreaterThanRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsGreaterThan<T extends Comparable<? super T>> {
@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isPositive();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isGreaterThan(expected);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJComparableRulesRecipes$AssertThatIsLessThanOrEqualToRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsLessThanOrEqualTo<T extends Comparable<? super T>> {
@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isNotPositive();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isLessThanOrEqualTo(expected);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJComparableRulesRecipes$AssertThatIsLessThanRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsLessThan<T extends Comparable<? super T>> {
@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isNegative();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isLessThan(expected);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJComparableRulesRecipes$AssertThatIsNotEqualByComparingToRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsNotEqualByComparingTo<T extends Comparable<? super T>> {
@BeforeTemplate
AbstractIntegerAssert<?> before(T actual, T expected) {
return assertThat(actual.compareTo(expected)).isNotEqualTo(0);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractComparableAssert<?, ?> after(T actual, T expected) {
return assertThat(actual).isNotEqualByComparingTo(expected);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJEnumerableRulesRecipes: Refaster template recipes for
tech.picnic.errorprone.refasterrules.AssertJEnumerableRules
. Source. - tech.picnic.errorprone.refasterrules.AssertJEnumerableRulesRecipes$EnumerableAssertHasSameSizeAsRecipe: Recipe created for the following Refaster template:
static final class EnumerableAssertHasSameSizeAs<S, E> {
@BeforeTemplate
EnumerableAssert<?, S> before(EnumerableAssert<?, S> enumAssert, Iterable<E> iterable) {
return enumAssert.hasSize(Iterables.size(iterable));
}
@BeforeTemplate
EnumerableAssert<?, S> before(EnumerableAssert<?, S> enumAssert, Collection<E> iterable) {
return enumAssert.hasSize(iterable.size());
}
@BeforeTemplate
EnumerableAssert<?, S> before(EnumerableAssert<?, S> enumAssert, E[] iterable) {
return enumAssert.hasSize(iterable.length);
}
@BeforeTemplate
EnumerableAssert<?, S> before(EnumerableAssert<?, S> enumAssert, CharSequence iterable) {
return enumAssert.hasSize(iterable.length());
}
@AfterTemplate
EnumerableAssert<?, S> after(EnumerableAssert<?, S> enumAssert, Iterable<E> iterable) {
return enumAssert.hasSameSizeAs(iterable);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJEnumerableRulesRecipes$EnumerableAssertHasSizeBetweenRecipe: Recipe created for the following Refaster template:
static final class EnumerableAssertHasSizeBetween<E> {
@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int lower, int upper) {
return enumAssert.size().isBetween(lower, upper).returnToIterable();
}
@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int lower, int upper) {
return enumAssert.size().isBetween(lower, upper);
}
@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int lower, int upper) {
return enumAssert.hasSizeBetween(lower, upper);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJEnumerableRulesRecipes$EnumerableAssertHasSizeGreaterThanOrEqualToRecipe: Recipe created for the following Refaster template:
static final class EnumerableAssertHasSizeGreaterThanOrEqualTo<E> {
@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isGreaterThanOrEqualTo(size).returnToIterable();
}
@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isGreaterThanOrEqualTo(size);
}
@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int size) {
return enumAssert.hasSizeGreaterThanOrEqualTo(size);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJEnumerableRulesRecipes$EnumerableAssertHasSizeGreaterThanRecipe: Recipe created for the following Refaster template:
static final class EnumerableAssertHasSizeGreaterThan<E> {
@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isGreaterThan(size).returnToIterable();
}
@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isGreaterThan(size);
}
@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int size) {
return enumAssert.hasSizeGreaterThan(size);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJEnumerableRulesRecipes$EnumerableAssertHasSizeLessThanOrEqualToRecipe: Recipe created for the following Refaster template:
static final class EnumerableAssertHasSizeLessThanOrEqualTo<E> {
@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isLessThanOrEqualTo(size).returnToIterable();
}
@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isLessThanOrEqualTo(size);
}
@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int size) {
return enumAssert.hasSizeLessThanOrEqualTo(size);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJEnumerableRulesRecipes$EnumerableAssertHasSizeLessThanRecipe: Recipe created for the following Refaster template:
static final class EnumerableAssertHasSizeLessThan<E> {
@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isLessThan(size).returnToIterable();
}
@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isLessThan(size);
}
@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int size) {
return enumAssert.hasSizeLessThan(size);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJEnumerableRulesRecipes$EnumerableAssertHasSizeRecipe: Recipe created for the following Refaster template:
static final class EnumerableAssertHasSize<E> {
@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isEqualTo(size).returnToIterable();
}
@BeforeTemplate
AbstractIterableSizeAssert<?, ?, E, ?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert, int size) {
return enumAssert.size().isEqualTo(size);
}
@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert, int size) {
return enumAssert.hasSize(size);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJEnumerableRulesRecipes$EnumerableAssertIsEmptyRecipe: Recipe created for the following Refaster template:
static final class EnumerableAssertIsEmpty<E> {
@BeforeTemplate
void before(EnumerableAssert<?, E> enumAssert) {
Refaster.anyOf(enumAssert.hasSize(0), enumAssert.hasSizeLessThanOrEqualTo(0), enumAssert.hasSizeLessThan(1));
}
@BeforeTemplate
void before(AbstractIterableAssert<?, ?, E, ?> enumAssert) {
enumAssert.size().isNotPositive();
}
@AfterTemplate
void after(EnumerableAssert<?, E> enumAssert) {
enumAssert.isEmpty();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJEnumerableRulesRecipes$EnumerableAssertIsNotEmptyRecipe: Recipe created for the following Refaster template:
static final class EnumerableAssertIsNotEmpty<E> {
@BeforeTemplate
EnumerableAssert<?, E> before(EnumerableAssert<?, E> enumAssert) {
return Refaster.anyOf(enumAssert.hasSizeGreaterThan(0), enumAssert.hasSizeGreaterThanOrEqualTo(1));
}
@BeforeTemplate
AbstractIterableAssert<?, ?, E, ?> before(AbstractIterableAssert<?, ?, E, ?> enumAssert) {
return Refaster.anyOf(enumAssert.size().isNotEqualTo(0).returnToIterable(), enumAssert.size().isPositive().returnToIterable());
}
@BeforeTemplate
AbstractIntegerAssert<?> before2(AbstractIterableAssert<?, ?, E, ?> enumAssert) {
return Refaster.anyOf(enumAssert.size().isNotEqualTo(0), enumAssert.size().isPositive());
}
@AfterTemplate
EnumerableAssert<?, E> after(EnumerableAssert<?, E> enumAssert) {
return enumAssert.isNotEmpty();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJIterableRulesRecipes: Refaster template recipes for
tech.picnic.errorprone.refasterrules.AssertJIterableRules
. Source. - tech.picnic.errorprone.refasterrules.AssertJIterableRulesRecipes$AssertThatIterableHasOneElementEqualToRecipe: Recipe created for the following Refaster template:
static final class AssertThatIterableHasOneElementEqualTo<S, E extends S> {
@BeforeTemplate
ObjectAssert<S> before(Iterable<S> iterable, E element) {
return assertThat(Iterables.getOnlyElement(iterable)).isEqualTo(element);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
IterableAssert<S> after(Iterable<S> iterable, E element) {
return assertThat(iterable).containsExactly(element);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJIterableRulesRecipes$AssertThatIterableIsEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatIterableIsEmpty<E> {
@BeforeTemplate
void before(Iterable<E> iterable) {
assertThat(iterable.iterator()).isExhausted();
}
@BeforeTemplate
void before(Collection<E> iterable) {
assertThat(iterable.isEmpty()).isTrue();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Collection<E> iterable) {
assertThat(iterable).isEmpty();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJIterableRulesRecipes$AssertThatIterableIsNotEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatIterableIsNotEmpty<E> {
@BeforeTemplate
AbstractAssert<?, ?> before(Iterable<E> iterable) {
return assertThat(iterable.iterator()).hasNext();
}
@BeforeTemplate
AbstractAssert<?, ?> before(Collection<E> iterable) {
return assertThat(iterable.isEmpty()).isFalse();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
IterableAssert<E> after(Iterable<E> iterable) {
return assertThat(iterable).isNotEmpty();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJIterableRulesRecipes$AssertThatIterableSizeRecipe: Recipe created for the following Refaster template:
static final class AssertThatIterableSize<E> {
@BeforeTemplate
AbstractIntegerAssert<?> before(Iterable<E> iterable) {
return assertThat(Iterables.size(iterable));
}
@BeforeTemplate
AbstractIntegerAssert<?> before(Collection<E> iterable) {
return assertThat(iterable.size());
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractIntegerAssert<?> after(Iterable<E> iterable) {
return assertThat(iterable).size();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJIteratorRulesRecipes: Refaster template recipes for
tech.picnic.errorprone.refasterrules.AssertJIteratorRules
. Source. - tech.picnic.errorprone.refasterrules.AssertJIteratorRulesRecipes$AssertThatHasNextRecipe: Recipe created for the following Refaster template:
static final class AssertThatHasNext<T> {
@BeforeTemplate
AbstractBooleanAssert<?> before(Iterator<T> iterator) {
return assertThat(iterator.hasNext()).isTrue();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
IteratorAssert<T> after(Iterator<T> iterator) {
return assertThat(iterator).hasNext();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJIteratorRulesRecipes$AssertThatIsExhaustedRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsExhausted<T> {
@BeforeTemplate
AbstractBooleanAssert<?> before(Iterator<T> iterator) {
return assertThat(iterator.hasNext()).isFalse();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
IteratorAssert<T> after(Iterator<T> iterator) {
return assertThat(iterator).isExhausted();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes: Refaster template recipes for
tech.picnic.errorprone.refasterrules.AssertJMapRules
. Source. - tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AbstractMapAssertContainsExactlyEntriesOfRecipe: Recipe created for the following Refaster template:
static final class AbstractMapAssertContainsExactlyEntriesOf<K, V> {
@BeforeTemplate
AbstractMapAssert<?, ?, K, V> before(AbstractMapAssert<?, ?, K, V> mapAssert, K key, V value) {
return mapAssert.containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(key, value));
}
@AfterTemplate
AbstractMapAssert<?, ?, K, V> after(AbstractMapAssert<?, ?, K, V> mapAssert, K key, V value) {
return mapAssert.containsExactlyEntriesOf(ImmutableMap.of(key, value));
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AbstractMapAssertContainsExactlyInAnyOrderEntriesOfRecipe: Recipe created for the following Refaster template:
static final class AbstractMapAssertContainsExactlyInAnyOrderEntriesOf<K, V> {
@BeforeTemplate
AbstractMapAssert<?, ?, K, V> before(AbstractMapAssert<?, ?, K, V> mapAssert, Map<? extends K, ? extends V> map) {
return mapAssert.isEqualTo(map);
}
@AfterTemplate
AbstractMapAssert<?, ?, K, V> after(AbstractMapAssert<?, ?, K, V> mapAssert, Map<? extends K, ? extends V> map) {
return mapAssert.containsExactlyInAnyOrderEntriesOf(map);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AbstractMapAssertHasSameSizeAsRecipe: Recipe created for the following Refaster template:
static final class AbstractMapAssertHasSameSizeAs<K, V> {
@BeforeTemplate
AbstractMapAssert<?, ?, K, V> before(AbstractMapAssert<?, ?, K, V> mapAssert, Map<?, ?> map) {
return mapAssert.hasSize(map.size());
}
@AfterTemplate
AbstractMapAssert<?, ?, K, V> after(AbstractMapAssert<?, ?, K, V> mapAssert, Map<?, ?> map) {
return mapAssert.hasSameSizeAs(map);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapContainsKeyRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapContainsKey<K, V> {
@BeforeTemplate
AbstractBooleanAssert<?> before(Map<K, V> map, K key) {
return assertThat(map.containsKey(key)).isTrue();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, K key) {
return assertThat(map).containsKey(key);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapContainsOnlyKeysRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapContainsOnlyKeys<K, V> {
@BeforeTemplate
AbstractCollectionAssert<?, Collection<? extends K>, K, ?> before(Map<K, V> map, Iterable<? extends K> keys) {
return assertThat(map.keySet()).hasSameElementsAs(keys);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, Iterable<? extends K> keys) {
return assertThat(map).containsOnlyKeys(keys);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapContainsValueRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapContainsValue<K, V> {
@BeforeTemplate
AbstractBooleanAssert<?> before(Map<K, V> map, V value) {
return assertThat(map.containsValue(value)).isTrue();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, V value) {
return assertThat(map).containsValue(value);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapDoesNotContainKeyRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapDoesNotContainKey<K, V> {
@BeforeTemplate
AbstractBooleanAssert<?> before(Map<K, V> map, K key) {
return assertThat(map.containsKey(key)).isFalse();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, K key) {
return assertThat(map).doesNotContainKey(key);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapDoesNotContainValueRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapDoesNotContainValue<K, V> {
@BeforeTemplate
AbstractBooleanAssert<?> before(Map<K, V> map, V value) {
return assertThat(map.containsValue(value)).isFalse();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, V value) {
return assertThat(map).doesNotContainValue(value);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJMapRulesRecipes$AssertThatMapIsEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapIsEmpty<K, V> {
@BeforeTemplate
void before(Map<K, V> map) {
Refaster.anyOf(assertThat(map).hasSize(0), assertThat(map.isEmpty()).isTrue(), assertThat(map.size()).isEqualTo(0L), assertThat(map.size()).isNotPositive());
}
@BeforeTemplate
void before2(Map<K, V> map) {
assertThat(Refaster.anyOf(map.keySet(), map.values(), map.entrySet())).isEmpty();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Map<K, V> map) {
assertThat(map).isEmpty();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJObjectRulesRecipes: Refaster template recipes for
tech.picnic.errorprone.refasterrules.AssertJObjectRules
. Source. - tech.picnic.errorprone.refasterrules.AssertJObjectRulesRecipes$AssertThatHasToStringRecipe: Recipe created for the following Refaster template:
static final class AssertThatHasToString<T> {
@BeforeTemplate
AbstractStringAssert<?> before(T object, String str) {
return assertThat(object.toString()).isEqualTo(str);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ObjectAssert<T> after(T object, String str) {
return assertThat(object).hasToString(str);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJObjectRulesRecipes$AssertThatIsIsEqualToRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsIsEqualTo<S, T> {
@BeforeTemplate
AbstractBooleanAssert<?> before(S object1, T object2) {
return assertThat(object1.equals(object2)).isTrue();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ObjectAssert<S> after(S object1, T object2) {
return assertThat(object1).isEqualTo(object2);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJObjectRulesRecipes$AssertThatIsIsNotEqualToRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsIsNotEqualTo<S, T> {
@BeforeTemplate
AbstractBooleanAssert<?> before(S object1, T object2) {
return assertThat(object1.equals(object2)).isFalse();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ObjectAssert<S> after(S object1, T object2) {
return assertThat(object1).isNotEqualTo(object2);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes: Refaster template recipes for
tech.picnic.errorprone.refasterrules.AssertJOptionalRules
. Source. - tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AbstractOptionalAssertContainsSameRecipe: Recipe created for the following Refaster template:
static final class AbstractOptionalAssertContainsSame<T> {
@BeforeTemplate
AbstractAssert<?, ?> before(AbstractOptionalAssert<?, T> optionalAssert, T value) {
return Refaster.anyOf(optionalAssert.get().isSameAs(value), optionalAssert.isPresent().isSameAs(value));
}
@AfterTemplate
AbstractOptionalAssert<?, T> after(AbstractOptionalAssert<?, T> optionalAssert, T value) {
return optionalAssert.containsSame(value);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AbstractOptionalAssertHasValueRecipe: Recipe created for the following Refaster template:
static final class AbstractOptionalAssertHasValue<T> {
@BeforeTemplate
AbstractAssert<?, ?> before(AbstractOptionalAssert<?, T> optionalAssert, T value) {
return Refaster.anyOf(optionalAssert.get().isEqualTo(value), optionalAssert.isEqualTo(Optional.of(value)), optionalAssert.contains(value), optionalAssert.isPresent().hasValue(value));
}
@AfterTemplate
AbstractOptionalAssert<?, T> after(AbstractOptionalAssert<?, T> optionalAssert, T value) {
return optionalAssert.hasValue(value);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AbstractOptionalAssertIsEmptyRecipe: Recipe created for the following Refaster template:
static final class AbstractOptionalAssertIsEmpty<T> {
@BeforeTemplate
AbstractAssert<?, ?> before(AbstractOptionalAssert<?, T> optionalAssert) {
return Refaster.anyOf(optionalAssert.isNotPresent(), optionalAssert.isEqualTo(Optional.empty()));
}
@AfterTemplate
AbstractOptionalAssert<?, T> after(AbstractOptionalAssert<?, T> optionalAssert) {
return optionalAssert.isEmpty();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AbstractOptionalAssertIsPresentRecipe: Recipe created for the following Refaster template:
static final class AbstractOptionalAssertIsPresent<T> {
@BeforeTemplate
AbstractAssert<?, ?> before(AbstractOptionalAssert<?, T> optionalAssert) {
return Refaster.anyOf(optionalAssert.isNotEmpty(), optionalAssert.isNotEqualTo(Optional.empty()));
}
@AfterTemplate
AbstractOptionalAssert<?, T> after(AbstractOptionalAssert<?, T> optionalAssert) {
return optionalAssert.isPresent();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AssertThatOptionalHasValueMatchingRecipe: Recipe created for the following Refaster template:
static final class AssertThatOptionalHasValueMatching<T> {
@BeforeTemplate
AbstractOptionalAssert<?, T> before(Optional<T> optional, Predicate<? super T> predicate) {
return assertThat(optional.filter(predicate)).isPresent();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractObjectAssert<?, T> after(Optional<T> optional, Predicate<? super T> predicate) {
return assertThat(optional).get().matches(predicate);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AssertThatOptionalIsEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatOptionalIsEmpty<T> {
@BeforeTemplate
AbstractAssert<?, ?> before(Optional<T> optional) {
return Refaster.anyOf(assertThat(optional.isEmpty()).isTrue(), assertThat(optional.isPresent()).isFalse());
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
OptionalAssert<T> after(Optional<T> optional) {
return assertThat(optional).isEmpty();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AssertThatOptionalIsPresentRecipe: Recipe created for the following Refaster template:
static final class AssertThatOptionalIsPresent<T> {
@BeforeTemplate
AbstractAssert<?, ?> before(Optional<T> optional) {
return Refaster.anyOf(assertThat(optional.isPresent()).isTrue(), assertThat(optional.isEmpty()).isFalse());
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
OptionalAssert<T> after(Optional<T> optional) {
return assertThat(optional).isPresent();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJOptionalRulesRecipes$AssertThatOptionalRecipe: Recipe created for the following Refaster template:
static final class AssertThatOptional<T> {
@BeforeTemplate
ObjectAssert<T> before(Optional<T> optional) {
return assertThat(optional.orElseThrow());
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractObjectAssert<?, T> after(Optional<T> optional) {
return assertThat(optional).get();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatListsAreEqualRecipe: Recipe created for the following Refaster template:
static final class AssertThatListsAreEqual<S, T extends S> {
@BeforeTemplate
ListAssert<S> before(List<S> list1, Iterable<T> list2) {
return assertThat(list1).isEqualTo(list2);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(List<S> list1, Iterable<T> list2) {
return assertThat(list1).containsExactlyElementsOf(list2);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatMapContainsEntryRecipe: Recipe created for the following Refaster template:
static final class AssertThatMapContainsEntry<K, V> {
@BeforeTemplate
ObjectAssert<?> before(Map<K, V> map, K key, V value) {
return assertThat(map.get(key)).isEqualTo(value);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
MapAssert<K, V> after(Map<K, V> map, K key, V value) {
return assertThat(map).containsEntry(key, value);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatMultisetsAreEqualRecipe: Recipe created for the following Refaster template:
static final class AssertThatMultisetsAreEqual<S, T extends S> {
@BeforeTemplate
AbstractCollectionAssert<?, ?, S, ?> before(Multiset<S> multiset1, Iterable<T> multiset2) {
return assertThat(multiset1).isEqualTo(multiset2);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractCollectionAssert<?, ?, S, ?> after(Multiset<S> multiset1, Iterable<T> multiset2) {
return assertThat(multiset1).containsExactlyInAnyOrderElementsOf(multiset2);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatPredicateAcceptsRecipe: Recipe created for the following Refaster template:
static final class AssertThatPredicateAccepts<T> {
@BeforeTemplate
void before(Predicate<T> predicate, T object) {
assertThat(predicate.test(object)).isTrue();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Predicate<T> predicate, T object) {
assertThat(predicate).accepts(object);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatPredicateRejectsRecipe: Recipe created for the following Refaster template:
static final class AssertThatPredicateRejects<T> {
@BeforeTemplate
void before(Predicate<T> predicate, T object) {
assertThat(predicate.test(object)).isFalse();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Predicate<T> predicate, T object) {
assertThat(predicate).rejects(object);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatSetContainsExactlyOneElementRecipe: Recipe created for the following Refaster template:
static final class AssertThatSetContainsExactlyOneElement<S, T extends S> {
@BeforeTemplate
ObjectEnumerableAssert<?, S> before(Set<S> set, T element) {
return assertThat(set).containsOnly(element);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ObjectEnumerableAssert<?, S> after(Set<S> set, T element) {
return assertThat(set).containsExactly(element);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatSetsAreEqualRecipe: Recipe created for the following Refaster template:
static final class AssertThatSetsAreEqual<S, T extends S> {
@BeforeTemplate
AbstractCollectionAssert<?, ?, S, ?> before(Set<S> set1, Iterable<T> set2) {
return Refaster.anyOf(assertThat(set1).isEqualTo(set2), assertThat(set1).containsExactlyInAnyOrderElementsOf(set2));
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractCollectionAssert<?, ?, S, ?> after(Set<S> set1, Iterable<T> set2) {
return assertThat(set1).hasSameElementsAs(set2);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsAllRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsAll<S, T extends S, U extends T> {
@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).containsAll(iterable);
}
@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsAll(iterable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsAll(iterable);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsAnyElementsOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsAnyElementsOf<S, T extends S, U extends T> {
@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).containsAnyElementsOf(iterable);
}
@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsAnyElementsOf(iterable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsAnyElementsOf(iterable);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsAnyOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsAnyOf<S, T extends S, U extends T> {
@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).containsAnyOf(array);
}
@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsAnyOf(array);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).containsAnyOf(array);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsExactlyElementsOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsExactlyElementsOf<S, T extends S, U extends T> {
@BeforeTemplate
ListAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsExactlyElementsOf(iterable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsExactlyElementsOf(iterable);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsExactlyInAnyOrderElementsOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsExactlyInAnyOrderElementsOf<S, T extends S, U extends T> {
@BeforeTemplate
ListAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsExactlyInAnyOrderElementsOf(iterable);
}
@BeforeTemplate
AbstractCollectionAssert<?, ?, T, ?> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Multiset<T>> collector) {
return assertThat(stream.collect(collector)).containsExactlyInAnyOrderElementsOf(iterable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsExactlyInAnyOrderElementsOf(iterable);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsExactlyInAnyOrderRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsExactlyInAnyOrder<S, T extends S, U extends T> {
@BeforeTemplate
ListAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsExactlyInAnyOrder(array);
}
@BeforeTemplate
AbstractCollectionAssert<?, ?, T, ?> before2(Stream<S> stream, U[] array, Collector<S, ?, ? extends Multiset<T>> collector) {
return assertThat(stream.collect(collector)).containsExactlyInAnyOrder(array);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).containsExactlyInAnyOrder(array);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsExactlyRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsExactly<S, T extends S, U extends T> {
@BeforeTemplate
ListAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsExactly(array);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).containsExactly(array);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsOnlyRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsOnly<S, T extends S, U extends T> {
@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).containsOnly(array);
}
@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsOnly(array);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).containsOnly(array);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContains<S, T extends S, U extends T> {
@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).contains(array);
}
@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).contains(array);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).contains(array);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsSequenceRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsSequence<S, T extends S, U extends T> {
@BeforeTemplate
ListAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsSequence(iterable);
}
@BeforeTemplate
ListAssert<T> before(Stream<S> stream, U[] iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsSequence(iterable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsSequence(iterable);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamContainsSubsequenceRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamContainsSubsequence<S, T extends S, U extends T> {
@BeforeTemplate
ListAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsSubsequence(iterable);
}
@BeforeTemplate
ListAssert<T> before(Stream<S> stream, U[] iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).containsSubsequence(iterable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).containsSubsequence(iterable);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamDoesNotContainAnyElementsOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamDoesNotContainAnyElementsOf<S, T extends S, U extends T> {
@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContainAnyElementsOf(iterable);
}
@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContainAnyElementsOf(iterable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).doesNotContainAnyElementsOf(iterable);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamDoesNotContainRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamDoesNotContain<S, T extends S, U extends T> {
@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, U[] array, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContain(array);
}
@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, U[] array, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContain(array);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] array) {
return assertThat(stream).doesNotContain(array);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamDoesNotContainSequenceRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamDoesNotContainSequence<S, T extends S, U extends T> {
@BeforeTemplate
ListAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContainSequence(iterable);
}
@BeforeTemplate
ListAssert<T> before(Stream<S> stream, U[] iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).doesNotContainSequence(iterable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).doesNotContainSequence(iterable);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamHasSameElementsAsRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamHasSameElementsAs<S, T extends S, U extends T> {
@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).hasSameElementsAs(iterable);
}
@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).hasSameElementsAs(iterable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, Iterable<U> iterable) {
return assertThat(stream).hasSameElementsAs(iterable);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamHasSizeRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamHasSize<T> {
@BeforeTemplate
void before(Stream<T> stream, int size) {
assertThat(stream.count()).isEqualTo(size);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Stream<T> stream, int size) {
assertThat(stream).hasSize(size);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamIsEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamIsEmpty<S, T extends S> {
@BeforeTemplate
void before(Stream<S> stream, Collector<S, ?, ? extends Iterable<T>> collector) {
assertThat(stream.collect(collector)).isEmpty();
}
@BeforeTemplate
void before2(Stream<S> stream, Collector<S, ?, ? extends List<T>> collector) {
assertThat(stream.collect(collector)).isEmpty();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Stream<S> stream) {
assertThat(stream).isEmpty();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamIsNotEmptyRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamIsNotEmpty<S, T extends S> {
@BeforeTemplate
void before(Stream<S> stream, Collector<S, ?, ? extends Iterable<T>> collector) {
assertThat(stream.collect(collector)).isNotEmpty();
}
@BeforeTemplate
void before2(Stream<S> stream, Collector<S, ?, ? extends List<T>> collector) {
assertThat(stream.collect(collector)).isNotEmpty();
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Stream<S> stream) {
assertThat(stream).isNotEmpty();
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$AssertThatStreamIsSubsetOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatStreamIsSubsetOf<S, T extends S, U extends T> {
@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).isSubsetOf(iterable);
}
@BeforeTemplate
IterableAssert<T> before(Stream<S> stream, U[] iterable, Collector<S, ?, ? extends Iterable<T>> collector) {
return assertThat(stream.collect(collector)).isSubsetOf(iterable);
}
@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, Iterable<U> iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).isSubsetOf(iterable);
}
@BeforeTemplate
ListAssert<T> before2(Stream<S> stream, U[] iterable, Collector<S, ?, ? extends List<T>> collector) {
return assertThat(stream.collect(collector)).isSubsetOf(iterable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
ListAssert<S> after(Stream<S> stream, U[] iterable) {
return assertThat(stream).isSubsetOf(iterable);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$ObjectEnumerableContainsOneElementRecipe: Recipe created for the following Refaster template:
static final class ObjectEnumerableContainsOneElement<S, T extends S> {
@BeforeTemplate
@SuppressWarnings(value = "unchecked")
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T element) {
return Refaster.anyOf(iterAssert.containsAnyOf(element), iterAssert.containsSequence(element), iterAssert.containsSubsequence(element));
}
@AfterTemplate
@SuppressWarnings(value = "unchecked")
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T element) {
return iterAssert.contains(element);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJRulesRecipes$ObjectEnumerableDoesNotContainOneElementRecipe: Recipe created for the following Refaster template:
static final class ObjectEnumerableDoesNotContainOneElement<S, T extends S> {
@BeforeTemplate
@SuppressWarnings(value = "unchecked")
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T element) {
return iterAssert.doesNotContainSequence(element);
}
@AfterTemplate
@SuppressWarnings(value = "unchecked")
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T element) {
return iterAssert.doesNotContain(element);
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByAsInstanceOfThrowableRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByAsInstanceOfThrowable<T extends Throwable> {
@BeforeTemplate
ThrowableAssertAlternative<T> before(ThrowingCallable throwingCallable, Class<T> exceptionType) {
return assertThatExceptionOfType(exceptionType).isThrownBy(throwingCallable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
AbstractThrowableAssert<?, T> after(ThrowingCallable throwingCallable, Class<T> exceptionType) {
return assertThatThrownBy(throwingCallable).asInstanceOf(throwable(exceptionType));
}
}
.
- tech.picnic.errorprone.refasterrules.AssertJThrowingCallableRulesRecipes$AssertThatThrownByIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByIsInstanceOf<T extends Throwable> {
@BeforeTemplate
void before(ThrowingCallable throwingCallable, Class<T> exceptionType) {
Refaster.anyOf(assertThatThrownBy(throwingCallable).asInstanceOf(throwable(exceptionType)), assertThatThrownBy(throwingCallable).asInstanceOf(type(exceptionType)));
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, Class<T> exceptionType) {
assertThatThrownBy(throwingCallable).isInstanceOf(exceptionType);
}
}
.
- tech.picnic.errorprone.refasterrules.AssortedRulesRecipes$DisjointCollectionsRecipe: Don't unnecessarily copy collections before passing them to
Collections#disjoint(Collection, Collection)
. - tech.picnic.errorprone.refasterrules.AssortedRulesRecipes$DisjointSetsRecipe: Prefer
Collections#disjoint(Collection, Collection)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.AssortedRulesRecipes$IterableIsEmptyRecipe: Prefer
Iterables#isEmpty(Iterable)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.AssortedRulesRecipes$IteratorGetNextOrDefaultRecipe: Prefer
Iterators#getNext(Iterator, Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.AssortedRulesRecipes$UnboundedSingleElementStreamRecipe: Prefer
Stream#generate(java.util.function.Supplier)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ClassRulesRecipes: Refaster rules related to expressions dealing with classes. Source.
- tech.picnic.errorprone.refasterrules.ClassRulesRecipes$ClassIsInstanceRecipe: Prefer
Class#isInstance(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes: Refaster rules related to expressions dealing with (arbitrary) collections. Source.
- tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionAddAllToCollectionBlockRecipe: Recipe created for the following Refaster template:
static final class CollectionAddAllToCollectionBlock<T, S extends T> {
@BeforeTemplate
void before(Collection<T> addTo, Collection<S> elementsToAdd) {
elementsToAdd.forEach(addTo::add);
}
@BeforeTemplate
void before2(Collection<T> addTo, Collection<S> elementsToAdd) {
for (T element : elementsToAdd) {
addTo.add(element);
}
}
@BeforeTemplate
void before3(Collection<T> addTo, Collection<S> elementsToAdd) {
for (S element : elementsToAdd) {
addTo.add(element);
}
}
@AfterTemplate
void after(Collection<T> addTo, Collection<S> elementsToAdd) {
addTo.addAll(elementsToAdd);
}
}
.
- tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionAddAllToCollectionExpressionRecipe: Don't call
Iterables#addAll(Collection, Iterable)
when the elements to be added are already part of aCollection
. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionContainsRecipe: Prefer
Collection#contains(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionForEachRecipe: Prefer
Collection#forEach(Consumer)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionIsEmptyRecipe: Prefer
Collection#isEmpty()
over alternatives that consult the collection's size or are otherwise more contrived. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionIteratorRecipe: Prefer
Collection#iterator()
over more contrived or less efficient alternatives. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionRemoveAllFromCollectionBlockRecipe: Recipe created for the following Refaster template:
static final class CollectionRemoveAllFromCollectionBlock<T, S extends T> {
@BeforeTemplate
void before(Collection<T> removeFrom, Collection<S> elementsToRemove) {
elementsToRemove.forEach(removeFrom::remove);
}
@BeforeTemplate
void before2(Collection<T> removeFrom, Collection<S> elementsToRemove) {
for (T element : elementsToRemove) {
removeFrom.remove(element);
}
}
@BeforeTemplate
void before3(Collection<T> removeFrom, Collection<S> elementsToRemove) {
for (S element : elementsToRemove) {
removeFrom.remove(element);
}
}
@AfterTemplate
void after(Collection<T> removeFrom, Collection<S> elementsToRemove) {
removeFrom.removeAll(elementsToRemove);
}
}
.
- tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionRemoveAllFromCollectionExpressionRecipe: Don't call
Iterables#removeAll(Iterable, Collection)
when the elements to be removed are already part of aCollection
. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionSizeRecipe: Prefer
Collection#size()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$CollectionToArrayRecipe: Prefer calling
Collection#toArray()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionAsListRecipe: Prefer
ImmutableCollection#asList()
over the more verbose alternative. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionContainsRecipe: Don't call
ImmutableCollection#asList()
ifCollection#contains(Object)
is called on the result; call it directly. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionParallelStreamRecipe: Don't call
ImmutableCollection#asList()
ifImmutableCollection#parallelStream()
is called on the result; call it directly. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionStreamRecipe: Don't call
ImmutableCollection#asList()
if the result is going to be streamed; stream directly. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionToArrayWithArrayRecipe: Don't call
ImmutableCollection#asList()
if `ImmutableCollection#toArray(Object[])`` is called on the result; call it directly. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionToArrayWithGeneratorRecipe: Don't call
ImmutableCollection#asList()
ifImmutableCollection#toArray(IntFunction)
} is called on the result; call it directly. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$ImmutableCollectionToStringRecipe: Don't call
ImmutableCollection#asList()
ifImmutableCollection#toString()
is called on the result; call it directly. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$NewArrayListFromCollectionRecipe: Prefer
ArrayList#ArrayList(Collection)
over the Guava alternative. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$OptionalFirstCollectionElementRecipe: Don't use the ternary operator to extract the first element of a possibly-empty
Collection
as anOptional
, and (when applicable) preferStream#findFirst()
overStream#findAny()
to communicate that the collection's first element (if any, according to iteration order) will be returned. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$RemoveOptionalFirstNavigableSetElementRecipe: Avoid contrived constructions when extracting the first element from a possibly empty
NavigableSet
. - tech.picnic.errorprone.refasterrules.CollectionRulesRecipes$SetStreamRecipe: Don't unnecessarily call
Stream#distinct()
on an already-unique stream of elements. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes: Refaster rules related to expressions dealing with
Comparator
s. Source. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CollectionsMaxRecipe: Prefer
Collections#max(Collection)
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CollectionsMaxWithComparatorRecipe: Avoid unnecessary creation of a
Stream
to determine the maximum of a known collection of values. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CollectionsMinRecipe: Prefer
Collections#min(Collection)
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CollectionsMinWithComparatorRecipe: Avoid unnecessary creation of a
Stream
to determine the minimum of a known collection of values. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CollectionsSortRecipe: Prefer
Collections#sort(List)
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$CompareToRecipe: Prefer
Comparable#compareTo(Object)
} over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$IsLessThanOrEqualToRecipe: Don't explicitly compare enums by their ordinal.
- tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$IsLessThanRecipe: Don't explicitly compare enums by their ordinal.
- tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$MaxByNaturalOrderRecipe: Prefer
Comparator#naturalOrder()
overComparator#reverseOrder()
where possible. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$MaxOfArrayRecipe: Avoid unnecessary creation of a
Stream
to determine the maximum of a known collection of values. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$MinByNaturalOrderRecipe: Prefer
Comparator#naturalOrder()
overComparator#reverseOrder()
where possible. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$MinOfArrayRecipe: Avoid unnecessary creation of a
Stream
to determine the minimum of a known collection of values. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ReverseOrderRecipe: Prefer
Comparator#reverseOrder()
over more complicated constructs. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingCustomRecipe: Don't explicitly create
Comparator
s unnecessarily. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingCustomReversedRecipe: Don't explicitly create
Comparator
s unnecessarily. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingDoubleRecipe: Don't explicitly create
Comparator
s unnecessarily. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingIntRecipe: Don't explicitly create
Comparator
s unnecessarily. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingLongRecipe: Don't explicitly create
Comparator
s unnecessarily. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingRecipe: Don't explicitly create
Comparator
s unnecessarily. - tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes$ThenComparingReversedRecipe: Don't explicitly create
Comparator
s unnecessarily. - tech.picnic.errorprone.refasterrules.EqualityRulesRecipes$EnumReferenceEqualityRecipe: Prefer reference-based equality for enums.
- tech.picnic.errorprone.refasterrules.EqualityRulesRecipes$EqualsRecipe: Avoid contrived ways of handling
null
values during equality testing. - tech.picnic.errorprone.refasterrules.EqualityRulesRecipes$ObjectsEqualsRecipe: Avoid contrived ways of handling
null
values during equality testing. - tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes: Refaster rules related to expressions dealing with
com.google.common.collect.ImmutableEnumSet
s. Source. - tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet1Recipe: Prefer
Sets#immutableEnumSet(Enum, Enum[])
for enum collections to take advantage of the internally usedEnumSet
. - tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet2Recipe: Warning: this rule is not completely behavior preserving: while the
ImmutableSet#of
expression produces a set that iterates over its elements in the listed order, the replacement code iterates over the elements in enum definition order. - tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet3Recipe: Warning: this rule is not completely behavior preserving: while the
ImmutableSet#of
expression produces a set that iterates over its elements in the listed order, the replacement code iterates over the elements in enum definition order. - tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet4Recipe: Warning: this rule is not completely behavior preserving: while the
ImmutableSet#of
expression produces a set that iterates over its elements in the listed order, the replacement code iterates over the elements in enum definition order. - tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet5Recipe: Warning: this rule is not completely behavior preserving: while the
ImmutableSet#of
expression produces a set that iterates over its elements in the listed order, the replacement code iterates over the elements in enum definition order. - tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSet6Recipe: Warning: this rule is not completely behavior preserving: while the original code produces a set that iterates over its elements in the listed order, the replacement code iterates over the elements in enum definition order.
- tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSetArraysAsListRecipe: Warning: this rule is not completely behavior preserving: while the original code produces a set that iterates over its elements in the same order as defined in the array, the replacement code iterates over the elements in enum definition order.
- tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$SetsImmutableEnumSetIterableRecipe: Warning: this rule is not completely behavior preserving: while the
original code produces a set that iterates over its elements in the same order as the input
Iterable
, the replacement code iterates over the elements in enum definition order. - tech.picnic.errorprone.refasterrules.ImmutableEnumSetRulesRecipes$StreamToImmutableEnumSetRecipe: Warning: this rule is not completely behavior preserving: while the original code produces a set that iterates over its elements in encounter order, the replacement code iterates over the elements in enum definition order.
- tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes: Refaster rules related to expressions dealing with
ImmutableListMultimap
s. Source. - tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$EmptyImmutableListMultimapRecipe: Prefer
ImmutableListMultimap#of()
over more contrived or less-specific alternatives. - tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$EntryToImmutableListMultimapRecipe: Prefer
ImmutableListMultimap#of(Object, Object)
over more contrived or less-specific alternatives. - tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$ImmutableListMultimapBuilderRecipe: Prefer
ImmutableListMultimap#builder()
over the associated constructor on constructions that produce a less-specific type. - tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$IterableToImmutableListMultimapRecipe: Prefer
ImmutableListMultimap#copyOf(Iterable)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$PairToImmutableListMultimapRecipe: Prefer
ImmutableListMultimap#of(Object, Object)
over more contrived or less-specific alternatives. - tech.picnic.errorprone.refasterrules.ImmutableListMultimapRulesRecipes$TransformMultimapValuesToImmutableListMultimap2Recipe: Prefer creating an immutable copy of the result of
Multimaps#transformValues(Multimap, com.google.common.base.Function)
over creating and directly collecting a stream. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes: Refaster rules related to expressions dealing with
ImmutableList
s. Source. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListBuilderRecipe: Prefer
ImmutableList#builder()
over the associated constructor. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOf1Recipe: Prefer
ImmutableList#of(Object)
over more contrived alternatives or alternatives that don't communicate the immutability of the resulting list at the type level. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOf2Recipe: Prefer
ImmutableList#of(Object, Object)
over alternatives that don't communicate the immutability of the resulting list at the type level. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOf3Recipe: Prefer
ImmutableList#of(Object, Object, Object)
over alternatives that don't communicate the immutability of the resulting list at the type level. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOf4Recipe: Prefer
ImmutableList#of(Object, Object, Object, Object)
over alternatives that don't communicate the immutability of the resulting list at the type level. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOf5Recipe: Prefer
ImmutableList#of(Object, Object, Object, Object, Object)
over alternatives that don't communicate the immutability of the resulting list at the type level. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListOfRecipe: Prefer
ImmutableList#of()
over more contrived alternatives or alternatives that don't communicate the immutability of the resulting list at the type level. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListSortedCopyOfRecipe: Prefer
ImmutableList#sortedCopyOf(Iterable)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$ImmutableListSortedCopyOfWithCustomComparatorRecipe: Prefer
ImmutableList#sortedCopyOf(Comparator, Iterable)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$IterableToImmutableListRecipe: Prefer
ImmutableList#copyOf(Iterable)
and variants over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$StreamToDistinctImmutableListRecipe: Collecting to an
ImmutableSet
and converting the result to anImmutableList
may be more efficient than deduplicating a stream and collecting the result to anImmutableList
. - tech.picnic.errorprone.refasterrules.ImmutableListRulesRecipes$StreamToImmutableListRecipe: Prefer
ImmutableList#toImmutableList()
over less idiomatic alternatives. - tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes: Refaster rules related to expressions dealing with
ImmutableMap
s. Source. - tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$EntryIterableToImmutableMapRecipe: Prefer
ImmutableMap#copyOf(Iterable)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$EntryToImmutableMapRecipe: Prefer
ImmutableMap#of(Object, Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapBuilderBuildOrThrowRecipe: Prefer
ImmutableMap.Builder#buildOrThrow()
over the less explicitImmutableMap.Builder#build()
. - tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapBuilderRecipe: Prefer
ImmutableMap#builder()
over the associated constructor. - tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOf1Recipe: Prefer
ImmutableMap#of(Object, Object)
over more contrived alternatives or alternatives that don't communicate the immutability of the resulting map at the type level. - tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOf2Recipe: Prefer
ImmutableMap#of(Object, Object, Object, Object)
over alternatives that don't communicate the immutability of the resulting map at the type level. - tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOf3Recipe: Prefer
ImmutableMap#of(Object, Object, Object, Object, Object, Object)
over alternatives that don't communicate the immutability of the resulting map at the type level. - tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOf4Recipe: Prefer
ImmutableMap#of(Object, Object, Object, Object, Object, Object, Object, Object)
over alternatives that don't communicate the immutability of the resulting map at the type level. - tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOf5Recipe: Prefer
ImmutableMap#of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
over alternatives that don't communicate the immutability of the resulting map at the type level. - tech.picnic.errorprone.refasterrules.ImmutableMapRulesRecipes$ImmutableMapOfRecipe: Prefer
ImmutableMap#of()
over more contrived alternatives or alternatives that don't communicate the immutability of the resulting map at the type level. - tech.picnic.errorprone.refasterrules.ImmutableMultisetRulesRecipes: Refaster rules related to expressions dealing with
ImmutableMultiset
s. Source. - tech.picnic.errorprone.refasterrules.ImmutableMultisetRulesRecipes$EmptyImmutableMultisetRecipe: Prefer
ImmutableMultiset#of()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableMultisetRulesRecipes$ImmutableMultisetBuilderRecipe: Prefer
ImmutableMultiset#builder()
over the associated constructor. - tech.picnic.errorprone.refasterrules.ImmutableMultisetRulesRecipes$IterableToImmutableMultisetRecipe: Prefer
ImmutableMultiset#copyOf(Iterable)
and variants over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableMultisetRulesRecipes$StreamToImmutableMultisetRecipe: Prefer
ImmutableMultiset#toImmutableMultiset()
over less idiomatic alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes: Refaster rules related to expressions dealing with
ImmutableSetMultimap
s. Source. - tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$EmptyImmutableSetMultimapRecipe: Prefer
ImmutableSetMultimap#of()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$EntryToImmutableSetMultimapRecipe: Prefer
ImmutableSetMultimap#of(Object, Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$ImmutableSetMultimapBuilderRecipe: Prefer
ImmutableSetMultimap#builder()
over the associated constructor. - tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$IterableToImmutableSetMultimapRecipe: Prefer
ImmutableSetMultimap#copyOf(Iterable)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$PairToImmutableSetMultimapRecipe: Prefer
ImmutableSetMultimap#of(Object, Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetMultimapRulesRecipes$TransformMultimapValuesToImmutableSetMultimap2Recipe: Prefer creating an immutable copy of the result of
Multimaps#transformValues(Multimap, com.google.common.base.Function)
over creating and directly collecting a stream. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes: Refaster rules related to expressions dealing with
ImmutableSet
s. Source. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetBuilderRecipe: Prefer
ImmutableSet#builder()
over the associated constructor. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetCopyOfSetViewRecipe: Prefer
SetView#immutableCopy()
over the more verbose alternative. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOf1Recipe: Prefer
ImmutableSet#of(Object)
over more contrived alternatives or alternatives that don't communicate the immutability of the resulting set at the type level. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOf2Recipe: Prefer
ImmutableSet#of(Object, Object)
over alternatives that don't communicate the immutability of the resulting set at the type level. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOf3Recipe: Prefer
ImmutableSet#of(Object, Object, Object)
over alternatives that don't communicate the immutability of the resulting set at the type level. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOf4Recipe: Prefer
ImmutableSet#of(Object, Object, Object, Object)
over alternatives that don't communicate the immutability of the resulting set at the type level. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOf5Recipe: Prefer
ImmutableSet#of(Object, Object, Object, Object, Object)
over alternatives that don't communicate the immutability of the resulting set at the type level. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$ImmutableSetOfRecipe: Prefer
ImmutableSet#of()
over more contrived alternatives or alternatives that don't communicate the immutability of the resulting set at the type level. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$IterableToImmutableSetRecipe: Prefer
ImmutableSet#copyOf(Iterable)
and variants over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsDifferenceMapRecipe: Prefer an immutable copy of
Sets#difference(Set, Set)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsDifferenceMultimapRecipe: Prefer an immutable copy of
Sets#difference(Set, Set)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsDifferenceRecipe: Prefer an immutable copy of
Sets#difference(Set, Set)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsIntersectionMapRecipe: Prefer an immutable copy of
Sets#intersection(Set, Set)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsIntersectionMultimapRecipe: Prefer an immutable copy of
Sets#intersection(Set, Set)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsIntersectionRecipe: Prefer an immutable copy of
Sets#intersection(Set, Set)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$SetsUnionRecipe: Prefer an immutable copy of
Sets#union(Set, Set)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSetRulesRecipes$StreamToImmutableSetRecipe: Prefer
ImmutableSet#toImmutableSet()
over less idiomatic alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes: Refaster rules related to expressions dealing with
ImmutableSortedMap
s. Source. - tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$EmptyImmutableSortedMapRecipe: Prefer
ImmutableSortedMap#of()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$EntryToImmutableSortedMapRecipe: Prefer
ImmutableSortedMap#of(Object, Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$ImmutableSortedMapBuilderRecipe: Prefer
ImmutableSortedMap#orderedBy(Comparator)
over the associated constructor. - tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$ImmutableSortedMapNaturalOrderBuilderRecipe: Prefer
ImmutableSortedMap#naturalOrder()
over the alternative that requires explicitly providing theComparator
. - tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$ImmutableSortedMapReverseOrderBuilderRecipe: Prefer
ImmutableSortedMap#reverseOrder()
over the alternative that requires explicitly providing theComparator
. - tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$IterableToImmutableSortedMapRecipe: Prefer
ImmutableSortedMap#copyOf(Iterable)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSortedMapRulesRecipes$PairToImmutableSortedMapRecipe: Prefer
ImmutableSortedMap#of(Object, Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes: Refaster rules related to expressions dealing with
ImmutableSortedMultiset
s. Source. - tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$EmptyImmutableSortedMultisetRecipe: Prefer
ImmutableSortedMultiset#of()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$ImmutableSortedMultisetBuilderRecipe: Prefer
ImmutableSortedMultiset#orderedBy(Comparator)
over the associated constructor. - tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$ImmutableSortedMultisetNaturalOrderBuilderRecipe: Prefer
ImmutableSortedMultiset#naturalOrder()
over the alternative that requires explicitly providing theComparator
. - tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$ImmutableSortedMultisetReverseOrderBuilderRecipe: Prefer
ImmutableSortedMultiset#reverseOrder()
over the alternative that requires explicitly providing theComparator
. - tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$IterableToImmutableSortedMultisetRecipe: Prefer
ImmutableSortedMultiset#copyOf(Iterable)
and variants over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSortedMultisetRulesRecipes$StreamToImmutableSortedMultisetRecipe: Prefer
ImmutableSortedMultiset#toImmutableSortedMultiset(Comparator)
over less idiomatic alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes: Refaster rules related to expressions dealing with
ImmutableSortedSet
s. Source. - tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$EmptyImmutableSortedSetRecipe: Prefer
ImmutableSortedSet#of()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$ImmutableSortedSetBuilderRecipe: Prefer
ImmutableSortedSet#orderedBy(Comparator)
over the associated constructor. - tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$ImmutableSortedSetNaturalOrderBuilderRecipe: Prefer
ImmutableSortedSet#naturalOrder()
over the alternative that requires explicitly providing theComparator
. - tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$ImmutableSortedSetReverseOrderBuilderRecipe: Prefer
ImmutableSortedSet#reverseOrder()
over the alternative that requires explicitly providing theComparator
. - tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$IterableToImmutableSortedSetRecipe: Prefer
ImmutableSortedSet#copyOf(Iterable)
and variants over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableSortedSetRulesRecipes$StreamToImmutableSortedSetRecipe: Prefer
ImmutableSortedSet#toImmutableSortedSet(Comparator)
over less idiomatic alternatives. - tech.picnic.errorprone.refasterrules.ImmutableTableRulesRecipes: Refaster rules related to expressions dealing with
ImmutableTable
s. Source. - tech.picnic.errorprone.refasterrules.ImmutableTableRulesRecipes$CellToImmutableTableRecipe: Prefer
ImmutableTable#of(Object, Object, Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ImmutableTableRulesRecipes$ImmutableTableBuilderBuildOrThrowRecipe: Prefer
ImmutableTable.Builder#buildOrThrow()
over the less explicitImmutableTable.Builder#build()
. - tech.picnic.errorprone.refasterrules.ImmutableTableRulesRecipes$ImmutableTableBuilderRecipe: Prefer
ImmutableTable#builder()
over the associated constructor. - tech.picnic.errorprone.refasterrules.ImmutableTableRulesRecipes$ImmutableTableOfRecipe: Prefer
ImmutableTable#of()
over more contrived alternatives . - tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatIsInstanceOf<T> {
@BeforeTemplate
void before(Object actual, Class<T> clazz) {
assertInstanceOf(clazz, actual);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Object actual, Class<T> clazz) {
assertThat(actual).isInstanceOf(clazz);
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByIsExactlyInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByIsExactlyInstanceOf<T extends Throwable> {
@BeforeTemplate
void before(Executable throwingCallable, Class<T> clazz) {
assertThrowsExactly(clazz, throwingCallable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, Class<T> clazz) {
assertThatThrownBy(throwingCallable).isExactlyInstanceOf(clazz);
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByIsInstanceOf<T extends Throwable> {
@BeforeTemplate
void before(Executable throwingCallable, Class<T> clazz) {
assertThrows(clazz, throwingCallable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, Class<T> clazz) {
assertThatThrownBy(throwingCallable).isInstanceOf(clazz);
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByWithFailMessageStringIsExactlyInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByWithFailMessageStringIsExactlyInstanceOf<T extends Throwable> {
@BeforeTemplate
void before(Executable throwingCallable, String message, Class<T> clazz) {
assertThrowsExactly(clazz, throwingCallable, message);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, String message, Class<T> clazz) {
assertThatThrownBy(throwingCallable).withFailMessage(message).isExactlyInstanceOf(clazz);
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByWithFailMessageStringIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByWithFailMessageStringIsInstanceOf<T extends Throwable> {
@BeforeTemplate
void before(Executable throwingCallable, String message, Class<T> clazz) {
assertThrows(clazz, throwingCallable, message);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, String message, Class<T> clazz) {
assertThatThrownBy(throwingCallable).withFailMessage(message).isInstanceOf(clazz);
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByWithFailMessageSupplierIsExactlyInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByWithFailMessageSupplierIsExactlyInstanceOf<T extends Throwable> {
@BeforeTemplate
void before(Executable throwingCallable, Supplier<String> supplier, Class<T> clazz) {
assertThrowsExactly(clazz, throwingCallable, supplier);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, Supplier<String> supplier, Class<T> clazz) {
assertThatThrownBy(throwingCallable).withFailMessage(supplier).isExactlyInstanceOf(clazz);
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatThrownByWithFailMessageSupplierIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatThrownByWithFailMessageSupplierIsInstanceOf<T extends Throwable> {
@BeforeTemplate
void before(Executable throwingCallable, Supplier<String> supplier, Class<T> clazz) {
assertThrows(clazz, throwingCallable, supplier);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable throwingCallable, Supplier<String> supplier, Class<T> clazz) {
assertThatThrownBy(throwingCallable).withFailMessage(supplier).isInstanceOf(clazz);
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatWithFailMessageStringIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatWithFailMessageStringIsInstanceOf<T> {
@BeforeTemplate
void before(Object actual, String message, Class<T> clazz) {
assertInstanceOf(clazz, actual, message);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Object actual, String message, Class<T> clazz) {
assertThat(actual).withFailMessage(message).isInstanceOf(clazz);
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$AssertThatWithFailMessageSupplierIsInstanceOfRecipe: Recipe created for the following Refaster template:
static final class AssertThatWithFailMessageSupplierIsInstanceOf<T> {
@BeforeTemplate
void before(Object actual, Supplier<String> supplier, Class<T> clazz) {
assertInstanceOf(clazz, actual, supplier);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Object actual, Supplier<String> supplier, Class<T> clazz) {
assertThat(actual).withFailMessage(supplier).isInstanceOf(clazz);
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$FailRecipe: Recipe created for the following Refaster template:
static final class Fail<T> {
@BeforeTemplate
T before() {
return Assertions.fail();
}
@AfterTemplate
@DoNotCall
T after() {
return fail();
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$FailWithMessageAndThrowableRecipe: Recipe created for the following Refaster template:
static final class FailWithMessageAndThrowable<T> {
@BeforeTemplate
T before(String message, Throwable throwable) {
return Assertions.fail(message, throwable);
}
@AfterTemplate
T after(String message, Throwable throwable) {
return fail(message, throwable);
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$FailWithMessageRecipe: Recipe created for the following Refaster template:
static final class FailWithMessage<T> {
@BeforeTemplate
T before(String message) {
return Assertions.fail(message);
}
@AfterTemplate
T after(String message) {
return fail(message);
}
}
.
- tech.picnic.errorprone.refasterrules.JUnitToAssertJRulesRecipes$FailWithThrowableRecipe: Recipe created for the following Refaster template:
static final class FailWithThrowable<T> {
@BeforeTemplate
T before(Throwable throwable) {
return Assertions.fail(throwable);
}
@AfterTemplate
@DoNotCall
T after(Throwable throwable) {
return fail(throwable);
}
}
.
- tech.picnic.errorprone.refasterrules.MapEntryRulesRecipes: Refaster rules related to expressions dealing with
Map.Entry
instances. Source. - tech.picnic.errorprone.refasterrules.MapEntryRulesRecipes$MapEntryComparingByKeyRecipe: Prefer
Map.Entry#comparingByKey()
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.MapEntryRulesRecipes$MapEntryComparingByKeyWithCustomComparatorRecipe: Prefer
Map.Entry#comparingByKey(Comparator)
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.MapEntryRulesRecipes$MapEntryComparingByValueRecipe: Prefer
Map.Entry#comparingByValue()
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.MapEntryRulesRecipes$MapEntryComparingByValueWithCustomComparatorRecipe: Prefer
Map.Entry#comparingByValue(Comparator)
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.MapEntryRulesRecipes$MapEntryRecipe: Warning: while both
Maps#immutableEntry(Object, Object)
andAbstractMap.SimpleImmutableEntry
allownull
keys and values, the preferred @link Map#entry(Object, Object)} variant does not. Moreover, theMap.Entry
instances produced by the former approaches isjava.io.Serializable
, while this does not hold for the object returned by the preferred approach. - tech.picnic.errorprone.refasterrules.MapRulesRecipes: Refaster rules related to expressions dealing with
Map
instances. Source. - tech.picnic.errorprone.refasterrules.MapRulesRecipes$MapContainsKeyRecipe: Prefer
Map#containsKey(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.MapRulesRecipes$MapContainsValueRecipe: Prefer
Map#containsValue(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.MapRulesRecipes$MapGetOrDefaultRecipe: Prefer
Map#getOrDefault(Object, Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.MapRulesRecipes$MapGetOrNullRecipe: Recipe created for the following Refaster template:
static final class MapGetOrNull<K, V, T> {
@BeforeTemplate
@Nullable
V before(Map<K, V> map, T key) {
return map.getOrDefault(key, null);
}
@AfterTemplate
@Nullable
V after(Map<K, V> map, T key) {
return map.get(key);
}
}
.
- tech.picnic.errorprone.refasterrules.MapRulesRecipes$MapIsEmptyRecipe: Prefer
Map#isEmpty()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.MapRulesRecipes$MapKeyStreamRecipe: Don't unnecessarily use
Map#entrySet()
. - tech.picnic.errorprone.refasterrules.MapRulesRecipes$MapSizeRecipe: Prefer
Map#size()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.MapRulesRecipes$MapValueStreamRecipe: Don't unnecessarily use
Map#entrySet()
. - tech.picnic.errorprone.refasterrules.MockitoRulesRecipes$VerifyOnceRecipe: Prefer
Mockito#verify(Object)
over explicitly specifying that the associated invocation must happen precisely once; this is the default behavior. - tech.picnic.errorprone.refasterrules.MultimapRulesRecipes: Refaster rules related to expressions dealing with
Multimap
s. Source. - tech.picnic.errorprone.refasterrules.MultimapRulesRecipes$MultimapContainsKeyRecipe: Prefer
Multimap#containsKey(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.MultimapRulesRecipes$MultimapContainsValueRecipe: Prefer
Multimap#containsValue(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.MultimapRulesRecipes$MultimapGetRecipe: Warning: this rewrite rule is not completely behavior preserving: the
original code will yield
null
for unknown keys, while the replacement code will return an empty collection for unknown keys. - tech.picnic.errorprone.refasterrules.MultimapRulesRecipes$MultimapIsEmptyRecipe: Prefer
Multimap#isEmpty()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.MultimapRulesRecipes$MultimapKeySetRecipe: Prefer
Multimap#keySet()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.MultimapRulesRecipes$MultimapKeysStreamRecipe: Don't unnecessarily use
Multimap#entries()
. - tech.picnic.errorprone.refasterrules.MultimapRulesRecipes$MultimapSizeRecipe: Prefer
Multimap#size()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.MultimapRulesRecipes$MultimapValuesStreamRecipe: Don't unnecessarily use
Multimap#entries()
. - tech.picnic.errorprone.refasterrules.NullRulesRecipes$RequireNonNullElseGetRecipe: Prefer
Objects#requireNonNullElseGet(Object, Supplier)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.NullRulesRecipes$RequireNonNullElseRecipe: Prefer
Objects#requireNonNullElse(Object, Object)
over non-JDK or more contrived alternatives. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes: Refaster rules related to expressions dealing with
Optional
s. Source. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$MapOptionalToBooleanRecipe: Prefer
Optional#filter(Predicate)
overOptional#map(Function)
when converting anOptional
to a boolean. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OptionalEmptyRecipe: Prefer
Optional#empty()
over the more contrived alternative. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OptionalEqualsOptionalRecipe: Prefer
Optional#equals(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OptionalFilterRecipe: Avoid unnecessary
Optional
toStream
conversion when filtering a value of the former type. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OptionalFirstIteratorElementRecipe: Don't use the ternary operator to extract the first element of a possibly-empty
Iterator
as anOptional
. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OptionalIsEmptyRecipe: Prefer
Optional#isEmpty()
over the more verbose alternative. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OptionalIsPresentRecipe: Prefer
Optional#isPresent()
over the inverted alternative. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OptionalMapRecipe: Avoid unnecessary
Optional
toStream
conversion when mapping a value of the former type. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OptionalOfNullableRecipe: Recipe created for the following Refaster template:
static final class OptionalOfNullable<T> {
@BeforeTemplate
@SuppressWarnings(value = "TernaryOperatorOptionalNegativeFiltering")
Optional<T> before(@Nullable
T object) {
return object == null ? Optional.empty() : Optional.of(object);
}
@AfterTemplate
Optional<T> after(T object) {
return Optional.ofNullable(object);
}
}
.
- tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OptionalOrElseThrowRecipe: Prefer
Optional#orElseThrow()
over the less explicitOptional#get()
. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OptionalOrOtherOptionalRecipe: Prefer
Optional#or(Supplier)
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OptionalStreamRecipe: Prefer
Optional#stream()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$OrOrElseThrowRecipe: Recipe created for the following Refaster template:
static final class OrOrElseThrow<T> {
@BeforeTemplate
@SuppressWarnings(value = "NullAway")
T before(Optional<T> o1, Optional<T> o2) {
return o1.orElseGet(()->o2.orElseThrow());
}
@AfterTemplate
@SuppressWarnings(value = "NullAway")
T after(Optional<T> o1, Optional<T> o2) {
return o1.or(()->o2).orElseThrow();
}
}
.
- tech.picnic.errorprone.refasterrules.OptionalRulesRecipes$StreamFlatMapOptionalRecipe: Flatten a stream of
Optional
s usingOptional#stream()
, rather than using one of the more verbose alternatives. - tech.picnic.errorprone.refasterrules.PreconditionsRulesRecipes: Refaster templates related to statements dealing with
Preconditions
. Source. - tech.picnic.errorprone.refasterrules.PreconditionsRulesRecipes$RequireNonNullRecipe: Prefer
Objects#requireNonNull(Object)
over non-JDK alternatives. - tech.picnic.errorprone.refasterrules.PreconditionsRulesRecipes$RequireNonNullWithMessageRecipe: Prefer
Objects#requireNonNull(Object, String)
over non-JDK alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$ConcatMapIterableIdentityRecipe: Prefer
Flux#concatMapIterable(Function)
over alternatives that require an additional subscription. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$ConcatMapIterableIdentityWithPrefetchRecipe: Prefer
Flux#concatMapIterable(Function, int)
over alternatives that require an additional subscription. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxAsStepVerifierExpectNextRecipe: Avoid list collection when verifying that a
Flux
emits exactly one value. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxCollectToImmutableListRecipe: Prefer
Flux#collect(Collector)
withImmutableList#toImmutableList()
over alternatives that do not explicitly return an immutable collection. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxCollectToImmutableSetRecipe: Prefer
Flux#collect(Collector)
withImmutableSet#toImmutableSet()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxDefaultIfEmptyRecipe: Prefer
Flux#defaultIfEmpty(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxDeferredErrorRecipe: Don't unnecessarily defer
Flux#error(Throwable)
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxDoOnErrorRecipe: Prefer
Flux#doOnError(Class, Consumer)
overFlux#doOnError(Predicate, Consumer)
where possible. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxEmptyRecipe: Prefer
Flux#empty()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxErrorSupplierRecipe: Don't unnecessarily pass
Flux#error(Supplier)
a method reference or lambda expression. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxFilterSortRecipe: Apply
Flux#filter(Predicate)
beforeFlux#sort()
to reduce the number of elements to sort. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxFilterSortWithComparatorRecipe: Apply
Flux#filter(Predicate)
beforeFlux#sort(Comparator)
to reduce the number of elements to sort. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxFromIterableRecipe: Prefer
Flux#fromIterable(Iterable)
over less efficient alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxFromStreamSupplierRecipe: Prefer
Flux#fromStream(Supplier)
overFlux#fromStream(Stream)
, as the former yields aFlux
that is more likely to behave as expected when subscribed to more than once. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxJustRecipe: Prefer
Flux#just(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxMapNotNullOrElseRecipe: Prefer
Flux#mapNotNull(Function)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxOfTypeRecipe: Prefer
Flux#ofType(Class)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxOnErrorCompletePredicateRecipe: Prefer
Flux#onErrorComplete(Predicate)
} over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxOnErrorCompleteRecipe: Prefer
Flux#onErrorComplete()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxOnErrorContinueRecipe: Prefer
Flux#onErrorContinue(Class, BiConsumer)
overFlux#onErrorContinue(Predicate, BiConsumer)
where possible. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxOnErrorMapRecipe: Prefer
Flux#onErrorMap(Class, Function)
overFlux#onErrorMap(Predicate, Function)
where possible. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxOnErrorResumeRecipe: Prefer
Flux#onErrorResume(Class, Function)
overFlux#onErrorResume(Predicate, Function)
where possible. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxOnErrorReturnRecipe: Prefer
Flux#onErrorReturn(Class, Object)
overFlux#onErrorReturn(Predicate, Object)
where possible. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxSortRecipe: Prefer
Flux#sort()
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxSwitchIfEmptyOfEmptyPublisherRecipe: Don't unnecessarily pass an empty publisher to
Flux#switchIfEmpty(Publisher)
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxTakeRecipe: In Reactor versions prior to 3.5.0,
Flux#take(long)
makes an unbounded request upstream, and is equivalent toFlux#take(long, false)
. From version 3.5.0 onwards, the behavior ofFlux#take(long)
instead matchesFlux#take(long, true)
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxTakeWhileRecipe: Do not unnecessarily
Flux#filter(Predicate) filter
the result ofFlux#takeWhile(Predicate)
using the samePredicate
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxThenEmptyRecipe: Avoid vacuous invocations of
Flux#ignoreElements()
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxThenManyRecipe: Avoid vacuous invocations of
Flux#ignoreElements()
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxThenMonoRecipe: Avoid vacuous invocations of
Flux#ignoreElements()
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxThenRecipe: Avoid vacuous invocations of
Flux#ignoreElements()
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxTransformMaxRecipe: Prefer
MathFlux#max(Publisher)
over less efficient alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxTransformMaxWithComparatorRecipe: Prefer
MathFlux#max(Publisher, Comparator)
over less efficient or more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxTransformMinRecipe: Prefer
MathFlux#min(Publisher)
over less efficient alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxTransformMinWithComparatorRecipe: Prefer
MathFlux#min(Publisher, Comparator)
over less efficient or more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxZipRecipe: Prefer
Flux#zip(Publisher, Publisher)
over a chainedFlux#zipWith(Publisher)
, as the former better conveys that thePublisher
s may be subscribed to concurrently, and generalizes to combining three or more reactive streams. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxZipWithCombinatorRecipe: Prefer
Flux#zip(Publisher, Publisher)
with a chained combinator over a chainedFlux#zipWith(Publisher, BiFunction)
, as the former better conveys that thePublisher
s may be subscribed to concurrently, and generalizes to combining three or more reactive streams. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxZipWithIterableBiFunctionRecipe: Prefer
Flux#zipWithIterable(Iterable, BiFunction)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxZipWithIterableMapFunctionRecipe: Prefer
Flux#zipWithIterable(Iterable)
with a chained combinator overFlux#zipWithIterable(Iterable, BiFunction)
, as the former generally yields more readable code. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$FluxZipWithIterableRecipe: Prefer
Flux#zipWithIterable(Iterable)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MathFluxMaxRecipe: Prefer
MathFlux#max(Publisher)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MathFluxMinRecipe: Prefer
MathFlux#min(Publisher)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoDefaultIfEmptyRecipe: Prefer
Mono#defaultIfEmpty(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoDeferMonoJustOrEmptyRecipe: Prefer
Mono#defer(Supplier) deferring
Mono#justOrEmpty(Optional)
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoDeferredErrorRecipe: Don't unnecessarily defer
Mono#error(Throwable)
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoDoOnErrorRecipe: Prefer
Mono#doOnError(Class, Consumer)
overMono#doOnError(Predicate, Consumer)
where possible. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoEmptyRecipe: Prefer
Mono#empty()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoErrorSupplierRecipe: Don't unnecessarily pass
Mono#error(Supplier)
a method reference or lambda expression. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoFlatMapIterableIdentityRecipe: Prefer
Mono#flatMapIterable(Function)
to flatten aMono
of someIterable
over less efficient alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoFluxRecipe: Prefer
Mono#flux()
} over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoFromFutureAsyncLoadingCacheGetAllRecipe: Don't propagate
Mono
cancellations to upstream cache value computations, as completion of such computations may benefit concurrent or subsequent cache usages. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoFromFutureAsyncLoadingCacheGetRecipe: Don't propagate
Mono
cancellations to an upstream cache value computation, as completion of such computations may benefit concurrent or subsequent cache usages. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoFromFutureSupplierBooleanRecipe: Prefer
Mono#fromFuture(Supplier, boolean)
overMono#fromFuture(CompletableFuture, boolean)
, as the former may defer initiation of the asynchronous computation until subscription. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoFromFutureSupplierRecipe: Prefer
Mono#fromFuture(Supplier)
overMono#fromFuture(CompletableFuture)
, as the former may defer initiation of the asynchronous computation until subscription. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoFromOptionalSwitchIfEmptyRecipe: In particular, avoid mixing of the
Optional
andMono
APIs. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoIdentityRecipe: Don't unnecessarily transform a
Mono
to an equivalent instance. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoJustOrEmptyObjectRecipe: Prefer
Mono#justOrEmpty(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoJustOrEmptyOptionalRecipe: Prefer
Mono#justOrEmpty(Optional)
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoJustRecipe: Prefer
Mono#just(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoOfTypeRecipe: Prefer
Mono#ofType(Class)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoOnErrorCompleteClassRecipe: Prefer
Mono#onErrorComplete(Class)
} over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoOnErrorCompletePredicateRecipe: Prefer
Mono#onErrorComplete(Predicate)
} over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoOnErrorCompleteRecipe: Prefer
Mono#onErrorComplete()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoOnErrorContinueRecipe: Prefer
Mono#onErrorContinue(Class, BiConsumer)
overMono#onErrorContinue(Predicate, BiConsumer)
where possible. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoOnErrorMapRecipe: Prefer
Mono#onErrorMap(Class, Function)
overMono#onErrorMap(Predicate, Function)
where possible. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoOnErrorResumeRecipe: Prefer
Mono#onErrorResume(Class, Function)
overMono#onErrorResume(Predicate, Function)
where possible. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoOnErrorReturnRecipe: Prefer
Mono#onErrorReturn(Class, Object)
overMono#onErrorReturn(Predicate, Object)
where possible. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoSingleOptionalRecipe: Prefer
Mono#singleOptional()
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoSingleRecipe: Don't unnecessarily transform a
Mono
to aFlux
to expect exactly one item. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoThenEmptyRecipe: Avoid vacuous invocations of
Mono#ignoreElement()
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoThenManyRecipe: Avoid vacuous operations prior to invocation of
Mono#thenMany(Publisher)
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoThenMonoFluxRecipe: Prefer explicit invocation of
Mono#flux()
over implicit conversions fromMono
toFlux
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoThenMonoRecipe: Avoid vacuous operations prior to invocation of
Mono#then(Mono)
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoThenRecipe: Prefer direct invocation of
Mono#then()
} over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoThenReturnRecipe: Prefer
Mono#thenReturn(Object)
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoZipRecipe: Prefer
Mono#zip(Mono, Mono)
over a chainedMono#zipWith(Mono)
, as the former better conveys that theMono
s may be subscribed to concurrently, and generalizes to combining three or more reactive streams. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$MonoZipWithCombinatorRecipe: Prefer
Mono#zip(Mono, Mono)
with a chained combinator over a chainedMono#zipWith(Mono, BiFunction)
, as the former better conveys that theMono
s may be subscribed to concurrently, and generalizes to combining three or more reactive streams. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$OptionalMapMonoJustRecipe: Try to avoid expressions of type
Optional<Mono<T>>
, but if you must map anOptional
to this type, prefer usingMono#just(Object)
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$PublisherProbeAssertWasCancelledRecipe: Prefer
PublisherProbe#assertWasCancelled()
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$PublisherProbeAssertWasNotCancelledRecipe: Prefer
PublisherProbe#assertWasNotCancelled()
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$PublisherProbeAssertWasNotRequestedRecipe: Prefer
PublisherProbe#assertWasNotRequested()
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$PublisherProbeAssertWasNotSubscribedRecipe: Prefer
PublisherProbe#assertWasNotSubscribed()
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$PublisherProbeAssertWasRequestedRecipe: Prefer
PublisherProbe#assertWasRequested()
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$PublisherProbeAssertWasSubscribedRecipe: Prefer
PublisherProbe#assertWasSubscribed()
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$PublisherProbeEmptyRecipe: Prefer
PublisherProbe#empty()
} over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$StepVerifierFromFluxRecipe: Prefer
Flux#as(Function)
when creating aStepVerifier
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$StepVerifierFromMonoRecipe: Prefer
Mono#as(Function)
when creating aStepVerifier
. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$StepVerifierLastStepVerifyErrorClassRecipe: Prefer
StepVerifier.LastStep#verifyError(Class)
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$StepVerifierLastStepVerifyErrorSatisfiesAssertJRecipe: Prefer
StepVerifier.LastStep#verifyErrorSatisfies(Consumer)
with AssertJ over more contrived alternatives. - tech.picnic.errorprone.refasterrules.ReactorRulesRecipes$StepVerifierStepExpectNextRecipe: Prefer
StepVerifier.Step#expectNext(Object)
over more verbose alternatives. - tech.picnic.errorprone.refasterrules.RxJava2AdapterRulesRecipes$FlowableToFluxRecipe: Use
RxJava2Adapter#flowableToFlux
to convert aFlowable
to aFlux
, and do so using the fluent API style. - tech.picnic.errorprone.refasterrules.RxJava2AdapterRulesRecipes$FluxToFlowableRecipe: Use
RxJava2Adapter#fluxToFlowable
to convert aFlux
to aFlowable
, and do so using the fluent API style. - tech.picnic.errorprone.refasterrules.RxJava2AdapterRulesRecipes$FluxToObservableRecipe: Use
RxJava2Adapter#fluxToObservable
to convert aFlux
to aObservable
, and do so using the fluent API style. - tech.picnic.errorprone.refasterrules.RxJava2AdapterRulesRecipes$MaybeToMonoRecipe: Use the fluent API style when using
RxJava2Adapter#maybeToMono
. - tech.picnic.errorprone.refasterrules.RxJava2AdapterRulesRecipes$MonoToCompletableRecipe: Use
RxJava2Adapter#monoToCompletable
to convert aMono
to aCompletable
, and do so using the fluent API style. - tech.picnic.errorprone.refasterrules.RxJava2AdapterRulesRecipes$MonoToFlowableRecipe: Use
RxJava2Adapter#monoToFlowable
to convert aMono
to aFlowable
, and do so using the fluent API style. - tech.picnic.errorprone.refasterrules.RxJava2AdapterRulesRecipes$MonoToMaybeRecipe: Use the fluent API style when using
RxJava2Adapter#monoToMaybe
. - tech.picnic.errorprone.refasterrules.RxJava2AdapterRulesRecipes$MonoToSingleRecipe: Use
RxJava2Adapter#monoToSingle
to convert aMono
to aSingle
, and do so using the fluent API style. - tech.picnic.errorprone.refasterrules.RxJava2AdapterRulesRecipes$ObservableToFluxRecipe: Use the fluent API style when using
RxJava2Adapter#observableToFlux
. - tech.picnic.errorprone.refasterrules.RxJava2AdapterRulesRecipes$SingleToMonoRecipe: Use the fluent API style when using
RxJava2Adapter#singleToMono
. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$ConcatOneStreamRecipe: Don't unnecessarily call
Streams#concat(Stream...)
. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$ConcatTwoStreamsRecipe: Prefer
Stream#concat(Stream, Stream)
over the Guava alternative. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$EmptyStreamRecipe: Prefer
Stream#empty()
over less clear alternatives. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamCountRecipe: Recipe created for the following Refaster template:
static final class StreamCount<T> {
@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
long before(Stream<T> stream) {
return stream.collect(counting());
}
@AfterTemplate
long after(Stream<T> stream) {
return stream.count();
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamFilterCollectRecipe: Recipe created for the following Refaster template:
static final class StreamFilterCollect<T, R> {
@BeforeTemplate
R before(Stream<T> stream, Predicate<? super T> predicate, Collector<? super T, ?, R> collector) {
return stream.collect(filtering(predicate, collector));
}
@AfterTemplate
R after(Stream<T> stream, Predicate<? super T> predicate, Collector<? super T, ?, R> collector) {
return stream.filter(predicate).collect(collector);
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamFilterSortedRecipe: Apply
Stream#filter(Predicate)
beforeStream#sorted()
to reduce the number of elements to sort. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamFilterSortedWithComparatorRecipe: Apply
Stream#filter(Predicate)
beforeStream#sorted(Comparator)
to reduce the number of elements to sort. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamFindAnyIsEmptyRecipe: In order to test whether a stream has any element, simply try to find one.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamFindAnyIsPresentRecipe: Prefer
Stream#findAny()
overStream#findFirst()
if one only cares whether the stream is nonempty. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamFlatMapCollectRecipe: Recipe created for the following Refaster template:
static final class StreamFlatMapCollect<T, U, R> {
@BeforeTemplate
R before(Stream<T> stream, Function<? super T, ? extends Stream<? extends U>> mapper, Collector<? super U, ?, R> collector) {
return stream.collect(flatMapping(mapper, collector));
}
@AfterTemplate
R after(Stream<T> stream, Function<? super T, ? extends Stream<? extends U>> mapper, Collector<? super U, ?, R> collector) {
return stream.flatMap(mapper).collect(collector);
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamIterateRecipe: Prefer
Stream#iterate(Object, Predicate, UnaryOperator)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMapCollectRecipe: Recipe created for the following Refaster template:
static final class StreamMapCollect<T, U, R> {
@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
R before(Stream<T> stream, Function<? super T, ? extends U> mapper, Collector<? super U, ?, R> collector) {
return stream.collect(mapping(mapper, collector));
}
@AfterTemplate
R after(Stream<T> stream, Function<? super T, ? extends U> mapper, Collector<? super U, ?, R> collector) {
return stream.map(mapper).collect(collector);
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMapFilterRecipe: Prefer an unconditional
Map#get(Object)
call followed by anull
check over a call toMap#containsKey(Object)
, as the former avoids a second lookup operation. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMapFirstRecipe: Where possible, clarify that a mapping operation will be applied only to a single stream element.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMapToDoubleSummaryStatisticsRecipe: Recipe created for the following Refaster template:
static final class StreamMapToDoubleSummaryStatistics<T> {
@BeforeTemplate
DoubleSummaryStatistics before(Stream<T> stream, ToDoubleFunction<T> mapper) {
return stream.collect(summarizingDouble(mapper));
}
@AfterTemplate
DoubleSummaryStatistics after(Stream<T> stream, ToDoubleFunction<T> mapper) {
return stream.mapToDouble(mapper).summaryStatistics();
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMapToIntSummaryStatisticsRecipe: Recipe created for the following Refaster template:
static final class StreamMapToIntSummaryStatistics<T> {
@BeforeTemplate
IntSummaryStatistics before(Stream<T> stream, ToIntFunction<T> mapper) {
return stream.collect(summarizingInt(mapper));
}
@AfterTemplate
IntSummaryStatistics after(Stream<T> stream, ToIntFunction<T> mapper) {
return stream.mapToInt(mapper).summaryStatistics();
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMapToLongSummaryStatisticsRecipe: Recipe created for the following Refaster template:
static final class StreamMapToLongSummaryStatistics<T> {
@BeforeTemplate
LongSummaryStatistics before(Stream<T> stream, ToLongFunction<T> mapper) {
return stream.collect(summarizingLong(mapper));
}
@AfterTemplate
LongSummaryStatistics after(Stream<T> stream, ToLongFunction<T> mapper) {
return stream.mapToLong(mapper).summaryStatistics();
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMaxNaturalOrderRecipe: Recipe created for the following Refaster template:
static final class StreamMaxNaturalOrder<T extends Comparable<? super T>> {
@BeforeTemplate
Optional<T> before(Stream<T> stream) {
return Refaster.anyOf(stream.min(reverseOrder()), Streams.findLast(stream.sorted()));
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
Optional<T> after(Stream<T> stream) {
return stream.max(naturalOrder());
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMaxRecipe: Recipe created for the following Refaster template:
static final class StreamMax<T> {
@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
Optional<T> before(Stream<T> stream, Comparator<? super T> comparator) {
return Refaster.anyOf(stream.min(comparator.reversed()), Streams.findLast(stream.sorted(comparator)), stream.collect(maxBy(comparator)));
}
@AfterTemplate
Optional<T> after(Stream<T> stream, Comparator<? super T> comparator) {
return stream.max(comparator);
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMinNaturalOrderRecipe: Recipe created for the following Refaster template:
static final class StreamMinNaturalOrder<T extends Comparable<? super T>> {
@BeforeTemplate
Optional<T> before(Stream<T> stream) {
return Refaster.anyOf(stream.max(reverseOrder()), stream.sorted().findFirst());
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
Optional<T> after(Stream<T> stream) {
return stream.min(naturalOrder());
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamMinRecipe: Recipe created for the following Refaster template:
static final class StreamMin<T> {
@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
Optional<T> before(Stream<T> stream, Comparator<? super T> comparator) {
return Refaster.anyOf(stream.max(comparator.reversed()), stream.sorted(comparator).findFirst(), stream.collect(minBy(comparator)));
}
@AfterTemplate
Optional<T> after(Stream<T> stream, Comparator<? super T> comparator) {
return stream.min(comparator);
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamOf1Recipe: Prefer
Stream#of(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamOf2Recipe: Prefer
Stream#of(Object[])
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamOf3Recipe: Prefer
Stream#of(Object[])
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamOf4Recipe: Prefer
Stream#of(Object[])
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamOf5Recipe: Prefer
Stream#of(Object[])
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamOfNullableRecipe: Prefer
Stream#ofNullable(Object)
over more contrived alternatives. - tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamReduceRecipe: Recipe created for the following Refaster template:
static final class StreamReduce<T> {
@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
Optional<T> before(Stream<T> stream, BinaryOperator<T> accumulator) {
return stream.collect(reducing(accumulator));
}
@AfterTemplate
Optional<T> after(Stream<T> stream, BinaryOperator<T> accumulator) {
return stream.reduce(accumulator);
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamReduceWithIdentityRecipe: Recipe created for the following Refaster template:
static final class StreamReduceWithIdentity<T> {
@BeforeTemplate
@SuppressWarnings(value = "java:S4266")
T before(Stream<T> stream, T identity, BinaryOperator<T> accumulator) {
return stream.collect(reducing(identity, accumulator));
}
@AfterTemplate
T after(Stream<T> stream, T identity, BinaryOperator<T> accumulator) {
return stream.reduce(identity, accumulator);
}
}
.
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes$StreamTakeWhileRecipe: Recipe created for the following Refaster template:
static final class StreamTakeWhile<T> {
@BeforeTemplate
Stream<T> before(Stream<T> stream, Predicate<? super T> predicate) {
return stream.takeWhile(predicate).filter(predicate);
}
@AfterTemplate
Stream<T> after(Stream<T> stream, Predicate<? super T> predicate) {
return stream.takeWhile(predicate);
}
}
.
- tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualIterableIterationOrderRecipe: Recipe created for the following Refaster template:
static final class AssertEqualIterableIterationOrder<S, T extends S> {
@BeforeTemplate
void before(Iterable<S> actual, Iterable<T> expected) {
assertEquals(actual, expected);
}
@BeforeTemplate
void before(Collection<S> actual, Collection<T> expected) {
assertEquals(actual, expected);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Iterable<S> actual, Iterable<T> expected) {
assertThat(actual).containsExactlyElementsOf(expected);
}
}
.
- tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualIterableIterationOrderWithMessageRecipe: Recipe created for the following Refaster template:
static final class AssertEqualIterableIterationOrderWithMessage<S, T extends S> {
@BeforeTemplate
void before(Iterable<S> actual, String message, Iterable<T> expected) {
assertEquals(actual, expected, message);
}
@BeforeTemplate
void before(Collection<S> actual, String message, Collection<T> expected) {
assertEquals(actual, expected, message);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Iterable<S> actual, String message, Iterable<T> expected) {
assertThat(actual).withFailMessage(message).containsExactlyElementsOf(expected);
}
}
.
- tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualIteratorIterationOrderRecipe: Recipe created for the following Refaster template:
static final class AssertEqualIteratorIterationOrder<S, T extends S> {
@BeforeTemplate
void before(Iterator<S> actual, Iterator<T> expected) {
assertEquals(actual, expected);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Iterator<S> actual, Iterator<T> expected) {
assertThat(actual).toIterable().containsExactlyElementsOf(ImmutableList.copyOf(expected));
}
}
.
- tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualIteratorIterationOrderWithMessageRecipe: Recipe created for the following Refaster template:
static final class AssertEqualIteratorIterationOrderWithMessage<S, T extends S> {
@BeforeTemplate
void before(Iterator<S> actual, String message, Iterator<T> expected) {
assertEquals(actual, expected, message);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Iterator<S> actual, String message, Iterator<T> expected) {
assertThat(actual).toIterable().withFailMessage(message).containsExactlyElementsOf(ImmutableList.copyOf(expected));
}
}
.
- tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualSetsRecipe: Recipe created for the following Refaster template:
static final class AssertEqualSets<S, T extends S> {
@BeforeTemplate
void before(Set<S> actual, Set<T> expected) {
assertEquals(actual, expected);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Set<S> actual, Set<T> expected) {
assertThat(actual).hasSameElementsAs(expected);
}
}
.
- tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertEqualSetsWithMessageRecipe: Recipe created for the following Refaster template:
static final class AssertEqualSetsWithMessage<S, T extends S> {
@BeforeTemplate
void before(Set<S> actual, String message, Set<T> expected) {
assertEquals(actual, expected, message);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(Set<S> actual, String message, Set<T> expected) {
assertThat(actual).withFailMessage(message).hasSameElementsAs(expected);
}
}
.
- tech.picnic.errorprone.refasterrules.TestNGToAssertJRulesRecipes$AssertThrowsWithTypeRecipe: Recipe created for the following Refaster template:
static final class AssertThrowsWithType<T extends Throwable> {
@BeforeTemplate
void before(ThrowingRunnable runnable, Class<T> clazz) {
assertThrows(clazz, runnable);
}
@AfterTemplate
@UseImportPolicy(value = STATIC_IMPORT_ALWAYS)
void after(ThrowingCallable runnable, Class<T> clazz) {
assertThatThrownBy(runnable).isInstanceOf(clazz);
}
}
.
- tech.picnic.errorprone.refasterrules.WebClientRulesRecipes$BodyValueRecipe: Prefer
RequestBodySpec#bodyValue(Object)
over more contrived alternatives.
Removed Recipes
- org.openrewrite.recipes.JavaRecipeBestPractices: Best practices for Java recipe development.
- org.openrewrite.recipes.RecipeNullabilityBestPractices: Use JSpecify nullable annotations; drop Nonnull annotations; use
NullMarked
onpackage-info.java
instead. - org.openrewrite.recipes.RecipeTestingBestPractices: Best practices for testing recipes.
Changed Recipes
- org.openrewrite.kubernetes.services.FindServiceExternalIPs was changed:
- Old Options:
externalIPs: { type: Set, required: true }
fileMatcher: { type: String, required: false }
findMissing: { type: boolean, required: false }
- New Options:
externalIPs: { type: Set, required: true }
fileMatcher: { type: String, required: false }
findMissing: { type: Boolean, required: false }
- Old Options: