From c3f6d154631ea0e212d9f8ab782ca2d35baac279 Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Tue, 4 Oct 2022 10:29:04 +0200 Subject: [PATCH] Suggestions --- .../refastertemplates/ReactorTemplates.java | 24 +++++++++---------- .../ReactorTemplatesTestInput.java | 8 +++---- .../ReactorTemplatesTestOutput.java | 8 +++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ReactorTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ReactorTemplates.java index bff2528c1b..caf804c465 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ReactorTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ReactorTemplates.java @@ -271,29 +271,29 @@ Flux after(Flux flux) { } } - /** Prefer {@link Flux#onErrorComplete()} over more contrived alternatives */ - static final class FluxOnErrorComplete { + /** Prefer {@link Mono#onErrorComplete()} over more contrived alternatives. */ + static final class MonoOnErrorComplete { @BeforeTemplate - Flux before(Flux flux) { - return flux.onErrorResume(e -> Flux.empty()); + Mono before(Mono mono) { + return mono.onErrorResume(e -> Mono.empty()); } @AfterTemplate - Flux after(Flux flux) { - return flux.onErrorComplete(); + Mono after(Mono mono) { + return mono.onErrorComplete(); } } - /** Prefer {@link Mono#onErrorComplete()} over more contrived alternatives */ - static final class MonoOnErrorComplete { + /** Prefer {@link Flux#onErrorComplete()} over more contrived alternatives. */ + static final class FluxOnErrorComplete { @BeforeTemplate - Mono before(Mono mono) { - return mono.onErrorResume(e -> Mono.empty()); + Flux before(Flux flux) { + return flux.onErrorResume(e -> Flux.empty()); } @AfterTemplate - Mono after(Mono mono) { - return mono.onErrorComplete(); + Flux after(Flux flux) { + return flux.onErrorComplete(); } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/ReactorTemplatesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/ReactorTemplatesTestInput.java index 573b6485d4..d44ea29e77 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/ReactorTemplatesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/ReactorTemplatesTestInput.java @@ -95,12 +95,12 @@ Flux testFluxCast() { return Flux.just(1).map(Number.class::cast); } - Flux testFluxOnErrorComplete() { - return Flux.error(new IllegalStateException()).onErrorResume(e -> Flux.empty()); + Mono testMonoOnErrorComplete() { + return Mono.just(1).onErrorResume(e -> Mono.empty()); } - Mono testMonoOnErrorComplete() { - return Mono.error(new IllegalStateException()).onErrorResume(e -> Mono.empty()); + Flux testFluxOnErrorComplete() { + return Flux.just(1).onErrorResume(e -> Flux.empty()); } ImmutableSet> testPublisherProbeEmpty() { diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/ReactorTemplatesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/ReactorTemplatesTestOutput.java index 482abe347a..72edb92164 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/ReactorTemplatesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/ReactorTemplatesTestOutput.java @@ -94,12 +94,12 @@ Flux testFluxCast() { return Flux.just(1).cast(Number.class); } - Flux testFluxOnErrorComplete() { - return Flux.error(new IllegalStateException()).onErrorComplete(); + Mono testMonoOnErrorComplete() { + return Mono.just(1).onErrorComplete(); } - Mono testMonoOnErrorComplete() { - return Mono.error(new IllegalStateException()).onErrorComplete(); + Flux testFluxOnErrorComplete() { + return Flux.just(1).onErrorComplete(); } ImmutableSet> testPublisherProbeEmpty() {