RxJava2AdapterRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

Disable all rules by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$).* as compiler argument.

Table of contents
  1. CompletableToMono
  2. FlowableToFlux
  3. FluxToFlowable
  4. FluxToObservable
  5. MaybeToMono
  6. MonoToCompletable
  7. MonoToFlowable
  8. MonoToMaybe
  9. MonoToSingle
  10. ObservableToFlux
  11. SingleToMono

CompletableToMono

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("CompletableToMono") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$CompletableToMono).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Mono<Void>> testCompletableToMono() {
   return ImmutableSet.of(
-      RxJava2Adapter.completableToMono(Completable.complete()),
-      Completable.complete().to(RxJava2Adapter::completableToMono));
+      Completable.complete().as(RxJava2Adapter::completableToMono),
+      Completable.complete().as(RxJava2Adapter::completableToMono));
 }

FlowableToFlux

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("FlowableToFlux") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$FlowableToFlux).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Flux<Integer>> testFlowableToFlux() {
   return ImmutableSet.of(
-      Flux.from(Flowable.just(1)),
-      Flowable.just(2).to(Flux::from),
-      Flowable.just(3).as(Flux::from),
-      RxJava2Adapter.flowableToFlux(Flowable.just(4)),
-      Flowable.just(5).to(RxJava2Adapter::flowableToFlux));
+      Flowable.just(1).as(RxJava2Adapter::flowableToFlux),
+      Flowable.just(2).as(RxJava2Adapter::flowableToFlux),
+      Flowable.just(3).as(RxJava2Adapter::flowableToFlux),
+      Flowable.just(4).as(RxJava2Adapter::flowableToFlux),
+      Flowable.just(5).as(RxJava2Adapter::flowableToFlux));
 }

FluxToFlowable

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("FluxToFlowable") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$FluxToFlowable).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Flowable<String>> testFluxToFlowable() {
   return ImmutableSet.of(
-      Flowable.fromPublisher(Flux.just("foo")),
-      Flux.just("bar").as(Flowable::fromPublisher),
-      RxJava2Adapter.fluxToFlowable(Flux.just("baz")));
+      Flux.just("foo").as(RxJava2Adapter::fluxToFlowable),
+      Flux.just("bar").as(RxJava2Adapter::fluxToFlowable),
+      Flux.just("baz").as(RxJava2Adapter::fluxToFlowable));
 }

FluxToObservable

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("FluxToObservable") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$FluxToObservable).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Observable<Integer>> testFluxToObservable() {
   return ImmutableSet.of(
-      Observable.fromPublisher(Flux.just(1)),
-      Flux.just(2).as(Observable::fromPublisher),
-      RxJava2Adapter.fluxToObservable(Flux.just(3)));
+      Flux.just(1).as(RxJava2Adapter::fluxToObservable),
+      Flux.just(2).as(RxJava2Adapter::fluxToObservable),
+      Flux.just(3).as(RxJava2Adapter::fluxToObservable));
 }

MaybeToMono

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("MaybeToMono") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$MaybeToMono).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Mono<String>> testMaybeToMono() {
   return ImmutableSet.of(
-      RxJava2Adapter.maybeToMono(Maybe.just("foo")),
-      Maybe.just("bar").to(RxJava2Adapter::maybeToMono));
+      Maybe.just("foo").as(RxJava2Adapter::maybeToMono),
+      Maybe.just("bar").as(RxJava2Adapter::maybeToMono));
 }

MonoToCompletable

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("MonoToCompletable") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$MonoToCompletable).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Completable> testMonoToCompletable() {
   return ImmutableSet.of(
-      Completable.fromPublisher(Mono.empty()),
-      Mono.empty().as(Completable::fromPublisher),
-      RxJava2Adapter.monoToCompletable(Mono.empty()));
+      Mono.empty().as(RxJava2Adapter::monoToCompletable),
+      Mono.empty().as(RxJava2Adapter::monoToCompletable),
+      Mono.empty().as(RxJava2Adapter::monoToCompletable));
 }

MonoToFlowable

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("MonoToFlowable") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$MonoToFlowable).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Flowable<Integer>> testMonoToFlowable() {
   return ImmutableSet.of(
-      Flowable.fromPublisher(Mono.just(1)),
-      Mono.just(2).as(Flowable::fromPublisher),
-      RxJava2Adapter.monoToFlowable(Mono.just(3)));
+      Mono.just(1).as(RxJava2Adapter::monoToFlowable),
+      Mono.just(2).as(RxJava2Adapter::monoToFlowable),
+      Mono.just(3).as(RxJava2Adapter::monoToFlowable));
 }

MonoToMaybe

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("MonoToMaybe") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$MonoToMaybe).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 Maybe<String> testMonoToMaybe() {
-  return RxJava2Adapter.monoToMaybe(Mono.just("foo"));
+  return Mono.just("foo").as(RxJava2Adapter::monoToMaybe);
 }

MonoToSingle

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("MonoToSingle") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$MonoToSingle).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Single<Integer>> testMonoToSingle() {
   return ImmutableSet.of(
-      Single.fromPublisher(Mono.just(1)),
-      Mono.just(2).as(Single::fromPublisher),
-      RxJava2Adapter.monoToSingle(Mono.just(3)));
+      Mono.just(1).as(RxJava2Adapter::monoToSingle),
+      Mono.just(2).as(RxJava2Adapter::monoToSingle),
+      Mono.just(3).as(RxJava2Adapter::monoToSingle));
 }

ObservableToFlux

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("ObservableToFlux") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$ObservableToFlux).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Flux<String>> testObservableToFlux() {
   return ImmutableSet.of(
-      RxJava2Adapter.observableToFlux(Observable.just("foo"), BackpressureStrategy.BUFFER),
+      Observable.just("foo")
+          .toFlowable(BackpressureStrategy.BUFFER)
+          .as(RxJava2Adapter::flowableToFlux),
       Observable.just("bar")
-          .as(obs -> RxJava2Adapter.observableToFlux(obs, BackpressureStrategy.DROP)),
+          .toFlowable(BackpressureStrategy.DROP)
+          .as(RxJava2Adapter::flowableToFlux),
       Observable.just("baz")
-          .to(obs -> RxJava2Adapter.observableToFlux(obs, BackpressureStrategy.ERROR)));
+          .toFlowable(BackpressureStrategy.ERROR)
+          .as(RxJava2Adapter::flowableToFlux));
 }

SingleToMono

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("SingleToMono") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!RxJava2AdapterRules\$SingleToMono).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Mono<Integer>> testSingleToMono() {
   return ImmutableSet.of(
-      RxJava2Adapter.singleToMono(Single.just(1)),
-      Single.just(2).to(RxJava2Adapter::singleToMono));
+      Single.just(1).as(RxJava2Adapter::singleToMono),
+      Single.just(2).as(RxJava2Adapter::singleToMono));
 }

Copyright © 2017-2024 Picnic Technologies BV