mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 08:11:25 +00:00
Add minor improvements and cleanup
This commit is contained in:
@@ -681,7 +681,7 @@ final class RxJavaFlowableToReactorTemplates {
|
||||
|
||||
@AfterTemplate
|
||||
Single<T> after(Flowable<T> flowable) {
|
||||
return RxJava2Adapter.monoToSingle(RxJava2Adapter.flowableToFlux(flowable).next());
|
||||
return RxJava2Adapter.monoToSingle(RxJava2Adapter.flowableToFlux(flowable).next().single());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ final class RxJavaSingleToReactorTemplates {
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Test this one.
|
||||
// XXX: Write a test.
|
||||
abstract static class SingleFlatMapUnwrapLambda<T, R> {
|
||||
@Placeholder
|
||||
abstract Mono<? extends R> placeholder(@MayOptionallyUse T input);
|
||||
@@ -530,7 +530,12 @@ final class RxJavaSingleToReactorTemplates {
|
||||
e ->
|
||||
RxJava2Adapter.singleToMono(
|
||||
Single.wrap(
|
||||
RxJavaReactorMigrationUtil.toJdkFunction(function).apply(e)))));
|
||||
RxJavaReactorMigrationUtil.toJdkFunction(
|
||||
(Function<
|
||||
? super Throwable,
|
||||
? extends SingleSource<? extends T>>)
|
||||
function)
|
||||
.apply(e)))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -207,17 +207,17 @@ public final class RxJavaToReactorTemplates {
|
||||
@SuppressWarnings("NoFunctionalReturnType")
|
||||
static final class UnnecessaryConsumerConversion<T> {
|
||||
@BeforeTemplate
|
||||
java.util.function.Consumer<T> before(@CanTransformToTargetType Consumer<T> consumer) {
|
||||
java.util.function.Consumer<? extends T> before(@CanTransformToTargetType Consumer<? extends T> consumer) {
|
||||
return RxJavaReactorMigrationUtil.toJdkConsumer(consumer);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
java.util.function.Consumer<T> after(java.util.function.Consumer<T> consumer) {
|
||||
java.util.function.Consumer<? extends T> after(java.util.function.Consumer<? extends T> consumer) {
|
||||
return consumer;
|
||||
}
|
||||
}
|
||||
|
||||
static final class UnnecessaryRunnableConversion<T> {
|
||||
static final class UnnecessaryRunnableConversion {
|
||||
@BeforeTemplate
|
||||
Runnable before(@CanTransformToTargetType Action action) {
|
||||
return RxJavaReactorMigrationUtil.toRunnable(action);
|
||||
@@ -229,16 +229,15 @@ public final class RxJavaToReactorTemplates {
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: This one is without CanBeTransformedTo...
|
||||
@SuppressWarnings("NoFunctionalReturnType")
|
||||
static final class UnnecessaryPredicateConversion<T> {
|
||||
@BeforeTemplate
|
||||
java.util.function.Predicate<T> before(Predicate<T> predicate) {
|
||||
java.util.function.Predicate<? extends T> before(@CanTransformToTargetType Predicate<? extends T> predicate) {
|
||||
return RxJavaReactorMigrationUtil.toJdkPredicate(predicate);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
java.util.function.Predicate<T> after(java.util.function.Predicate<T> predicate) {
|
||||
java.util.function.Predicate<? extends T> after(java.util.function.Predicate<? extends T> predicate) {
|
||||
return predicate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ final class RxJavaFlowableToReactorTemplatesTest implements RefasterTemplateTest
|
||||
}
|
||||
|
||||
Single<Integer> testFlowableFirstOrError() {
|
||||
return RxJava2Adapter.monoToSingle(RxJava2Adapter.flowableToFlux(Flowable.just(1)).next());
|
||||
return RxJava2Adapter.monoToSingle(RxJava2Adapter.flowableToFlux(Flowable.just(1)).next().single());
|
||||
}
|
||||
|
||||
Completable testFlowableFlatMapCompletable() {
|
||||
|
||||
Reference in New Issue
Block a user