ReactorRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$).*as compiler argument.
Table of contents
- MonoFromSupplier
- MonoEmpty
- MonoJust
- MonoJustOrEmptyObject
- MonoJustOrEmptyOptional
- MonoDeferMonoJustOrEmpty
- OptionalMapMonoJust
- MonoFromOptionalSwitchIfEmpty
- MonoZip
- MonoZipWithCombinator
- FluxZip
- FluxZipWithCombinator
- FluxZipWithIterable
- FluxZipWithIterableBiFunction
- FluxZipWithIterableMapFunction
- MonoDeferredError
- FluxDeferredError
- MonoErrorSupplier
- FluxErrorSupplier
- MonoThenReturn
- FluxTake
- MonoDefaultIfEmpty
- FluxDefaultIfEmpty
- FluxEmpty
- FluxJust
- FluxJustArray
- FluxFromArray
- MonoIdentity
- MonoSingle
- FluxSwitchIfEmptyOfEmptyPublisher
- FluxConcatMap
- FluxConcatMapWithPrefetch
- MonoFlatMapIterable
- MonoFlatMapIterableIdentity
- FluxConcatMapIterable
- FluxConcatMapIterableWithPrefetch
- MonoFlatMapToFlux
- MonoMap
- FluxMap
- MonoMapNotNull
- FluxMapNotNull
- FluxMapNotNullTransformationOrElse
- FluxMapNotNullOrElse
- MonoFlux
- MonoThen
- FluxThen
- MonoThenEmpty
- FluxThenEmpty
- MonoThenMany
- MonoThenMonoFlux
- FluxThenMany
- MonoThenMono
- FluxThenMono
- MonoSingleOptional
- MonoCast
- FluxCast
- MonoOfType
- FluxOfType
- MonoFlatMap
- MonoFlatMapMany
- ConcatMapIterableIdentity
- ConcatMapIterableIdentityWithPrefetch
- FluxFromIterable
- FluxCountMapMathToIntExact
- MonoDoOnError
- FluxDoOnError
- MonoOnErrorComplete
- FluxOnErrorComplete
- MonoOnErrorCompleteClass
- FluxOnErrorCompleteClass
- MonoOnErrorCompletePredicate
- FluxOnErrorCompletePredicate
- MonoOnErrorContinue
- FluxOnErrorContinue
- MonoOnErrorMap
- FluxOnErrorMap
- MonoOnErrorResume
- FluxOnErrorResume
- MonoOnErrorReturn
- FluxOnErrorReturn
- FluxFilterSort
- FluxFilterSortWithComparator
- FluxTakeWhile
- FluxCollectToImmutableList
- FluxCollectToImmutableSet
- FluxSort
- FluxTransformMin
- FluxTransformMinWithComparator
- FluxTransformMax
- FluxTransformMaxWithComparator
- MathFluxMin
- MathFluxMax
- ContextEmpty
- PublisherProbeEmpty
- PublisherProbeAssertWasSubscribed
- PublisherProbeAssertWasNotSubscribed
- PublisherProbeAssertWasCancelled
- PublisherProbeAssertWasNotCancelled
- PublisherProbeAssertWasRequested
- PublisherProbeAssertWasNotRequested
- AssertThatPublisherProbeWasSubscribed
- AssertThatPublisherProbeWasCancelled
- AssertThatPublisherProbeWasRequested
- StepVerifierFromMono
- StepVerifierFromFlux
- StepVerifierVerify
- StepVerifierVerifyDuration
- StepVerifierVerifyLater
- StepVerifierStepIdentity
- StepVerifierStepExpectNext
- FluxAsStepVerifierExpectNext
- StepVerifierLastStepVerifyComplete
- StepVerifierLastStepVerifyError
- StepVerifierLastStepVerifyErrorClass
- StepVerifierLastStepVerifyErrorMatches
- StepVerifierLastStepVerifyErrorSatisfies
- StepVerifierLastStepVerifyErrorSatisfiesAssertJ
- StepVerifierLastStepVerifyErrorMessage
- StepVerifierLastStepVerifyTimeout
- MonoFromFutureSupplier
- MonoFromFutureSupplierBoolean
- MonoFromFutureAsyncLoadingCacheGet
- MonoFromFutureAsyncLoadingCacheGetAll
- FluxFromStreamSupplier
- FluxNext
MonoFromSupplier
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFromSupplier")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFromSupplier).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<?>> testMonoFromSupplier() {
return ImmutableSet.of(
Mono.fromCallable((Callable<?>) null),
Mono.fromCallable(() -> getClass().getDeclaredConstructor()),
- Mono.fromCallable(() -> toString()),
+ Mono.fromSupplier(() -> toString()),
Mono.fromCallable(getClass()::getDeclaredConstructor),
- Mono.fromCallable(this::toString));
+ Mono.fromSupplier(this::toString));
}MonoEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<String>> testMonoEmpty() {
- return ImmutableSet.of(Mono.justOrEmpty(null), Mono.justOrEmpty(Optional.empty()));
+ return ImmutableSet.of(Mono.empty(), Mono.empty());
}MonoJust
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoJust")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoJust).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<Integer>> testMonoJust() {
- return ImmutableSet.of(Mono.justOrEmpty(Optional.of(1)), Flux.just(2).next());
+ return ImmutableSet.of(Mono.just(1), Mono.just(2));
}MonoJustOrEmptyObject
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoJustOrEmptyObject")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoJustOrEmptyObject).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testMonoJustOrEmptyObject() {
- return Mono.justOrEmpty(Optional.ofNullable(1));
+ return Mono.justOrEmpty(1);
}MonoJustOrEmptyOptional
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoJustOrEmptyOptional")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoJustOrEmptyOptional).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testMonoJustOrEmptyOptional() {
- return Mono.just(Optional.of(1)).filter(Optional::isPresent).map(Optional::orElseThrow);
+ return Mono.justOrEmpty(Optional.of(1));
}MonoDeferMonoJustOrEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoDeferMonoJustOrEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoDeferMonoJustOrEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<Integer>> testMonoDeferMonoJustOrEmpty() {
return ImmutableSet.of(
- Mono.fromCallable(() -> Optional.of(1).orElse(null)),
- Mono.fromSupplier(() -> Optional.of(2).orElse(null)));
+ Mono.defer(() -> Mono.justOrEmpty(Optional.of(1))),
+ Mono.defer(() -> Mono.justOrEmpty(Optional.of(2))));
}OptionalMapMonoJust
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("OptionalMapMonoJust")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$OptionalMapMonoJust).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Optional<Mono<String>> testOptionalMapMonoJust() {
- return Optional.of("foo").map(Mono::justOrEmpty);
+ return Optional.of("foo").map(Mono::just);
}MonoFromOptionalSwitchIfEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFromOptionalSwitchIfEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFromOptionalSwitchIfEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testMonoFromOptionalSwitchIfEmpty() {
- return Optional.of(1).map(Mono::just).orElse(Mono.just(2));
+ return Mono.justOrEmpty(Optional.of(1)).switchIfEmpty(Mono.just(2));
}MonoZip
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoZip")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoZip).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Tuple2<String, Integer>> testMonoZip() {
- return Mono.just("foo").zipWith(Mono.just(1));
+ return Mono.zip(Mono.just("foo"), Mono.just(1));
}MonoZipWithCombinator
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoZipWithCombinator")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoZipWithCombinator).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<String> testMonoZipWithCombinator() {
- return Mono.just("foo").zipWith(Mono.just(1), String::repeat);
+ return Mono.zip(Mono.just("foo"), Mono.just(1)).map(TupleUtils.function(String::repeat));
}FluxZip
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxZip")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxZip).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Tuple2<String, Integer>> testFluxZip() {
- return Flux.just("foo", "bar").zipWith(Flux.just(1, 2));
+ return Flux.zip(Flux.just("foo", "bar"), Flux.just(1, 2));
}FluxZipWithCombinator
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxZipWithCombinator")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxZipWithCombinator).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<String> testFluxZipWithCombinator() {
- return Flux.just("foo", "bar").zipWith(Flux.just(1, 2), String::repeat);
+ return Flux.zip(Flux.just("foo", "bar"), Flux.just(1, 2))
+ .map(TupleUtils.function(String::repeat));
}FluxZipWithIterable
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxZipWithIterable")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxZipWithIterable).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Tuple2<String, Integer>> testFluxZipWithIterable() {
- return Flux.zip(Flux.just("foo", "bar"), Flux.fromIterable(ImmutableSet.of(1, 2)));
+ return Flux.just("foo", "bar").zipWithIterable(ImmutableSet.of(1, 2));
}FluxZipWithIterableBiFunction
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxZipWithIterableBiFunction")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxZipWithIterableBiFunction).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<String> testFluxZipWithIterableBiFunction() {
- return Flux.just("foo", "bar")
- .zipWith(Flux.fromIterable(ImmutableSet.of(1, 2)), String::repeat);
+ return Flux.just("foo", "bar").zipWithIterable(ImmutableSet.of(1, 2), String::repeat);
}FluxZipWithIterableMapFunction
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxZipWithIterableMapFunction")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxZipWithIterableMapFunction).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<String> testFluxZipWithIterableMapFunction() {
- return Flux.just("foo", "bar").zipWithIterable(ImmutableSet.of(1, 2), String::repeat);
+ return Flux.just("foo", "bar")
+ .zipWithIterable(ImmutableSet.of(1, 2))
+ .map(function(String::repeat));
}MonoDeferredError
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoDeferredError")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoDeferredError).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Void> testMonoDeferredError() {
- return Mono.defer(() -> Mono.error(new IllegalStateException()));
+ return Mono.error(() -> new IllegalStateException());
}FluxDeferredError
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxDeferredError")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxDeferredError).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Void> testFluxDeferredError() {
- return Flux.defer(() -> Flux.error(new IllegalStateException()));
+ return Flux.error(() -> new IllegalStateException());
}MonoErrorSupplier
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoErrorSupplier")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoErrorSupplier).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Void> testMonoErrorSupplier() {
- return Mono.error(() -> ((Supplier<RuntimeException>) null).get());
+ return Mono.error(((Supplier<RuntimeException>) null));
}FluxErrorSupplier
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxErrorSupplier")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxErrorSupplier).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Void> testFluxErrorSupplier() {
- return Flux.error(() -> ((Supplier<RuntimeException>) null).get());
+ return Flux.error(((Supplier<RuntimeException>) null));
}MonoThenReturn
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoThenReturn")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoThenReturn).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<String>> testMonoThenReturn() {
return ImmutableSet.of(
- Mono.just(1).ignoreElement().thenReturn("foo"),
- Mono.just(2).then().thenReturn("bar"),
- Mono.just(3).then(Mono.just("baz")));
+ Mono.just(1).thenReturn("foo"),
+ Mono.just(2).thenReturn("bar"),
+ Mono.just(3).thenReturn("baz"));
}FluxTake
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxTake")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxTake).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxTake() {
- return Flux.just(1, 2, 3).take(1, true);
+ return Flux.just(1, 2, 3).take(1);
}MonoDefaultIfEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoDefaultIfEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoDefaultIfEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<String> testMonoDefaultIfEmpty() {
- return Mono.just("foo").switchIfEmpty(Mono.just("bar"));
+ return Mono.just("foo").defaultIfEmpty("bar");
}FluxDefaultIfEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxDefaultIfEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxDefaultIfEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<String>> testFluxDefaultIfEmpty() {
return ImmutableSet.of(
- Flux.just("foo").switchIfEmpty(Mono.just("bar")),
- Flux.just("baz").switchIfEmpty(Flux.just("qux")));
+ Flux.just("foo").defaultIfEmpty("bar"), Flux.just("baz").defaultIfEmpty("qux"));
}FluxEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<?>> testFluxEmpty() {
return ImmutableSet.of(
- Flux.zip(v -> v),
- Flux.zip(v -> v, 1),
- Flux.concat(),
- Flux.concatDelayError(),
- Flux.firstWithSignal(),
- Flux.just(),
- Flux.merge(),
- Flux.merge(1),
- Flux.mergeComparing((a, b) -> 0),
- Flux.mergeComparing(1, (a, b) -> 0),
- Flux.mergeComparingDelayError(1, (a, b) -> 0),
- Flux.mergeDelayError(1),
- Flux.mergePriority((a, b) -> 0),
- Flux.mergePriority(1, (a, b) -> 0),
- Flux.mergePriorityDelayError(1, (a, b) -> 0),
- Flux.mergeSequential(),
- Flux.mergeSequential(1),
- Flux.mergeSequentialDelayError(1),
- Flux.fromArray(new String[0]),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
Flux.fromArray(new String[] {"foo"}),
- Flux.fromIterable(ImmutableList.of()),
+ Flux.empty(),
Flux.fromIterable(Iterables.cycle("bar")),
- Flux.fromStream(() -> Stream.empty()),
+ Flux.empty(),
Flux.fromStream(() -> Stream.generate(() -> "baz")),
- Flux.combineLatest(v -> v),
- Flux.combineLatest(v -> v, 1),
- Flux.mergeComparing(),
- Flux.mergePriority(),
- Flux.range(0, 0));
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty(),
+ Flux.empty());
}FluxJust
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxJust")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxJust).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testFluxJust() {
- return ImmutableSet.of(
- Flux.range(0, 1),
- Mono.just(2).flux(),
- Flux.fromStream(() -> Stream.of(3)),
- Mono.just(4).repeat().take(1));
+ return ImmutableSet.of(Flux.just(0), Flux.just(2), Flux.just(3), Flux.just(4));
}FluxJustArray
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxJustArray")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxJustArray).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<String>> testFluxJustArray() {
- return ImmutableSet.of(
- Flux.fromStream(() -> Stream.of("foo", "bar")),
- Flux.fromStream(() -> Stream.of("baz", "qux", "quux")));
+ return ImmutableSet.of(Flux.just("foo", "bar"), Flux.just("baz", "qux", "quux"));
}FluxFromArray
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxFromArray")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxFromArray).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<String>> testFluxFromArray() {
return ImmutableSet.of(
- Flux.just(new String[] {"foo"}),
- Flux.fromStream(() -> Arrays.stream(new String[] {"bar"})));
+ Flux.fromArray(new String[] {"foo"}), Flux.fromArray(new String[] {"bar"}));
}MonoIdentity
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoIdentity")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoIdentity).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<?>> testMonoIdentity() {
return ImmutableSet.of(
- Mono.just(1).switchIfEmpty(Mono.empty()),
- Mono.just(2).flux().next(),
- Mono.just(3).flux().singleOrEmpty(),
- Mono.<Void>empty().ignoreElement(),
- Mono.<Void>empty().then(),
- Mono.<ImmutableList<String>>empty().map(ImmutableList::copyOf));
+ Mono.just(1),
+ Mono.just(2),
+ Mono.just(3),
+ Mono.<Void>empty(),
+ Mono.<Void>empty(),
+ Mono.<ImmutableList<String>>empty());
}MonoSingle
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoSingle")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoSingle).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testMonoSingle() {
- return Mono.just(1).flux().single();
+ return Mono.just(1).single();
}FluxSwitchIfEmptyOfEmptyPublisher
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxSwitchIfEmptyOfEmptyPublisher")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxSwitchIfEmptyOfEmptyPublisher).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testFluxSwitchIfEmptyOfEmptyPublisher() {
- return ImmutableSet.of(
- Flux.just(1).switchIfEmpty(Mono.empty()), Flux.just(2).switchIfEmpty(Flux.empty()));
+ return ImmutableSet.of(Flux.just(1), Flux.just(2));
}FluxConcatMap
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxConcatMap")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxConcatMap).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testFluxConcatMap() {
return ImmutableSet.of(
- Flux.just(1).concatMap(Mono::just, 0),
- Flux.just(2).flatMap(Mono::just, 1),
- Flux.just(3).flatMapSequential(Mono::just, 1),
- Flux.just(4).map(Mono::just).concatMap(identity()),
- Flux.just(5).map(Mono::just).concatMap(v -> v),
+ Flux.just(1).concatMap(Mono::just),
+ Flux.just(2).concatMap(Mono::just),
+ Flux.just(3).concatMap(Mono::just),
+ Flux.just(4).concatMap(Mono::just),
+ Flux.just(5).concatMap(Mono::just),
Flux.just(6).map(Mono::just).concatMap(v -> Mono.empty()));
}FluxConcatMapWithPrefetch
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxConcatMapWithPrefetch")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxConcatMapWithPrefetch).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testFluxConcatMapWithPrefetch() {
return ImmutableSet.of(
- Flux.just(1).flatMap(Mono::just, 1, 3),
- Flux.just(2).flatMapSequential(Mono::just, 1, 4),
- Flux.just(3).map(Mono::just).concatMap(identity(), 5),
- Flux.just(4).map(Mono::just).concatMap(v -> v, 6),
+ Flux.just(1).concatMap(Mono::just, 3),
+ Flux.just(2).concatMap(Mono::just, 4),
+ Flux.just(3).concatMap(Mono::just, 5),
+ Flux.just(4).concatMap(Mono::just, 6),
Flux.just(5).map(Mono::just).concatMap(v -> Mono.empty(), 7));
}MonoFlatMapIterable
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFlatMapIterable")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFlatMapIterable).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testMonoFlatMapIterable() {
return ImmutableSet.of(
- Mono.just(1).map(ImmutableSet::of).flatMapMany(Flux::fromIterable),
- Mono.just(2).map(ImmutableSet::of).flatMapIterable(identity()),
- Mono.just(3).map(ImmutableSet::of).flatMapIterable(v -> v),
+ Mono.just(1).flatMapIterable(ImmutableSet::of),
+ Mono.just(2).flatMapIterable(ImmutableSet::of),
+ Mono.just(3).flatMapIterable(ImmutableSet::of),
Mono.just(4).map(ImmutableSet::of).flatMapIterable(v -> ImmutableSet.of()),
- Mono.just(5).flux().concatMapIterable(ImmutableSet::of));
+ Mono.just(5).flatMapIterable(ImmutableSet::of));
}MonoFlatMapIterableIdentity
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFlatMapIterableIdentity")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFlatMapIterableIdentity).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testMonoFlatMapIterableIdentity() {
- return Mono.just(ImmutableSet.of(1)).flatMapMany(Flux::fromIterable);
+ return Mono.just(ImmutableSet.of(1)).flatMapIterable(identity());
}FluxConcatMapIterable
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxConcatMapIterable")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxConcatMapIterable).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testFluxConcatMapIterable() {
return ImmutableSet.of(
- Flux.just(1).flatMapIterable(ImmutableList::of),
- Flux.just(2).map(ImmutableList::of).concatMapIterable(identity()),
- Flux.just(3).map(ImmutableList::of).concatMapIterable(v -> v),
+ Flux.just(1).concatMapIterable(ImmutableList::of),
+ Flux.just(2).concatMapIterable(ImmutableList::of),
+ Flux.just(3).concatMapIterable(ImmutableList::of),
Flux.just(4).map(ImmutableList::of).concatMapIterable(v -> ImmutableSet.of()));
}FluxConcatMapIterableWithPrefetch
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxConcatMapIterableWithPrefetch")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxConcatMapIterableWithPrefetch).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testFluxConcatMapIterableWithPrefetch() {
return ImmutableSet.of(
- Flux.just(1).flatMapIterable(ImmutableList::of, 5),
- Flux.just(2).map(ImmutableList::of).concatMapIterable(identity(), 5),
- Flux.just(3).map(ImmutableList::of).concatMapIterable(v -> v, 5),
+ Flux.just(1).concatMapIterable(ImmutableList::of, 5),
+ Flux.just(2).concatMapIterable(ImmutableList::of, 5),
+ Flux.just(3).concatMapIterable(ImmutableList::of, 5),
Flux.just(4).map(ImmutableList::of).concatMapIterable(v -> ImmutableSet.of(), 5));
}MonoFlatMapToFlux
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFlatMapToFlux")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFlatMapToFlux).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<String> testMonoFlatMapToFlux() {
- return Mono.just("foo").flatMapMany(s -> Mono.fromSupplier(() -> s + s));
+ return Mono.just("foo").flatMap(s -> Mono.fromSupplier(() -> s + s)).flux();
}MonoMap
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoMap")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoMap).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<String>> testMonoMap() {
- return ImmutableSet.of(
- Mono.just("foo").flatMap(s -> Mono.just(s)),
- Mono.just("bar").flatMap(s -> Mono.just(s.substring(1))));
+ return ImmutableSet.of(Mono.just("foo").map(s -> s), Mono.just("bar").map(s -> s.substring(1)));
}FluxMap
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxMap")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxMap).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testFluxMap() {
return ImmutableSet.of(
- Flux.just(1).concatMap(n -> Mono.just(n)),
- Flux.just(1).concatMap(n -> Flux.just(n * 2)),
- Flux.just(1).concatMap(n -> Mono.just(n), 3),
- Flux.just(1).concatMap(n -> Flux.just(n * 2), 3),
- Flux.just(1).concatMapDelayError(n -> Mono.just(n)),
- Flux.just(1).concatMapDelayError(n -> Flux.just(n * 2)),
- Flux.just(1).concatMapDelayError(n -> Mono.just(n), 3),
- Flux.just(1).concatMapDelayError(n -> Flux.just(n * 2), 3),
- Flux.just(1).flatMap(n -> Mono.just(n), 3),
- Flux.just(1).flatMap(n -> Flux.just(n * 2), 3),
- Flux.just(1).flatMap(n -> Mono.just(n), 3, 4),
- Flux.just(1).flatMap(n -> Flux.just(n * 2), 3, 4),
- Flux.just(1).flatMapDelayError(n -> Mono.just(n), 3, 4),
- Flux.just(1).flatMapDelayError(n -> Flux.just(n * 2), 3, 4),
- Flux.just(1).flatMapSequential(n -> Mono.just(n), 3),
- Flux.just(1).flatMapSequential(n -> Flux.just(n * 2), 3),
- Flux.just(1).flatMapSequential(n -> Mono.just(n), 3, 4),
- Flux.just(1).flatMapSequential(n -> Flux.just(n * 2), 3, 4),
- Flux.just(1).flatMapSequentialDelayError(n -> Mono.just(n), 3, 4),
- Flux.just(1).flatMapSequentialDelayError(n -> Flux.just(n * 2), 3, 4),
- Flux.just(1).switchMap(n -> Mono.just(n)),
- Flux.just(1).switchMap(n -> Flux.just(n * 2)));
+ Flux.just(1).map(n -> n),
+ Flux.just(1).map(n -> n * 2),
+ Flux.just(1).map(n -> n),
+ Flux.just(1).map(n -> n * 2),
+ Flux.just(1).map(n -> n),
+ Flux.just(1).map(n -> n * 2),
+ Flux.just(1).map(n -> n),
+ Flux.just(1).map(n -> n * 2),
+ Flux.just(1).map(n -> n),
+ Flux.just(1).map(n -> n * 2),
+ Flux.just(1).map(n -> n),
+ Flux.just(1).map(n -> n * 2),
+ Flux.just(1).map(n -> n),
+ Flux.just(1).map(n -> n * 2),
+ Flux.just(1).map(n -> n),
+ Flux.just(1).map(n -> n * 2),
+ Flux.just(1).map(n -> n),
+ Flux.just(1).map(n -> n * 2),
+ Flux.just(1).map(n -> n),
+ Flux.just(1).map(n -> n * 2),
+ Flux.just(1).map(n -> n),
+ Flux.just(1).map(n -> n * 2));
}MonoMapNotNull
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoMapNotNull")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoMapNotNull).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<String>> testMonoMapNotNull() {
return ImmutableSet.of(
- Mono.just("foo").flatMap(s -> Mono.justOrEmpty(s)),
- Mono.just("bar").flatMap(s -> Mono.fromSupplier(() -> s.substring(1))));
+ Mono.just("foo").mapNotNull(s -> s), Mono.just("bar").mapNotNull(s -> s.substring(1)));
}FluxMapNotNull
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxMapNotNull")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxMapNotNull).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testFluxMapNotNull() {
return ImmutableSet.of(
- Flux.just(1).concatMap(n -> Mono.justOrEmpty(n)),
- Flux.just(1).concatMap(n -> Mono.fromSupplier(() -> n * 2)),
- Flux.just(1).concatMap(n -> Mono.justOrEmpty(n), 3),
- Flux.just(1).concatMap(n -> Mono.fromSupplier(() -> n * 2), 3),
- Flux.just(1).concatMapDelayError(n -> Mono.justOrEmpty(n)),
- Flux.just(1).concatMapDelayError(n -> Mono.fromSupplier(() -> n * 2)),
- Flux.just(1).concatMapDelayError(n -> Mono.justOrEmpty(n), 3),
- Flux.just(1).concatMapDelayError(n -> Mono.fromSupplier(() -> n * 2), 3),
- Flux.just(1).flatMap(n -> Mono.justOrEmpty(n), 3),
- Flux.just(1).flatMap(n -> Mono.fromSupplier(() -> n * 2), 3),
- Flux.just(1).flatMap(n -> Mono.justOrEmpty(n), 3, 4),
- Flux.just(1).flatMap(n -> Mono.fromSupplier(() -> n * 2), 3, 4),
- Flux.just(1).flatMapDelayError(n -> Mono.justOrEmpty(n), 3, 4),
- Flux.just(1).flatMapDelayError(n -> Mono.fromSupplier(() -> n * 2), 3, 4),
- Flux.just(1).flatMapSequential(n -> Mono.justOrEmpty(n), 3),
- Flux.just(1).flatMapSequential(n -> Mono.fromSupplier(() -> n * 2), 3),
- Flux.just(1).flatMapSequential(n -> Mono.justOrEmpty(n), 3, 4),
- Flux.just(1).flatMapSequential(n -> Mono.fromSupplier(() -> n * 2), 3, 4),
- Flux.just(1).flatMapSequentialDelayError(n -> Mono.justOrEmpty(n), 3, 4),
- Flux.just(1).flatMapSequentialDelayError(n -> Mono.fromSupplier(() -> n * 2), 3, 4),
- Flux.just(1).switchMap(n -> Mono.justOrEmpty(n)),
- Flux.just(1).switchMap(n -> Mono.fromSupplier(() -> n * 2)));
+ Flux.just(1).mapNotNull(n -> n),
+ Flux.just(1).mapNotNull(n -> n * 2),
+ Flux.just(1).mapNotNull(n -> n),
+ Flux.just(1).mapNotNull(n -> n * 2),
+ Flux.just(1).mapNotNull(n -> n),
+ Flux.just(1).mapNotNull(n -> n * 2),
+ Flux.just(1).mapNotNull(n -> n),
+ Flux.just(1).mapNotNull(n -> n * 2),
+ Flux.just(1).mapNotNull(n -> n),
+ Flux.just(1).mapNotNull(n -> n * 2),
+ Flux.just(1).mapNotNull(n -> n),
+ Flux.just(1).mapNotNull(n -> n * 2),
+ Flux.just(1).mapNotNull(n -> n),
+ Flux.just(1).mapNotNull(n -> n * 2),
+ Flux.just(1).mapNotNull(n -> n),
+ Flux.just(1).mapNotNull(n -> n * 2),
+ Flux.just(1).mapNotNull(n -> n),
+ Flux.just(1).mapNotNull(n -> n * 2),
+ Flux.just(1).mapNotNull(n -> n),
+ Flux.just(1).mapNotNull(n -> n * 2),
+ Flux.just(1).mapNotNull(n -> n),
+ Flux.just(1).mapNotNull(n -> n * 2));
}FluxMapNotNullTransformationOrElse
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxMapNotNullTransformationOrElse")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxMapNotNullTransformationOrElse).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<String> testFluxMapNotNullTransformationOrElse() {
- return Flux.just(1).map(x -> Optional.of(x.toString())).mapNotNull(x -> x.orElse(null));
+ return Flux.just(1).mapNotNull(x -> Optional.of(x.toString()).orElse(null));
}FluxMapNotNullOrElse
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxMapNotNullOrElse")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxMapNotNullOrElse).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxMapNotNullOrElse() {
- return Flux.just(Optional.of(1)).filter(Optional::isPresent).map(Optional::orElseThrow);
+ return Flux.just(Optional.of(1)).mapNotNull(x -> x.orElse(null));
}MonoFlux
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFlux")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFlux).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<String>> testMonoFlux() {
return ImmutableSet.of(
- Mono.just("foo").flatMapMany(Mono::just),
- Mono.just("bar").flatMapMany(Flux::just),
- Flux.concat(Mono.just("baz")));
+ Mono.just("foo").flux(), Mono.just("bar").flux(), Mono.just("baz").flux());
}MonoThen
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoThen")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoThen).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<Void>> testMonoThen() {
return ImmutableSet.of(
- Mono.just("foo").ignoreElement().then(),
- Mono.just("bar").flux().then(),
- Mono.when(Mono.just("baz")),
- Mono.whenDelayError(Mono.just("qux")));
+ Mono.just("foo").then(),
+ Mono.just("bar").then(),
+ Mono.just("baz").then(),
+ Mono.just("qux").then());
}FluxThen
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxThen")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxThen).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<Void>> testFluxThen() {
- return ImmutableSet.of(
- Flux.just("foo").ignoreElements().then(), Flux.<Void>empty().ignoreElements());
+ return ImmutableSet.of(Flux.just("foo").then(), Flux.<Void>empty().then());
}MonoThenEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoThenEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoThenEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Void> testMonoThenEmpty() {
- return Mono.just("foo").ignoreElement().thenEmpty(Mono.empty());
+ return Mono.just("foo").thenEmpty(Mono.empty());
}FluxThenEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxThenEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxThenEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Void> testFluxThenEmpty() {
- return Flux.just("foo").ignoreElements().thenEmpty(Mono.empty());
+ return Flux.just("foo").thenEmpty(Mono.empty());
}MonoThenMany
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoThenMany")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoThenMany).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<String>> testMonoThenMany() {
return ImmutableSet.of(
- Mono.just("foo").ignoreElement().thenMany(Flux.just("bar")),
- Mono.just("baz").ignoreElement().thenMany(Flux.just("qux")));
+ Mono.just("foo").thenMany(Flux.just("bar")), Mono.just("baz").thenMany(Flux.just("qux")));
}MonoThenMonoFlux
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoThenMonoFlux")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoThenMonoFlux).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<String> testMonoThenMonoFlux() {
- return Mono.just("foo").thenMany(Mono.just("bar"));
+ return Mono.just("foo").then(Mono.just("bar")).flux();
}FluxThenMany
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxThenMany")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxThenMany).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<String> testFluxThenMany() {
- return Flux.just("foo").ignoreElements().thenMany(Flux.just("bar"));
+ return Flux.just("foo").thenMany(Flux.just("bar"));
}MonoThenMono
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoThenMono")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoThenMono).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<?>> testMonoThenMono() {
return ImmutableSet.of(
- Mono.just("foo").ignoreElement().then(Mono.just("bar")),
- Mono.just("baz").flux().then(Mono.just("qux")),
- Mono.just("quux").thenEmpty(Mono.<Void>empty()));
+ Mono.just("foo").then(Mono.just("bar")),
+ Mono.just("baz").then(Mono.just("qux")),
+ Mono.just("quux").then(Mono.<Void>empty()));
}FluxThenMono
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxThenMono")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxThenMono).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<?>> testFluxThenMono() {
return ImmutableSet.of(
- Flux.just("foo").ignoreElements().then(Mono.just("bar")),
- Flux.just("baz").thenEmpty(Mono.<Void>empty()));
+ Flux.just("foo").then(Mono.just("bar")), Flux.just("baz").then(Mono.<Void>empty()));
}MonoSingleOptional
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoSingleOptional")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoSingleOptional).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<Optional<String>>> testMonoSingleOptional() {
return ImmutableSet.of(
- Mono.just("foo").flux().collect(toOptional()),
- Mono.just("bar").map(Optional::of),
- Mono.just("baz").singleOptional().defaultIfEmpty(Optional.empty()),
- Mono.just("quux").singleOptional().switchIfEmpty(Mono.just(Optional.empty())),
- Mono.just("quuz").transform(Mono::singleOptional));
+ Mono.just("foo").singleOptional(),
+ Mono.just("bar").singleOptional(),
+ Mono.just("baz").singleOptional(),
+ Mono.just("quux").singleOptional(),
+ Mono.just("quuz").singleOptional());
}MonoCast
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoCast")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoCast).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Number> testMonoCast() {
- return Mono.just(1).map(Number.class::cast);
+ return Mono.just(1).cast(Number.class);
}FluxCast
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxCast")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxCast).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Number> testFluxCast() {
- return Flux.just(1).map(Number.class::cast);
+ return Flux.just(1).cast(Number.class);
}MonoOfType
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoOfType")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoOfType).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Number> testMonoOfType() {
- return Mono.just(1).filter(Number.class::isInstance).cast(Number.class);
+ return Mono.just(1).ofType(Number.class);
}FluxOfType
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxOfType")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxOfType).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Number> testFluxOfType() {
- return Flux.just(1).filter(Number.class::isInstance).cast(Number.class);
+ return Flux.just(1).ofType(Number.class);
}MonoFlatMap
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFlatMap")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFlatMap).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<String>> testMonoFlatMap() {
return ImmutableSet.of(
- Mono.just("foo").map(Mono::just).flatMap(identity()),
- Mono.just("bar").map(Mono::just).flatMap(v -> v),
+ Mono.just("foo").flatMap(Mono::just),
+ Mono.just("bar").flatMap(Mono::just),
Mono.just("baz").map(Mono::just).flatMap(v -> Mono.empty()));
}MonoFlatMapMany
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFlatMapMany")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFlatMapMany).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testMonoFlatMapMany() {
return ImmutableSet.of(
- Mono.just(1).map(Mono::just).flatMapMany(identity()),
- Mono.just(2).map(Mono::just).flatMapMany(v -> v),
+ Mono.just(1).flatMapMany(Mono::just),
+ Mono.just(2).flatMapMany(Mono::just),
Mono.just(3).map(Mono::just).flatMapMany(v -> Flux.empty()),
- Mono.just(4).flux().concatMap(Mono::just),
- Mono.just(5).flux().concatMap(Mono::just, 2),
- Mono.just(6).flux().concatMapDelayError(Mono::just),
- Mono.just(7).flux().concatMapDelayError(Mono::just, 2),
- Mono.just(8).flux().concatMapDelayError(Mono::just, false, 2),
- Mono.just(9).flux().flatMap(Mono::just, 2),
- Mono.just(10).flux().flatMap(Mono::just, 2, 3),
- Mono.just(11).flux().flatMapDelayError(Mono::just, 2, 3),
- Mono.just(12).flux().flatMapSequential(Mono::just, 2),
- Mono.just(13).flux().flatMapSequential(Mono::just, 2, 3),
- Mono.just(14).flux().flatMapSequentialDelayError(Mono::just, 2, 3),
- Mono.just(15).flux().switchMap(Mono::just));
+ Mono.just(4).flatMapMany(Mono::just),
+ Mono.just(5).flatMapMany(Mono::just),
+ Mono.just(6).flatMapMany(Mono::just),
+ Mono.just(7).flatMapMany(Mono::just),
+ Mono.just(8).flatMapMany(Mono::just),
+ Mono.just(9).flatMapMany(Mono::just),
+ Mono.just(10).flatMapMany(Mono::just),
+ Mono.just(11).flatMapMany(Mono::just),
+ Mono.just(12).flatMapMany(Mono::just),
+ Mono.just(13).flatMapMany(Mono::just),
+ Mono.just(14).flatMapMany(Mono::just),
+ Mono.just(15).flatMapMany(Mono::just));
}ConcatMapIterableIdentity
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ConcatMapIterableIdentity")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$ConcatMapIterableIdentity).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<String>> testConcatMapIterableIdentity() {
return ImmutableSet.of(
- Flux.just(ImmutableList.of("foo")).concatMap(list -> Flux.fromIterable(list)),
- Flux.just(ImmutableList.of("bar")).concatMap(Flux::fromIterable));
+ Flux.just(ImmutableList.of("foo")).concatMapIterable(identity()),
+ Flux.just(ImmutableList.of("bar")).concatMapIterable(identity()));
}ConcatMapIterableIdentityWithPrefetch
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ConcatMapIterableIdentityWithPrefetch")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$ConcatMapIterableIdentityWithPrefetch).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<String>> testConcatMapIterableIdentityWithPrefetch() {
return ImmutableSet.of(
- Flux.just(ImmutableList.of("foo")).concatMap(list -> Flux.fromIterable(list), 1),
- Flux.just(ImmutableList.of("bar")).concatMap(Flux::fromIterable, 2));
+ Flux.just(ImmutableList.of("foo")).concatMapIterable(identity(), 1),
+ Flux.just(ImmutableList.of("bar")).concatMapIterable(identity(), 2));
}FluxFromIterable
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxFromIterable")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxFromIterable).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<String>> testFluxFromIterable() {
return ImmutableSet.of(
- Flux.fromStream(ImmutableList.of("foo")::stream),
- Flux.fromStream(() -> ImmutableList.of("bar").stream()));
+ Flux.fromIterable(ImmutableList.of("foo")), Flux.fromIterable(ImmutableList.of("bar")));
}FluxCountMapMathToIntExact
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxCountMapMathToIntExact")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxCountMapMathToIntExact).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<Integer>> testFluxCountMapMathToIntExact() {
return ImmutableSet.of(
- Flux.just(1).collect(toImmutableList()).map(Collection::size),
- Flux.just(2).collect(toImmutableList()).map(List::size),
- Flux.just(3).collect(toImmutableList()).map(ImmutableCollection::size),
- Flux.just(4).collect(toImmutableList()).map(ImmutableList::size),
- Flux.just(5).collect(toCollection(ArrayList::new)).map(Collection::size),
- Flux.just(6).collect(toCollection(ArrayList::new)).map(List::size));
+ Flux.just(1).count().map(Math::toIntExact),
+ Flux.just(2).count().map(Math::toIntExact),
+ Flux.just(3).count().map(Math::toIntExact),
+ Flux.just(4).count().map(Math::toIntExact),
+ Flux.just(5).count().map(Math::toIntExact),
+ Flux.just(6).count().map(Math::toIntExact));
}MonoDoOnError
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoDoOnError")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoDoOnError).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testMonoDoOnError() {
- return Mono.just(1).doOnError(IllegalArgumentException.class::isInstance, e -> {});
+ return Mono.just(1).doOnError(IllegalArgumentException.class, e -> {});
}FluxDoOnError
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxDoOnError")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxDoOnError).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxDoOnError() {
- return Flux.just(1).doOnError(IllegalArgumentException.class::isInstance, e -> {});
+ return Flux.just(1).doOnError(IllegalArgumentException.class, e -> {});
}MonoOnErrorComplete
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoOnErrorComplete")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoOnErrorComplete).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testMonoOnErrorComplete() {
- return Mono.just(1).onErrorResume(e -> Mono.empty());
+ return Mono.just(1).onErrorComplete();
}FluxOnErrorComplete
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxOnErrorComplete")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxOnErrorComplete).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testFluxOnErrorComplete() {
- return ImmutableSet.of(
- Flux.just(1).onErrorResume(e -> Mono.empty()),
- Flux.just(2).onErrorResume(e -> Flux.empty()));
+ return ImmutableSet.of(Flux.just(1).onErrorComplete(), Flux.just(2).onErrorComplete());
}MonoOnErrorCompleteClass
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoOnErrorCompleteClass")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoOnErrorCompleteClass).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<Integer>> testMonoOnErrorCompleteClass() {
return ImmutableSet.of(
- Mono.just(1).onErrorComplete(IllegalArgumentException.class::isInstance),
- Mono.just(2).onErrorResume(IllegalStateException.class, e -> Mono.empty()));
+ Mono.just(1).onErrorComplete(IllegalArgumentException.class),
+ Mono.just(2).onErrorComplete(IllegalStateException.class));
}FluxOnErrorCompleteClass
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxOnErrorCompleteClass")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxOnErrorCompleteClass).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testFluxOnErrorCompleteClass() {
return ImmutableSet.of(
- Flux.just(1).onErrorComplete(IllegalArgumentException.class::isInstance),
- Flux.just(2).onErrorResume(IllegalStateException.class, e -> Mono.empty()),
- Flux.just(3).onErrorResume(AssertionError.class, e -> Flux.empty()));
+ Flux.just(1).onErrorComplete(IllegalArgumentException.class),
+ Flux.just(2).onErrorComplete(IllegalStateException.class),
+ Flux.just(3).onErrorComplete(AssertionError.class));
}MonoOnErrorCompletePredicate
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoOnErrorCompletePredicate")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoOnErrorCompletePredicate).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testMonoOnErrorCompletePredicate() {
- return Mono.just(1).onErrorResume(e -> e.getCause() == null, e -> Mono.empty());
+ return Mono.just(1).onErrorComplete(e -> e.getCause() == null);
}FluxOnErrorCompletePredicate
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxOnErrorCompletePredicate")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxOnErrorCompletePredicate).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Flux<Integer>> testFluxOnErrorCompletePredicate() {
return ImmutableSet.of(
- Flux.just(1).onErrorResume(e -> e.getCause() == null, e -> Mono.empty()),
- Flux.just(2).onErrorResume(e -> e.getCause() != null, e -> Flux.empty()));
+ Flux.just(1).onErrorComplete(e -> e.getCause() == null),
+ Flux.just(2).onErrorComplete(e -> e.getCause() != null));
}MonoOnErrorContinue
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoOnErrorContinue")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoOnErrorContinue).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testMonoOnErrorContinue() {
- return Mono.just(1).onErrorContinue(IllegalArgumentException.class::isInstance, (e, v) -> {});
+ return Mono.just(1).onErrorContinue(IllegalArgumentException.class, (e, v) -> {});
}FluxOnErrorContinue
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxOnErrorContinue")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxOnErrorContinue).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxOnErrorContinue() {
- return Flux.just(1).onErrorContinue(IllegalArgumentException.class::isInstance, (e, v) -> {});
+ return Flux.just(1).onErrorContinue(IllegalArgumentException.class, (e, v) -> {});
}MonoOnErrorMap
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoOnErrorMap")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoOnErrorMap).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testMonoOnErrorMap() {
- return Mono.just(1).onErrorMap(IllegalArgumentException.class::isInstance, e -> e);
+ return Mono.just(1).onErrorMap(IllegalArgumentException.class, e -> e);
}FluxOnErrorMap
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxOnErrorMap")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxOnErrorMap).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxOnErrorMap() {
- return Flux.just(1).onErrorMap(IllegalArgumentException.class::isInstance, e -> e);
+ return Flux.just(1).onErrorMap(IllegalArgumentException.class, e -> e);
}MonoOnErrorResume
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoOnErrorResume")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoOnErrorResume).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testMonoOnErrorResume() {
- return Mono.just(1)
- .onErrorResume(IllegalArgumentException.class::isInstance, e -> Mono.just(2));
+ return Mono.just(1).onErrorResume(IllegalArgumentException.class, e -> Mono.just(2));
}FluxOnErrorResume
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxOnErrorResume")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxOnErrorResume).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxOnErrorResume() {
- return Flux.just(1)
- .onErrorResume(IllegalArgumentException.class::isInstance, e -> Flux.just(2));
+ return Flux.just(1).onErrorResume(IllegalArgumentException.class, e -> Flux.just(2));
}MonoOnErrorReturn
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoOnErrorReturn")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoOnErrorReturn).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testMonoOnErrorReturn() {
- return Mono.just(1).onErrorReturn(IllegalArgumentException.class::isInstance, 2);
+ return Mono.just(1).onErrorReturn(IllegalArgumentException.class, 2);
}FluxOnErrorReturn
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxOnErrorReturn")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxOnErrorReturn).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxOnErrorReturn() {
- return Flux.just(1).onErrorReturn(IllegalArgumentException.class::isInstance, 2);
+ return Flux.just(1).onErrorReturn(IllegalArgumentException.class, 2);
}FluxFilterSort
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxFilterSort")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxFilterSort).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxFilterSort() {
- return Flux.just(1, 4, 3, 2).sort().filter(i -> i % 2 == 0);
+ return Flux.just(1, 4, 3, 2).filter(i -> i % 2 == 0).sort();
}FluxFilterSortWithComparator
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxFilterSortWithComparator")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxFilterSortWithComparator).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxFilterSortWithComparator() {
- return Flux.just(1, 4, 3, 2).sort(reverseOrder()).filter(i -> i % 2 == 0);
+ return Flux.just(1, 4, 3, 2).filter(i -> i % 2 == 0).sort(reverseOrder());
}FluxTakeWhile
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxTakeWhile")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxTakeWhile).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxTakeWhile() {
- return Flux.just(1, 2, 3).takeWhile(i -> i % 2 == 0).filter(i -> i % 2 == 0);
+ return Flux.just(1, 2, 3).takeWhile(i -> i % 2 == 0);
}FluxCollectToImmutableList
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxCollectToImmutableList")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxCollectToImmutableList).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<List<Integer>> testFluxCollectToImmutableList() {
- return Flux.just(1).collectList();
+ return Flux.just(1).collect(toImmutableList());
}FluxCollectToImmutableSet
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxCollectToImmutableSet")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxCollectToImmutableSet).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<ImmutableSet<Integer>> testFluxCollectToImmutableSet() {
- return Flux.just(1).collect(toImmutableList()).map(ImmutableSet::copyOf);
+ return Flux.just(1).collect(toImmutableSet());
}FluxSort
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxSort")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxSort).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxSort() {
- return Flux.just(1).sort(naturalOrder());
+ return Flux.just(1).sort();
}FluxTransformMin
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxTransformMin")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxTransformMin).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testFluxTransformMin() {
- return Flux.just(1).sort().next();
+ return Flux.just(1).transform(MathFlux::min).singleOrEmpty();
}FluxTransformMinWithComparator
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxTransformMinWithComparator")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxTransformMinWithComparator).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<Integer>> testFluxTransformMinWithComparator() {
return ImmutableSet.of(
- Flux.just(1).sort(reverseOrder()).next(),
- Flux.just(2).collect(minBy(reverseOrder())).flatMap(Mono::justOrEmpty));
+ Flux.just(1).transform(f -> MathFlux.min(f, reverseOrder())).singleOrEmpty(),
+ Flux.just(2).transform(f -> MathFlux.min(f, reverseOrder())).singleOrEmpty());
}FluxTransformMax
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxTransformMax")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxTransformMax).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Integer> testFluxTransformMax() {
- return Flux.just(1).sort().last();
+ return Flux.just(1).transform(MathFlux::max).singleOrEmpty();
}FluxTransformMaxWithComparator
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxTransformMaxWithComparator")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxTransformMaxWithComparator).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<Integer>> testFluxTransformMaxWithComparator() {
return ImmutableSet.of(
- Flux.just(1).sort(reverseOrder()).last(),
- Flux.just(2).collect(maxBy(reverseOrder())).flatMap(Mono::justOrEmpty));
+ Flux.just(1).transform(f -> MathFlux.max(f, reverseOrder())).singleOrEmpty(),
+ Flux.just(2).transform(f -> MathFlux.max(f, reverseOrder())).singleOrEmpty());
}MathFluxMin
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MathFluxMin")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MathFluxMin).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<Integer>> testMathFluxMin() {
- return ImmutableSet.of(
- MathFlux.min(Flux.just(1), naturalOrder()), MathFlux.max(Flux.just(2), reverseOrder()));
+ return ImmutableSet.of(MathFlux.min(Flux.just(1)), MathFlux.min(Flux.just(2)));
}MathFluxMax
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MathFluxMax")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MathFluxMax).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Mono<Integer>> testMathFluxMax() {
- return ImmutableSet.of(
- MathFlux.min(Flux.just(1), reverseOrder()), MathFlux.max(Flux.just(2), naturalOrder()));
+ return ImmutableSet.of(MathFlux.max(Flux.just(1)), MathFlux.max(Flux.just(2)));
}ContextEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ContextEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$ContextEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Context> testContextEmpty() {
- return ImmutableSet.of(Context.of(ImmutableMap.of()), Context.of(ImmutableMap.of(1, 2)));
+ return ImmutableSet.of(Context.empty(), Context.of(ImmutableMap.of(1, 2)));
}PublisherProbeEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("PublisherProbeEmpty")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$PublisherProbeEmpty).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<PublisherProbe<Void>> testPublisherProbeEmpty() {
- return ImmutableSet.of(PublisherProbe.of(Mono.empty()), PublisherProbe.of(Flux.empty()));
+ return ImmutableSet.of(PublisherProbe.empty(), PublisherProbe.empty());
}PublisherProbeAssertWasSubscribed
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("PublisherProbeAssertWasSubscribed")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$PublisherProbeAssertWasSubscribed).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testPublisherProbeAssertWasSubscribed() {
- assertThat(PublisherProbe.of(Mono.just(1)).wasSubscribed()).isTrue();
- assertThat(PublisherProbe.of(Mono.just(2)).subscribeCount()).isNotNegative();
- assertThat(PublisherProbe.of(Mono.just(3)).subscribeCount()).isNotEqualTo(0);
- assertThat(PublisherProbe.of(Mono.just(4)).subscribeCount()).isPositive();
+ PublisherProbe.of(Mono.just(1)).assertWasSubscribed();
+ PublisherProbe.of(Mono.just(2)).assertWasSubscribed();
+ PublisherProbe.of(Mono.just(3)).assertWasSubscribed();
+ PublisherProbe.of(Mono.just(4)).assertWasSubscribed();
}PublisherProbeAssertWasNotSubscribed
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("PublisherProbeAssertWasNotSubscribed")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$PublisherProbeAssertWasNotSubscribed).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testPublisherProbeAssertWasNotSubscribed() {
- assertThat(PublisherProbe.of(Mono.just(1)).wasSubscribed()).isFalse();
- assertThat(PublisherProbe.of(Mono.just(2)).subscribeCount()).isEqualTo(0);
- assertThat(PublisherProbe.of(Mono.just(3)).subscribeCount()).isNotPositive();
+ PublisherProbe.of(Mono.just(1)).assertWasNotSubscribed();
+ PublisherProbe.of(Mono.just(2)).assertWasNotSubscribed();
+ PublisherProbe.of(Mono.just(3)).assertWasNotSubscribed();
}PublisherProbeAssertWasCancelled
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("PublisherProbeAssertWasCancelled")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$PublisherProbeAssertWasCancelled).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testPublisherProbeAssertWasCancelled() {
- assertThat(PublisherProbe.empty().wasCancelled()).isTrue();
+ PublisherProbe.empty().assertWasCancelled();
}PublisherProbeAssertWasNotCancelled
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("PublisherProbeAssertWasNotCancelled")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$PublisherProbeAssertWasNotCancelled).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testPublisherProbeAssertWasNotCancelled() {
- assertThat(PublisherProbe.empty().wasCancelled()).isFalse();
+ PublisherProbe.empty().assertWasNotCancelled();
}PublisherProbeAssertWasRequested
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("PublisherProbeAssertWasRequested")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$PublisherProbeAssertWasRequested).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testPublisherProbeAssertWasRequested() {
- assertThat(PublisherProbe.empty().wasRequested()).isTrue();
+ PublisherProbe.empty().assertWasRequested();
}PublisherProbeAssertWasNotRequested
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("PublisherProbeAssertWasNotRequested")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$PublisherProbeAssertWasNotRequested).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
void testPublisherProbeAssertWasNotRequested() {
- assertThat(PublisherProbe.empty().wasRequested()).isFalse();
+ PublisherProbe.empty().assertWasNotRequested();
}AssertThatPublisherProbeWasSubscribed
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatPublisherProbeWasSubscribed")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$AssertThatPublisherProbeWasSubscribed).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
@SuppressWarnings("SimplifyBooleanExpression")
void testAssertThatPublisherProbeWasSubscribed() {
- if (true) {
- PublisherProbe.of(Mono.just(1)).assertWasSubscribed();
- } else {
- PublisherProbe.of(Mono.just(1)).assertWasNotSubscribed();
- }
- if (!false) {
- PublisherProbe.of(Mono.just(2)).assertWasNotSubscribed();
- } else {
- PublisherProbe.of(Mono.just(2)).assertWasSubscribed();
- }
+ assertThat(PublisherProbe.of(Mono.just(1)).wasSubscribed()).isEqualTo(true);
+ assertThat(PublisherProbe.of(Mono.just(2)).wasSubscribed()).isEqualTo(false);
}AssertThatPublisherProbeWasCancelled
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatPublisherProbeWasCancelled")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$AssertThatPublisherProbeWasCancelled).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
@SuppressWarnings("SimplifyBooleanExpression")
void testAssertThatPublisherProbeWasCancelled() {
- if (true) {
- PublisherProbe.of(Mono.just(1)).assertWasCancelled();
- } else {
- PublisherProbe.of(Mono.just(1)).assertWasNotCancelled();
- }
- if (!false) {
- PublisherProbe.of(Mono.just(2)).assertWasNotCancelled();
- } else {
- PublisherProbe.of(Mono.just(2)).assertWasCancelled();
- }
+ assertThat(PublisherProbe.of(Mono.just(1)).wasCancelled()).isEqualTo(true);
+ assertThat(PublisherProbe.of(Mono.just(2)).wasCancelled()).isEqualTo(false);
}AssertThatPublisherProbeWasRequested
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("AssertThatPublisherProbeWasRequested")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$AssertThatPublisherProbeWasRequested).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
@SuppressWarnings("SimplifyBooleanExpression")
void testAssertThatPublisherProbeWasRequested() {
- if (true) {
- PublisherProbe.of(Mono.just(1)).assertWasRequested();
- } else {
- PublisherProbe.of(Mono.just(1)).assertWasNotRequested();
- }
- if (!false) {
- PublisherProbe.of(Mono.just(2)).assertWasNotRequested();
- } else {
- PublisherProbe.of(Mono.just(2)).assertWasRequested();
- }
+ assertThat(PublisherProbe.of(Mono.just(1)).wasRequested()).isEqualTo(true);
+ assertThat(PublisherProbe.of(Mono.just(2)).wasRequested()).isEqualTo(false);
}StepVerifierFromMono
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierFromMono")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierFromMono).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<StepVerifier.FirstStep<Integer>> testStepVerifierFromMono() {
return ImmutableSet.of(
- StepVerifier.create(Mono.just(1)), Mono.just(2).flux().as(StepVerifier::create));
+ Mono.just(1).as(StepVerifier::create), Mono.just(2).as(StepVerifier::create));
}StepVerifierFromFlux
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierFromFlux")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierFromFlux).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
StepVerifier.FirstStep<Integer> testStepVerifierFromFlux() {
- return StepVerifier.create(Flux.just(1));
+ return Flux.just(1).as(StepVerifier::create);
}StepVerifierVerify
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierVerify")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierVerify).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Object testStepVerifierVerify() {
- return Mono.empty().as(StepVerifier::create).expectError().verifyThenAssertThat();
+ return Mono.empty().as(StepVerifier::create).expectError().verify();
}StepVerifierVerifyDuration
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierVerifyDuration")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierVerifyDuration).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Object testStepVerifierVerifyDuration() {
- return Mono.empty().as(StepVerifier::create).expectError().verifyThenAssertThat(Duration.ZERO);
+ return Mono.empty().as(StepVerifier::create).expectError().verify(Duration.ZERO);
}StepVerifierVerifyLater
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierVerifyLater")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierVerifyLater).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
StepVerifier testStepVerifierVerifyLater() {
- return Mono.empty().as(StepVerifier::create).expectError().verifyLater().verifyLater();
+ return Mono.empty().as(StepVerifier::create).expectError().verifyLater();
}StepVerifierStepIdentity
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierStepIdentity")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierStepIdentity).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<StepVerifier.Step<Integer>> testStepVerifierStepIdentity() {
return ImmutableSet.of(
- Mono.just(1).as(StepVerifier::create).expectNext(),
- Mono.just(2).as(StepVerifier::create).expectNextCount(0L),
- Mono.just(3).as(StepVerifier::create).expectNextSequence(ImmutableList.of()),
+ Mono.just(1).as(StepVerifier::create),
+ Mono.just(2).as(StepVerifier::create),
+ Mono.just(3).as(StepVerifier::create),
Mono.just(4).as(StepVerifier::create).expectNextSequence(ImmutableList.of(5)));
}StepVerifierStepExpectNext
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierStepExpectNext")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierStepExpectNext).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<StepVerifier.Step<String>> testStepVerifierStepExpectNext() {
return ImmutableSet.of(
- Mono.just("foo").as(StepVerifier::create).expectNextMatches(s -> s.equals("bar")),
- Mono.just("baz").as(StepVerifier::create).expectNextMatches("qux"::equals));
+ Mono.just("foo").as(StepVerifier::create).expectNext("bar"),
+ Mono.just("baz").as(StepVerifier::create).expectNext("qux"));
}FluxAsStepVerifierExpectNext
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxAsStepVerifierExpectNext")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxAsStepVerifierExpectNext).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
StepVerifier.Step<?> testFluxAsStepVerifierExpectNext() {
- return Flux.just(1)
- .collect(toImmutableList())
- .as(StepVerifier::create)
- .assertNext(list -> assertThat(list).containsExactly(2));
+ return Flux.just(1).as(StepVerifier::create).expectNext(2);
}StepVerifierLastStepVerifyComplete
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierLastStepVerifyComplete")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierLastStepVerifyComplete).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Duration testStepVerifierLastStepVerifyComplete() {
- return Mono.empty().as(StepVerifier::create).expectComplete().verify();
+ return Mono.empty().as(StepVerifier::create).verifyComplete();
}StepVerifierLastStepVerifyError
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierLastStepVerifyError")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierLastStepVerifyError).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Duration testStepVerifierLastStepVerifyError() {
- return Mono.empty().as(StepVerifier::create).expectError().verify();
+ return Mono.empty().as(StepVerifier::create).verifyError();
}StepVerifierLastStepVerifyErrorClass
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierLastStepVerifyErrorClass")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierLastStepVerifyErrorClass).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Duration> testStepVerifierLastStepVerifyErrorClass() {
return ImmutableSet.of(
- Mono.empty().as(StepVerifier::create).expectError(IllegalArgumentException.class).verify(),
- Mono.empty()
- .as(StepVerifier::create)
- .verifyErrorMatches(IllegalStateException.class::isInstance),
- Mono.empty()
- .as(StepVerifier::create)
- .verifyErrorSatisfies(t -> assertThat(t).isInstanceOf(AssertionError.class)));
+ Mono.empty().as(StepVerifier::create).verifyError(IllegalArgumentException.class),
+ Mono.empty().as(StepVerifier::create).verifyError(IllegalStateException.class),
+ Mono.empty().as(StepVerifier::create).verifyError(AssertionError.class));
}StepVerifierLastStepVerifyErrorMatches
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierLastStepVerifyErrorMatches")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierLastStepVerifyErrorMatches).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<?> testStepVerifierLastStepVerifyErrorMatches() {
return ImmutableSet.of(
Mono.empty()
.as(StepVerifier::create)
- .expectErrorMatches(IllegalArgumentException.class::equals)
- .verify(),
+ .verifyErrorMatches(IllegalArgumentException.class::equals),
Mono.empty()
.as(StepVerifier::create)
- .expectError()
- .verifyThenAssertThat()
- .hasOperatorErrorMatching(IllegalStateException.class::equals));
+ .verifyErrorMatches(IllegalStateException.class::equals));
}StepVerifierLastStepVerifyErrorSatisfies
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierLastStepVerifyErrorSatisfies")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierLastStepVerifyErrorSatisfies).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Duration testStepVerifierLastStepVerifyErrorSatisfies() {
- return Mono.empty().as(StepVerifier::create).expectErrorSatisfies(t -> {}).verify();
+ return Mono.empty().as(StepVerifier::create).verifyErrorSatisfies(t -> {});
}StepVerifierLastStepVerifyErrorSatisfiesAssertJ
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierLastStepVerifyErrorSatisfiesAssertJ")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierLastStepVerifyErrorSatisfiesAssertJ).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<?> testStepVerifierLastStepVerifyErrorSatisfiesAssertJ() {
return ImmutableSet.of(
Mono.empty()
.as(StepVerifier::create)
- .expectError()
- .verifyThenAssertThat()
- .hasOperatorErrorOfType(IllegalArgumentException.class)
- .hasOperatorErrorWithMessage("foo"),
+ .verifyErrorSatisfies(
+ t -> assertThat(t).isInstanceOf(IllegalArgumentException.class).hasMessage("foo")),
Mono.empty()
.as(StepVerifier::create)
- .expectError(IllegalStateException.class)
- .verifyThenAssertThat()
- .hasOperatorErrorWithMessage("bar"),
+ .verifyErrorSatisfies(
+ t -> assertThat(t).isInstanceOf(IllegalStateException.class).hasMessage("bar")),
Mono.empty()
.as(StepVerifier::create)
- .expectErrorMessage("baz")
- .verifyThenAssertThat()
- .hasOperatorErrorOfType(AssertionError.class));
+ .verifyErrorSatisfies(
+ t -> assertThat(t).isInstanceOf(AssertionError.class).hasMessage("baz")));
}StepVerifierLastStepVerifyErrorMessage
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierLastStepVerifyErrorMessage")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierLastStepVerifyErrorMessage).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Duration testStepVerifierLastStepVerifyErrorMessage() {
- return Mono.empty().as(StepVerifier::create).expectErrorMessage("foo").verify();
+ return Mono.empty().as(StepVerifier::create).verifyErrorMessage("foo");
}StepVerifierLastStepVerifyTimeout
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StepVerifierLastStepVerifyTimeout")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$StepVerifierLastStepVerifyTimeout).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Duration testStepVerifierLastStepVerifyTimeout() {
- return Mono.empty().as(StepVerifier::create).expectTimeout(Duration.ZERO).verify();
+ return Mono.empty().as(StepVerifier::create).verifyTimeout(Duration.ZERO);
}MonoFromFutureSupplier
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFromFutureSupplier")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFromFutureSupplier).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Void> testMonoFromFutureSupplier() {
- return Mono.fromFuture(CompletableFuture.completedFuture(null));
+ return Mono.fromFuture(() -> CompletableFuture.completedFuture(null));
}MonoFromFutureSupplierBoolean
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFromFutureSupplierBoolean")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFromFutureSupplierBoolean).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Void> testMonoFromFutureSupplierBoolean() {
- return Mono.fromFuture(CompletableFuture.completedFuture(null), true);
+ return Mono.fromFuture(() -> CompletableFuture.completedFuture(null), true);
}MonoFromFutureAsyncLoadingCacheGet
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFromFutureAsyncLoadingCacheGet")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFromFutureAsyncLoadingCacheGet).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<String> testMonoFromFutureAsyncLoadingCacheGet() {
- return Mono.fromFuture(() -> ((AsyncLoadingCache<Integer, String>) null).get(0));
+ return Mono.fromFuture(() -> ((AsyncLoadingCache<Integer, String>) null).get(0), true);
}MonoFromFutureAsyncLoadingCacheGetAll
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MonoFromFutureAsyncLoadingCacheGetAll")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$MonoFromFutureAsyncLoadingCacheGetAll).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<Map<Integer, String>> testMonoFromFutureAsyncLoadingCacheGetAll() {
return Mono.fromFuture(
- () -> ((AsyncLoadingCache<Integer, String>) null).getAll(ImmutableSet.of()));
+ () -> ((AsyncLoadingCache<Integer, String>) null).getAll(ImmutableSet.of()), true);
}FluxFromStreamSupplier
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxFromStreamSupplier")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxFromStreamSupplier).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Flux<Integer> testFluxFromStreamSupplier() {
- return Flux.fromStream(Stream.of(1));
+ return Flux.fromStream(() -> Stream.of(1));
}FluxNext
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FluxNext")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ReactorRules\$FluxNext).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Mono<String> testFluxNext() {
- return Mono.from(Flux.just("foo"));
+ return Flux.just("foo").next();
}