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
- MonoDeferredError
- FluxDeferredError
- MonoErrorSupplier
- FluxErrorSupplier
- MonoThenReturn
- FluxTake
- MonoDefaultIfEmpty
- FluxDefaultIfEmpty
- MonoIdentity
- FluxSwitchIfEmptyOfEmptyPublisher
- FluxConcatMap
- FluxConcatMapWithPrefetch
- FluxConcatMapIterable
- FluxConcatMapIterableWithPrefetch
- MonoFlatMapToFlux
- MonoMap
- FluxMap
- MonoMapNotNull
- FluxMapNotNull
- MonoFlux
- MonoThen
- MonoSingleOptional
- MonoCast
- FluxCast
- MonoFlatMap
- MonoFlatMapMany
- ConcatMapIterableIdentity
- ConcatMapIterableIdentityWithPrefetch
- FluxCountMapMathToIntExact
- MonoDoOnError
- FluxDoOnError
- MonoOnErrorComplete
- FluxOnErrorComplete
- MonoOnErrorCompleteClass
- FluxOnErrorCompleteClass
- MonoOnErrorCompletePredicate
- FluxOnErrorCompletePredicate
- MonoOnErrorContinue
- FluxOnErrorContinue
- MonoOnErrorMap
- FluxOnErrorMap
- MonoOnErrorResume
- FluxOnErrorResume
- MonoOnErrorReturn
- FluxOnErrorReturn
- FluxFilterSort
- FluxFilterSortWithComparator
- FluxCollectToImmutableList
- FluxCollectToImmutableSet
- ContextEmpty
- PublisherProbeEmpty
- StepVerifierFromMono
- StepVerifierFromFlux
- StepVerifierStepIdentity
- StepVerifierStepExpectNext
- StepVerifierLastStepVerifyComplete
- StepVerifierLastStepVerifyError
- StepVerifierLastStepVerifyErrorClass
- StepVerifierLastStepVerifyErrorMatches
- StepVerifierLastStepVerifyErrorSatisfies
- StepVerifierLastStepVerifyErrorMessage
- StepVerifierLastStepVerifyTimeout
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.
Mono<Integer> testMonoJust() {
- return Mono.justOrEmpty(Optional.of(1));
+ return Mono.just(1);
}
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<String> testFluxZipWithIterable() {
- 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.
Mono<String> testMonoThenReturn() {
- return Mono.empty().then(Mono.just("foo"));
+ return Mono.empty().thenReturn("foo");
}
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);
+ return Flux.just(1, 2, 3).take(1, true);
}
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"));
}
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().then(),
- Mono.<ImmutableList<String>>empty().map(ImmutableList::copyOf));
+ Mono.just(1),
+ Mono.just(2),
+ Mono.just(3),
+ Mono.<Void>empty(),
+ Mono.<ImmutableList<String>>empty());
}
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).flatMap(Mono::just, 1),
- Flux.just(2).flatMapSequential(Mono::just, 1),
- Flux.just(3).map(Mono::just).concatMap(identity()));
+ Flux.just(1).concatMap(Mono::just),
+ Flux.just(2).concatMap(Mono::just),
+ Flux.just(3).concatMap(Mono::just));
}
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(1).concatMap(Mono::just, 3),
+ Flux.just(2).concatMap(Mono::just, 4),
+ Flux.just(3).concatMap(Mono::just, 5));
}
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.
Flux<Integer> testFluxConcatMapIterable() {
- return Flux.just(1, 2).flatMapIterable(ImmutableList::of);
+ return Flux.just(1, 2).concatMapIterable(ImmutableList::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.
Flux<Integer> testFluxConcatMapIterableWithPrefetch() {
- return Flux.just(1, 2).flatMapIterable(ImmutableList::of, 3);
+ return Flux.just(1, 2).concatMapIterable(ImmutableList::of, 3);
}
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));
}
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.
Mono<Void> testMonoThen() {
- return Mono.just("foo").flux().then();
+ return Mono.just("foo").then();
}
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).defaultIfEmpty(Optional.empty()));
+ return ImmutableSet.of(Mono.just("foo").singleOptional(), Mono.just("bar").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);
}
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.
Mono<String> testMonoFlatMap() {
- return Mono.just("foo").map(Mono::just).flatMap(identity());
+ return Mono.just("foo").flatMap(Mono::just);
}
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.
Flux<String> testMonoFlatMapMany() {
- return Mono.just("foo").map(Mono::just).flatMapMany(identity());
+ return Mono.just("foo").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));
}
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());
}
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());
}
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(new HashMap<>()), Context.of(ImmutableMap.of()));
+ return ImmutableSet.of(Context.empty(), Context.empty());
}
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());
}
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.
StepVerifier.FirstStep<Integer> testStepVerifierFromMono() {
- return StepVerifier.create(Mono.just(1));
+ return Mono.just(1).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);
}
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(
- StepVerifier.create(Mono.just(1)).expectNext(),
- StepVerifier.create(Mono.just(2)).expectNextCount(0L));
+ return ImmutableSet.of(StepVerifier.create(Mono.just(1)), StepVerifier.create(Mono.just(2)));
}
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(
- StepVerifier.create(Mono.just("foo")).expectNextMatches(s -> s.equals("bar")),
- StepVerifier.create(Mono.just("baz")).expectNextMatches("qux"::equals));
+ StepVerifier.create(Mono.just("foo")).expectNext("bar"),
+ StepVerifier.create(Mono.just("baz")).expectNext("qux"));
}
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 StepVerifier.create(Mono.empty()).expectComplete().verify();
+ return StepVerifier.create(Mono.empty()).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 StepVerifier.create(Mono.empty()).expectError().verify();
+ return StepVerifier.create(Mono.empty()).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(
- StepVerifier.create(Mono.empty()).expectError(IllegalArgumentException.class).verify(),
- StepVerifier.create(Mono.empty())
- .verifyErrorSatisfies(t -> assertThat(t).isInstanceOf(IllegalStateException.class)));
+ StepVerifier.create(Mono.empty()).verifyError(IllegalArgumentException.class),
+ StepVerifier.create(Mono.empty()).verifyError(IllegalStateException.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.
Duration testStepVerifierLastStepVerifyErrorMatches() {
return StepVerifier.create(Mono.empty())
- .expectErrorMatches(IllegalArgumentException.class::equals)
- .verify();
+ .verifyErrorMatches(IllegalArgumentException.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 StepVerifier.create(Mono.empty()).expectErrorSatisfies(t -> {}).verify();
+ return StepVerifier.create(Mono.empty()).verifyErrorSatisfies(t -> {});
}
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 StepVerifier.create(Mono.empty()).expectErrorMessage("foo").verify();
+ return StepVerifier.create(Mono.empty()).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 StepVerifier.create(Mono.empty()).expectTimeout(Duration.ZERO).verify();
+ return StepVerifier.create(Mono.empty()).verifyTimeout(Duration.ZERO);
}