| 1 |
/* |
| 2 |
* Copyright (c) 2016-present, RxJava Contributors. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in |
| 5 |
* compliance with the License. You may obtain a copy of the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software distributed under the License is |
| 10 |
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See |
| 11 |
* the License for the specific language governing permissions and limitations under the License. |
| 12 |
*/ |
| 13 |
|
| 14 |
package io.reactivex.rxjava3.validators; |
| 15 |
|
| 16 |
import java.lang.reflect.*; |
| 17 |
import java.time.Duration; |
| 18 |
import java.util.*; |
| 19 |
import java.util.concurrent.*; |
| 20 |
import java.util.stream.*; |
| 21 |
|
| 22 |
import org.junit.Test; |
| 23 |
import org.reactivestreams.*; |
| 24 |
|
| 25 |
import io.reactivex.rxjava3.core.*; |
| 26 |
import io.reactivex.rxjava3.core.Observable; |
| 27 |
import io.reactivex.rxjava3.core.Observer; |
| 28 |
import io.reactivex.rxjava3.disposables.*; |
| 29 |
import io.reactivex.rxjava3.exceptions.TestException; |
| 30 |
import io.reactivex.rxjava3.functions.*; |
| 31 |
import io.reactivex.rxjava3.internal.functions.Functions; |
| 32 |
import io.reactivex.rxjava3.parallel.*; |
| 33 |
import io.reactivex.rxjava3.plugins.RxJavaPlugins; |
| 34 |
import io.reactivex.rxjava3.schedulers.Schedulers; |
| 35 |
import io.reactivex.rxjava3.testsupport.TestHelper; |
| 36 |
|
| 37 |
/** |
| 38 |
* Check that static and instance methods validate their parameters against |
| 39 |
* null and invalid values properly. |
| 40 |
*/ |
| 41 |
public class ParamValidationCheckerTest { |
| 42 |
|
| 43 |
@Test(timeout = 30000) |
| 44 |
public void checkFlowable() { |
| 45 |
checkClass(Flowable.class); |
| 46 |
} |
| 47 |
|
| 48 |
@Test(timeout = 30000) |
| 49 |
public void checkObservable() { |
| 50 |
checkClass(Observable.class); |
| 51 |
} |
| 52 |
|
| 53 |
@Test(timeout = 30000) |
| 54 |
public void checkSingle() { |
| 55 |
checkClass(Single.class); |
| 56 |
} |
| 57 |
|
| 58 |
@Test(timeout = 30000) |
| 59 |
public void checkMaybe() { |
| 60 |
checkClass(Maybe.class); |
| 61 |
} |
| 62 |
|
| 63 |
@Test(timeout = 30000) |
| 64 |
public void checkCompletable() { |
| 65 |
checkClass(Completable.class); |
| 66 |
} |
| 67 |
|
| 68 |
@Test(timeout = 30000) |
| 69 |
public void checkParallelFlowable() { |
| 70 |
checkClass(ParallelFlowable.class); |
| 71 |
} |
| 72 |
|
| 73 |
// --------------------------------------------------------------------------------------- |
| 74 |
// --------------------------------------------------------------------------------------- |
| 75 |
|
| 76 |
static Map<String, List<ParamOverride>> overrides; |
| 77 |
|
| 78 |
static Map<String, List<ParamIgnore>> ignores; |
| 79 |
|
| 80 |
static Map<Class<?>, Object> defaultValues; |
| 81 |
|
| 82 |
static Map<Class<?>, List<Object>> defaultInstances; |
| 83 |
|
| 84 |
static { |
| 85 |
overrides = new HashMap<>(); |
| 86 |
|
| 87 |
// *********************************************************************************************************************** |
| 88 |
|
| 89 |
// zero index allowed |
| 90 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "elementAt", Long.TYPE)); |
| 91 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "elementAt", Long.TYPE, Object.class)); |
| 92 |
|
| 93 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "elementAtOrError", Long.TYPE)); |
| 94 |
|
| 95 |
// negative skip count is ignored |
| 96 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "skip", Long.TYPE)); |
| 97 |
// negative skip time is considered as zero skip time |
| 98 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "skip", Long.TYPE, TimeUnit.class)); |
| 99 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "skip", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 100 |
|
| 101 |
// can start with zero initial request |
| 102 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "test", Long.TYPE)); |
| 103 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "test", Long.TYPE, Boolean.TYPE)); |
| 104 |
|
| 105 |
// negative timeout time is considered as zero timeout time |
| 106 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class)); |
| 107 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 108 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, Publisher.class)); |
| 109 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, Scheduler.class, Publisher.class)); |
| 110 |
|
| 111 |
// negative buffer time is considered as zero buffer time |
| 112 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, TimeUnit.class)); |
| 113 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, TimeUnit.class, Integer.TYPE)); |
| 114 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 115 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, TimeUnit.class, Scheduler.class, Integer.TYPE)); |
| 116 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, TimeUnit.class, Scheduler.class, Integer.TYPE, Supplier.class, Boolean.TYPE)); |
| 117 |
|
| 118 |
// negative time/skip is considered zero time/skip |
| 119 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 120 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 121 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, Supplier.class)); |
| 122 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 123 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 124 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, Supplier.class)); |
| 125 |
|
| 126 |
// negative timeout is allowed |
| 127 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "fromFuture", Future.class, Long.TYPE, TimeUnit.class)); |
| 128 |
|
| 129 |
// negative time is considered as zero time |
| 130 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "timer", Long.TYPE, TimeUnit.class)); |
| 131 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "timer", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 132 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "interval", Long.TYPE, TimeUnit.class)); |
| 133 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "interval", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 134 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "interval", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 135 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "interval", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 136 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "interval", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 137 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "interval", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 138 |
|
| 139 |
// negative time is considered as zero time |
| 140 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class)); |
| 141 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 142 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 143 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 144 |
|
| 145 |
// negative time is considered as zero time |
| 146 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class)); |
| 147 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 148 |
|
| 149 |
// negative time is considered as zero time |
| 150 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "debounce", Long.TYPE, TimeUnit.class)); |
| 151 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "debounce", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 152 |
|
| 153 |
// null Action allowed |
| 154 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "onBackpressureBuffer", Long.TYPE, Action.class, BackpressureOverflowStrategy.class)); |
| 155 |
|
| 156 |
// zero repeat is allowed |
| 157 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "repeat", Long.TYPE)); |
| 158 |
|
| 159 |
// negative time is considered as zero time |
| 160 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "replay", Long.TYPE, TimeUnit.class)); |
| 161 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "replay", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 162 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "replay", Long.TYPE, TimeUnit.class, Scheduler.class, boolean.class)); |
| 163 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "replay", Integer.TYPE, Long.TYPE, TimeUnit.class)); |
| 164 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "replay", Integer.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 165 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "replay", Integer.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, boolean.class)); |
| 166 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "replay", Function.class, Long.TYPE, TimeUnit.class)); |
| 167 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "replay", Function.class, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 168 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "replay", Function.class, Long.TYPE, TimeUnit.class, Scheduler.class, boolean.class)); |
| 169 |
addOverride(new ParamOverride(Flowable.class, 2, ParamMode.ANY, "replay", Function.class, Integer.TYPE, Long.TYPE, TimeUnit.class)); |
| 170 |
addOverride(new ParamOverride(Flowable.class, 2, ParamMode.ANY, "replay", Function.class, Integer.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 171 |
addOverride(new ParamOverride(Flowable.class, 2, ParamMode.ANY, "replay", Function.class, Integer.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, boolean.class)); |
| 172 |
|
| 173 |
// zero retry is allowed |
| 174 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "retry", Long.TYPE)); |
| 175 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "retry", Long.TYPE, Predicate.class)); |
| 176 |
|
| 177 |
// negative time is considered as zero time |
| 178 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleWithTimeout", Long.TYPE, TimeUnit.class)); |
| 179 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleWithTimeout", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 180 |
|
| 181 |
// negative time is considered as zero time |
| 182 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "take", Long.TYPE, TimeUnit.class)); |
| 183 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "take", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 184 |
|
| 185 |
// zero take is allowed |
| 186 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "take", Long.TYPE)); |
| 187 |
|
| 188 |
// negative time is considered as zero time |
| 189 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class)); |
| 190 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 191 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 192 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 193 |
|
| 194 |
// negative time is considered as zero time |
| 195 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class)); |
| 196 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 197 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 198 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 199 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Integer.TYPE)); |
| 200 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 201 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 202 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Integer.TYPE)); |
| 203 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 204 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 205 |
addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Integer.TYPE)); |
| 206 |
|
| 207 |
// take last 0 is allowed |
| 208 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "takeLast", Integer.TYPE)); |
| 209 |
|
| 210 |
// skip last 0 is allowed |
| 211 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "skipLast", Integer.TYPE)); |
| 212 |
|
| 213 |
// negative time is considered as zero time |
| 214 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "skipLast", Long.TYPE, TimeUnit.class)); |
| 215 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "skipLast", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 216 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "skipLast", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 217 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "skipLast", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 218 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "skipLast", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Integer.TYPE)); |
| 219 |
|
| 220 |
// negative time is considered as zero time |
| 221 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleFirst", Long.TYPE, TimeUnit.class)); |
| 222 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleFirst", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 223 |
|
| 224 |
// negative time is considered as zero time |
| 225 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLast", Long.TYPE, TimeUnit.class)); |
| 226 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLast", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 227 |
|
| 228 |
// negative time is considered as zero time |
| 229 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class)); |
| 230 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 231 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 232 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 233 |
|
| 234 |
// negative buffer time is considered as zero buffer time |
| 235 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class)); |
| 236 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Long.TYPE)); |
| 237 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Long.TYPE, Boolean.TYPE)); |
| 238 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Scheduler.class, Long.TYPE)); |
| 239 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 240 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Scheduler.class, Long.TYPE, Boolean.TYPE)); |
| 241 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Scheduler.class, Long.TYPE, Boolean.TYPE, Integer.TYPE)); |
| 242 |
|
| 243 |
// *********************************************************************************************************************** |
| 244 |
|
| 245 |
// negative timeout time is considered as zero timeout time |
| 246 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class)); |
| 247 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 248 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, CompletableSource.class)); |
| 249 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, Scheduler.class, CompletableSource.class)); |
| 250 |
|
| 251 |
// negative time is considered as zero time |
| 252 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "timer", Long.TYPE, TimeUnit.class)); |
| 253 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "timer", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 254 |
|
| 255 |
// negative time is considered as zero time |
| 256 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class)); |
| 257 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 258 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 259 |
|
| 260 |
// negative time is considered as zero time |
| 261 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class)); |
| 262 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 263 |
|
| 264 |
// zero repeat is allowed |
| 265 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.NON_NEGATIVE, "repeat", Long.TYPE)); |
| 266 |
|
| 267 |
// zero retry is allowed |
| 268 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.NON_NEGATIVE, "retry", Long.TYPE)); |
| 269 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.NON_NEGATIVE, "retry", Long.TYPE, Predicate.class)); |
| 270 |
|
| 271 |
// negative time is considered as zero time |
| 272 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "blockingAwait", Long.TYPE, TimeUnit.class)); |
| 273 |
|
| 274 |
// *********************************************************************************************************************** |
| 275 |
|
| 276 |
// negative timeout time is considered as zero timeout time |
| 277 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class)); |
| 278 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 279 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, MaybeSource.class)); |
| 280 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, Scheduler.class, MaybeSource.class)); |
| 281 |
|
| 282 |
// negative time is considered as zero time |
| 283 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "timer", Long.TYPE, TimeUnit.class)); |
| 284 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "timer", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 285 |
|
| 286 |
// negative timeout is allowed |
| 287 |
addOverride(new ParamOverride(Maybe.class, 1, ParamMode.ANY, "fromFuture", Future.class, Long.TYPE, TimeUnit.class)); |
| 288 |
|
| 289 |
// negative time is considered as zero time |
| 290 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class)); |
| 291 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 292 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 293 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 294 |
|
| 295 |
// zero repeat is allowed |
| 296 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.NON_NEGATIVE, "repeat", Long.TYPE)); |
| 297 |
|
| 298 |
// zero retry is allowed |
| 299 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.NON_NEGATIVE, "retry", Long.TYPE)); |
| 300 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.NON_NEGATIVE, "retry", Long.TYPE, Predicate.class)); |
| 301 |
|
| 302 |
// negative time is considered as zero time |
| 303 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class)); |
| 304 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 305 |
|
| 306 |
// *********************************************************************************************************************** |
| 307 |
|
| 308 |
// negative timeout time is considered as zero timeout time |
| 309 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class)); |
| 310 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 311 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, SingleSource.class)); |
| 312 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, Scheduler.class, SingleSource.class)); |
| 313 |
|
| 314 |
// negative time is considered as zero time |
| 315 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "timer", Long.TYPE, TimeUnit.class)); |
| 316 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "timer", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 317 |
|
| 318 |
// negative timeout is allowed |
| 319 |
addOverride(new ParamOverride(Single.class, 1, ParamMode.ANY, "fromFuture", Future.class, Long.TYPE, TimeUnit.class)); |
| 320 |
|
| 321 |
// negative time is considered as zero time |
| 322 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class)); |
| 323 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 324 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 325 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 326 |
|
| 327 |
// zero repeat is allowed |
| 328 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.NON_NEGATIVE, "repeat", Long.TYPE)); |
| 329 |
|
| 330 |
// zero retry is allowed |
| 331 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.NON_NEGATIVE, "retry", Long.TYPE)); |
| 332 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.NON_NEGATIVE, "retry", Long.TYPE, Predicate.class)); |
| 333 |
|
| 334 |
// negative time is considered as zero time |
| 335 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class)); |
| 336 |
addOverride(new ParamOverride(Single.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 337 |
|
| 338 |
// *********************************************************************************************************************** |
| 339 |
|
| 340 |
// zero index allowed |
| 341 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "elementAt", Long.TYPE)); |
| 342 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "elementAt", Long.TYPE, Object.class)); |
| 343 |
|
| 344 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "elementAtOrError", Long.TYPE)); |
| 345 |
|
| 346 |
// negative skip count is ignored |
| 347 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "skip", Long.TYPE)); |
| 348 |
// negative skip time is considered as zero skip time |
| 349 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "skip", Long.TYPE, TimeUnit.class)); |
| 350 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "skip", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 351 |
|
| 352 |
// negative timeout time is considered as zero timeout time |
| 353 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class)); |
| 354 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 355 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, ObservableSource.class)); |
| 356 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "timeout", Long.TYPE, TimeUnit.class, Scheduler.class, ObservableSource.class)); |
| 357 |
|
| 358 |
// negative buffer time is considered as zero buffer time |
| 359 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, TimeUnit.class)); |
| 360 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, TimeUnit.class, Integer.TYPE)); |
| 361 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 362 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, TimeUnit.class, Scheduler.class, Integer.TYPE)); |
| 363 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, TimeUnit.class, Scheduler.class, Integer.TYPE, Supplier.class, Boolean.TYPE)); |
| 364 |
|
| 365 |
// negative time/skip is considered zero time/skip |
| 366 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 367 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 368 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, Supplier.class)); |
| 369 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 370 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 371 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "buffer", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, Supplier.class)); |
| 372 |
|
| 373 |
// negative timeout is allowed |
| 374 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "fromFuture", Future.class, Long.TYPE, TimeUnit.class)); |
| 375 |
|
| 376 |
// negative time is considered as zero time |
| 377 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "timer", Long.TYPE, TimeUnit.class)); |
| 378 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "timer", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 379 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "interval", Long.TYPE, TimeUnit.class)); |
| 380 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "interval", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 381 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "interval", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 382 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "interval", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 383 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "interval", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 384 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "interval", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 385 |
|
| 386 |
// negative time is considered as zero time |
| 387 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class)); |
| 388 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 389 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 390 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 391 |
|
| 392 |
// negative time is considered as zero time |
| 393 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class)); |
| 394 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 395 |
|
| 396 |
// negative time is considered as zero time |
| 397 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "debounce", Long.TYPE, TimeUnit.class)); |
| 398 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "debounce", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 399 |
|
| 400 |
// zero repeat is allowed |
| 401 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "repeat", Long.TYPE)); |
| 402 |
|
| 403 |
// negative time is considered as zero time |
| 404 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "replay", Long.TYPE, TimeUnit.class)); |
| 405 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "replay", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 406 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "replay", Long.TYPE, TimeUnit.class, Scheduler.class, boolean.class)); |
| 407 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "replay", Integer.TYPE, Long.TYPE, TimeUnit.class)); |
| 408 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "replay", Integer.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 409 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "replay", Integer.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, boolean.class)); |
| 410 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "replay", Function.class, Long.TYPE, TimeUnit.class)); |
| 411 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "replay", Function.class, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 412 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "replay", Function.class, Long.TYPE, TimeUnit.class, Scheduler.class, boolean.class)); |
| 413 |
addOverride(new ParamOverride(Observable.class, 2, ParamMode.ANY, "replay", Function.class, Integer.TYPE, Long.TYPE, TimeUnit.class)); |
| 414 |
addOverride(new ParamOverride(Observable.class, 2, ParamMode.ANY, "replay", Function.class, Integer.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 415 |
addOverride(new ParamOverride(Observable.class, 2, ParamMode.ANY, "replay", Function.class, Integer.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, boolean.class)); |
| 416 |
|
| 417 |
// zero retry is allowed |
| 418 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "retry", Long.TYPE)); |
| 419 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "retry", Long.TYPE, Predicate.class)); |
| 420 |
|
| 421 |
// negative time is considered as zero time |
| 422 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleWithTimeout", Long.TYPE, TimeUnit.class)); |
| 423 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleWithTimeout", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 424 |
|
| 425 |
// negative time is considered as zero time |
| 426 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "take", Long.TYPE, TimeUnit.class)); |
| 427 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "take", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 428 |
|
| 429 |
// zero retry is allowed |
| 430 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "take", Long.TYPE)); |
| 431 |
|
| 432 |
// negative time is considered as zero time |
| 433 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class)); |
| 434 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 435 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 436 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 437 |
|
| 438 |
// negative time is considered as zero time |
| 439 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class)); |
| 440 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 441 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 442 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 443 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Integer.TYPE)); |
| 444 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 445 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 446 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Integer.TYPE)); |
| 447 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 448 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 449 |
addOverride(new ParamOverride(Observable.class, 1, ParamMode.ANY, "takeLast", Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Integer.TYPE)); |
| 450 |
|
| 451 |
// take last 0 is allowed |
| 452 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "takeLast", Integer.TYPE)); |
| 453 |
|
| 454 |
// skip last 0 is allowed |
| 455 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "skipLast", Integer.TYPE)); |
| 456 |
|
| 457 |
// negative time is considered as zero time |
| 458 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "skipLast", Long.TYPE, TimeUnit.class)); |
| 459 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "skipLast", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 460 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "skipLast", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 461 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "skipLast", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 462 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "skipLast", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Integer.TYPE)); |
| 463 |
|
| 464 |
// negative time is considered as zero time |
| 465 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleFirst", Long.TYPE, TimeUnit.class)); |
| 466 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleFirst", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 467 |
|
| 468 |
// negative time is considered as zero time |
| 469 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLast", Long.TYPE, TimeUnit.class)); |
| 470 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLast", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 471 |
|
| 472 |
// negative time is considered as zero time |
| 473 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class)); |
| 474 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 475 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Boolean.TYPE)); |
| 476 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); |
| 477 |
|
| 478 |
// negative buffer time is considered as zero buffer time |
| 479 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class)); |
| 480 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Long.TYPE)); |
| 481 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Long.TYPE, Boolean.TYPE)); |
| 482 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Scheduler.class, Long.TYPE)); |
| 483 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 484 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Scheduler.class, Long.TYPE, Boolean.TYPE)); |
| 485 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class, Scheduler.class, Long.TYPE, Boolean.TYPE, Integer.TYPE)); |
| 486 |
|
| 487 |
// null value allowed |
| 488 |
|
| 489 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "firstStage", Object.class)); |
| 490 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "singleStage", Object.class)); |
| 491 |
addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "lastStage", Object.class)); |
| 492 |
|
| 493 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "firstStage", Object.class)); |
| 494 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "singleStage", Object.class)); |
| 495 |
addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "lastStage", Object.class)); |
| 496 |
|
| 497 |
addOverride(new ParamOverride(Maybe.class, 0, ParamMode.ANY, "toCompletionStage", Object.class)); |
| 498 |
addOverride(new ParamOverride(Completable.class, 0, ParamMode.ANY, "toCompletionStage", Object.class)); |
| 499 |
|
| 500 |
// ----------------------------------------------------------------------------------- |
| 501 |
|
| 502 |
ignores = new HashMap<>(); |
| 503 |
|
| 504 |
// needs special param validation due to (long)start + end - 1 <= Integer.MAX_VALUE |
| 505 |
addIgnore(new ParamIgnore(Flowable.class, "range", Integer.TYPE, Integer.TYPE)); |
| 506 |
addIgnore(new ParamIgnore(Flowable.class, "rangeLong", Long.TYPE, Long.TYPE)); |
| 507 |
addIgnore(new ParamIgnore(Flowable.class, "intervalRange", Long.TYPE, Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 508 |
addIgnore(new ParamIgnore(Flowable.class, "intervalRange", Long.TYPE, Long.TYPE, Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 509 |
addIgnore(new ParamIgnore(Flowable.class, "intervalRange", Long.TYPE, Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 510 |
addIgnore(new ParamIgnore(Flowable.class, "intervalRange", Long.TYPE, Long.TYPE, Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 511 |
|
| 512 |
addIgnore(new ParamIgnore(Flowable.class, "unsafeCreate", Publisher.class)); |
| 513 |
|
| 514 |
// needs special param validation due to (long)start + end - 1 <= Integer.MAX_VALUE |
| 515 |
addIgnore(new ParamIgnore(Observable.class, "range", Integer.TYPE, Integer.TYPE)); |
| 516 |
addIgnore(new ParamIgnore(Observable.class, "rangeLong", Long.TYPE, Long.TYPE)); |
| 517 |
addIgnore(new ParamIgnore(Observable.class, "intervalRange", Long.TYPE, Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 518 |
addIgnore(new ParamIgnore(Observable.class, "intervalRange", Long.TYPE, Long.TYPE, Long.TYPE, Long.TYPE, TimeUnit.class)); |
| 519 |
addIgnore(new ParamIgnore(Observable.class, "intervalRange", Long.TYPE, Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 520 |
addIgnore(new ParamIgnore(Observable.class, "intervalRange", Long.TYPE, Long.TYPE, Long.TYPE, Long.TYPE, TimeUnit.class, Scheduler.class)); |
| 521 |
|
| 522 |
addIgnore(new ParamIgnore(Observable.class, "unsafeCreate", ObservableSource.class)); |
| 523 |
|
| 524 |
addIgnore(new ParamIgnore(Maybe.class, "unsafeCreate", MaybeSource.class)); |
| 525 |
|
| 526 |
addIgnore(new ParamIgnore(Single.class, "unsafeCreate", SingleSource.class)); |
| 527 |
|
| 528 |
addIgnore(new ParamIgnore(Completable.class, "unsafeCreate", CompletableSource.class)); |
| 529 |
|
| 530 |
// ----------------------------------------------------------------------------------- |
| 531 |
|
| 532 |
defaultValues = new HashMap<>(); |
| 533 |
|
| 534 |
defaultValues.put(Publisher.class, new NeverPublisher()); |
| 535 |
defaultValues.put(Flowable.class, new NeverPublisher()); |
| 536 |
|
| 537 |
defaultValues.put(ObservableSource.class, new NeverObservable()); |
| 538 |
defaultValues.put(Observable.class, new NeverObservable()); |
| 539 |
|
| 540 |
defaultValues.put(SingleSource.class, new NeverSingle()); |
| 541 |
defaultValues.put(Single.class, new NeverSingle()); |
| 542 |
|
| 543 |
defaultValues.put(MaybeSource.class, new NeverMaybe()); |
| 544 |
defaultValues.put(Maybe.class, new NeverMaybe()); |
| 545 |
|
| 546 |
defaultValues.put(CompletableSource.class, new NeverCompletable()); |
| 547 |
defaultValues.put(Completable.class, new NeverCompletable()); |
| 548 |
|
| 549 |
defaultValues.put(Action.class, Functions.EMPTY_ACTION); |
| 550 |
defaultValues.put(Runnable.class, Functions.EMPTY_RUNNABLE); |
| 551 |
defaultValues.put(Consumer.class, Functions.emptyConsumer()); |
| 552 |
defaultValues.put(LongConsumer.class, Functions.EMPTY_LONG_CONSUMER); |
| 553 |
defaultValues.put(Function.class, Functions.justFunction(1)); |
| 554 |
defaultValues.put(Callable.class, Functions.justCallable(1)); |
| 555 |
defaultValues.put(Supplier.class, Functions.justSupplier(1)); |
| 556 |
defaultValues.put(Iterable.class, Collections.emptyList()); |
| 557 |
defaultValues.put(Object.class, 1); |
| 558 |
defaultValues.put(Class.class, Integer.class); |
| 559 |
Object af = new AllFunctionals(); |
| 560 |
for (Class<?> interfaces : AllFunctionals.class.getInterfaces()) { |
| 561 |
defaultValues.put(interfaces, af); |
| 562 |
} |
| 563 |
defaultValues.put(TimeUnit.class, TimeUnit.SECONDS); |
| 564 |
defaultValues.put(Scheduler.class, Schedulers.single()); |
| 565 |
defaultValues.put(BackpressureStrategy.class, BackpressureStrategy.MISSING); |
| 566 |
defaultValues.put(BackpressureOverflowStrategy.class, BackpressureOverflowStrategy.ERROR); |
| 567 |
defaultValues.put(Throwable.class, new TestException()); |
| 568 |
|
| 569 |
defaultValues.put(Publisher[].class, new Publisher[] { new NeverPublisher(), new NeverPublisher() }); |
| 570 |
defaultValues.put(ObservableSource[].class, new ObservableSource[] { new NeverObservable(), new NeverObservable() }); |
| 571 |
defaultValues.put(SingleSource[].class, new SingleSource[] { new NeverSingle(), new NeverSingle() }); |
| 572 |
defaultValues.put(MaybeSource[].class, new MaybeSource[] { new NeverMaybe(), new NeverMaybe() }); |
| 573 |
defaultValues.put(CompletableSource[].class, new CompletableSource[] { new NeverCompletable(), new NeverCompletable() }); |
| 574 |
|
| 575 |
defaultValues.put(Object[].class, new Object[] { new Object(), new Object() }); |
| 576 |
defaultValues.put(Future.class, new FutureTask<Object>(Functions.EMPTY_RUNNABLE, 1)); |
| 577 |
|
| 578 |
defaultValues.put(ParallelFlowable.class, ParallelFlowable.from(Flowable.never())); |
| 579 |
defaultValues.put(Subscriber[].class, new Subscriber[] { new AllFunctionals() }); |
| 580 |
|
| 581 |
defaultValues.put(ParallelFailureHandling.class, ParallelFailureHandling.ERROR); |
| 582 |
|
| 583 |
defaultValues.put(DisposableContainer.class, new CompositeDisposable()); |
| 584 |
|
| 585 |
// JDK 8 types |
| 586 |
|
| 587 |
defaultValues.put(Optional.class, Optional.of(1)); |
| 588 |
defaultValues.put(CompletionStage.class, CompletableFuture.completedFuture(1)); |
| 589 |
defaultValues.put(Stream.class, Stream.of(1, 2, 3)); |
| 590 |
defaultValues.put(Duration.class, Duration.ofSeconds(1)); |
| 591 |
defaultValues.put(Collector.class, Collectors.toList()); |
| 592 |
|
| 593 |
@SuppressWarnings("rawtypes") |
| 594 |
class MixedConverters implements FlowableConverter, ObservableConverter, SingleConverter, |
| 595 |
MaybeConverter, CompletableConverter, ParallelFlowableConverter { |
| 596 |
|
| 597 |
@Override |
| 598 |
public Object apply(ParallelFlowable upstream) { |
| 599 |
return upstream; |
| 600 |
} |
| 601 |
|
| 602 |
@Override |
| 603 |
public Object apply(Completable upstream) { |
| 604 |
return upstream; |
| 605 |
} |
| 606 |
|
| 607 |
@Override |
| 608 |
public Object apply(Maybe upstream) { |
| 609 |
return upstream; |
| 610 |
} |
| 611 |
|
| 612 |
@Override |
| 613 |
public Object apply(Single upstream) { |
| 614 |
return upstream; |
| 615 |
} |
| 616 |
|
| 617 |
@Override |
| 618 |
public Object apply(Observable upstream) { |
| 619 |
return upstream; |
| 620 |
} |
| 621 |
|
| 622 |
@Override |
| 623 |
public Object apply(Flowable upstream) { |
| 624 |
return upstream; |
| 625 |
} |
| 626 |
} |
| 627 |
|
| 628 |
MixedConverters mc = new MixedConverters(); |
| 629 |
for (Class<?> c : MixedConverters.class.getInterfaces()) { |
| 630 |
defaultValues.put(c, mc); |
| 631 |
} |
| 632 |
|
| 633 |
// ----------------------------------------------------------------------------------- |
| 634 |
|
| 635 |
defaultInstances = new HashMap<>(); |
| 636 |
|
| 637 |
// addDefaultInstance(Flowable.class, Flowable.empty(), "Empty()"); |
| 638 |
// addDefaultInstance(Flowable.class, Flowable.empty().hide(), "Empty().Hide()"); |
| 639 |
addDefaultInstance(Flowable.class, Flowable.just(1), "Just(1)"); |
| 640 |
addDefaultInstance(Flowable.class, Flowable.just(1).hide(), "Just(1).Hide()"); |
| 641 |
// addDefaultInstance(Flowable.class, Flowable.range(1, 3), "Range(1, 3)"); |
| 642 |
// addDefaultInstance(Flowable.class, Flowable.range(1, 3).hide(), "Range(1, 3).Hide()"); |
| 643 |
|
| 644 |
// addDefaultInstance(Observable.class, Observable.empty(), "Empty()"); |
| 645 |
// addDefaultInstance(Observable.class, Observable.empty().hide(), "Empty().Hide()"); |
| 646 |
addDefaultInstance(Observable.class, Observable.just(1), "Just(1)"); |
| 647 |
addDefaultInstance(Observable.class, Observable.just(1).hide(), "Just(1).Hide()"); |
| 648 |
// addDefaultInstance(Observable.class, Observable.range(1, 3), "Range(1, 3)"); |
| 649 |
// addDefaultInstance(Observable.class, Observable.range(1, 3).hide(), "Range(1, 3).Hide()"); |
| 650 |
|
| 651 |
addDefaultInstance(Completable.class, Completable.complete(), "Complete()"); |
| 652 |
addDefaultInstance(Completable.class, Completable.complete().hide(), "Complete().hide()"); |
| 653 |
|
| 654 |
addDefaultInstance(Single.class, Single.just(1), "Just(1)"); |
| 655 |
addDefaultInstance(Single.class, Single.just(1).hide(), "Just(1).Hide()"); |
| 656 |
|
| 657 |
addDefaultInstance(Maybe.class, Maybe.just(1), "Just(1)"); |
| 658 |
addDefaultInstance(Maybe.class, Maybe.just(1).hide(), "Just(1).Hide()"); |
| 659 |
|
| 660 |
addDefaultInstance(ParallelFlowable.class, Flowable.just(1).parallel(), "Just(1)"); |
| 661 |
} |
| 662 |
|
| 663 |
static void addIgnore(ParamIgnore ignore) { |
| 664 |
String key = ignore.toString(); |
| 665 |
List<ParamIgnore> list = ignores.get(key); |
| 666 |
if (list == null) { |
| 667 |
list = new ArrayList<>(); |
| 668 |
ignores.put(key, list); |
| 669 |
} |
| 670 |
list.add(ignore); |
| 671 |
} |
| 672 |
|
| 673 |
static void addOverride(ParamOverride ignore) { |
| 674 |
String key = ignore.toString(); |
| 675 |
List<ParamOverride> list = overrides.get(key); |
| 676 |
if (list == null) { |
| 677 |
list = new ArrayList<>(); |
| 678 |
overrides.put(key, list); |
| 679 |
} |
| 680 |
list.add(ignore); |
| 681 |
} |
| 682 |
|
| 683 |
static void addDefaultInstance(Class<?> clazz, Object o, String tag) { |
| 684 |
List<Object> list = defaultInstances.get(clazz); |
| 685 |
if (list == null) { |
| 686 |
list = new ArrayList<>(); |
| 687 |
defaultInstances.put(clazz, list); |
| 688 |
} |
| 689 |
list.add(o); |
| 690 |
list.add(tag); |
| 691 |
} |
| 692 |
|
| 693 |
Object defaultPrimitive(Class<?> clazz, ParamOverride override) { |
| 694 |
if (Integer.TYPE == clazz) { |
| 695 |
if (override != null) { |
| 696 |
return 0; |
| 697 |
} |
| 698 |
return 1; |
| 699 |
} |
| 700 |
|
| 701 |
if (Long.TYPE == clazz) { |
| 702 |
if (override != null) { |
| 703 |
return 0L; |
| 704 |
} |
| 705 |
return 1L; |
| 706 |
} |
| 707 |
|
| 708 |
if (Boolean.TYPE == clazz) { |
| 709 |
return true; |
| 710 |
} |
| 711 |
|
| 712 |
return null; |
| 713 |
} |
| 714 |
|
| 715 |
void addCheckPrimitive(Class<?> clazz, ParamOverride override, List<Object> values) { |
| 716 |
if (Integer.TYPE == clazz) { |
| 717 |
values.add(-2); |
| 718 |
values.add(override != null && override.mode == ParamMode.ANY); |
| 719 |
values.add(-1); |
| 720 |
values.add(override != null && override.mode == ParamMode.ANY); |
| 721 |
values.add(0); |
| 722 |
values.add(override != null); |
| 723 |
values.add(1); |
| 724 |
values.add(true); // should succeed |
| 725 |
values.add(2); |
| 726 |
values.add(true); |
| 727 |
} |
| 728 |
|
| 729 |
if (Long.TYPE == clazz) { |
| 730 |
values.add(-2L); |
| 731 |
values.add(override != null && override.mode == ParamMode.ANY); |
| 732 |
values.add(-1L); |
| 733 |
values.add(override != null && override.mode == ParamMode.ANY); |
| 734 |
values.add(0L); |
| 735 |
values.add(override != null); |
| 736 |
values.add(1L); |
| 737 |
values.add(true); // should succeed |
| 738 |
values.add(2L); |
| 739 |
values.add(true); |
| 740 |
} |
| 741 |
|
| 742 |
if (Boolean.TYPE == clazz) { |
| 743 |
values.add(false); |
| 744 |
values.add(true); |
| 745 |
values.add(true); |
| 746 |
values.add(true); |
| 747 |
} |
| 748 |
} |
| 749 |
|
| 750 |
void checkClass(Class<?> clazz) { |
| 751 |
List<Throwable> errors = TestHelper.trackPluginErrors(); |
| 752 |
try { |
| 753 |
StringBuilder b = new StringBuilder(); |
| 754 |
int fail = 0; |
| 755 |
|
| 756 |
outer: |
| 757 |
for (Method m : clazz.getMethods()) { |
| 758 |
if (m.getDeclaringClass() != clazz) { |
| 759 |
continue; |
| 760 |
} |
| 761 |
|
| 762 |
String key = clazz.getName() + " " + m.getName(); |
| 763 |
|
| 764 |
List<ParamIgnore> ignoreList = ignores.get(key); |
| 765 |
if (ignoreList != null) { |
| 766 |
for (ParamIgnore e : ignoreList) { |
| 767 |
if (Arrays.equals(e.arguments, m.getParameterTypes())) { |
| 768 |
System.out.println("CheckClass - ignore: " + m); |
| 769 |
continue outer; |
| 770 |
} |
| 771 |
} |
| 772 |
} |
| 773 |
|
| 774 |
List<ParamOverride> overrideList = overrides.get(key); |
| 775 |
|
| 776 |
List<Object> baseObjects = new ArrayList<>(); |
| 777 |
|
| 778 |
if ((m.getModifiers() & Modifier.STATIC) != 0) { |
| 779 |
baseObjects.add(null); |
| 780 |
baseObjects.add("NULL"); |
| 781 |
} else { |
| 782 |
List<Object> defaultInstancesList = defaultInstances.get(clazz); |
| 783 |
if (defaultInstancesList == null) { |
| 784 |
b.append("\r\nNo default instances for " + clazz); |
| 785 |
fail++; |
| 786 |
continue outer; |
| 787 |
} |
| 788 |
baseObjects.addAll(defaultInstancesList); |
| 789 |
} |
| 790 |
|
| 791 |
for (int ii = 0; ii < baseObjects.size(); ii += 2) { |
| 792 |
Object baseObject = baseObjects.get(ii); |
| 793 |
Object tag = baseObjects.get(ii + 1); |
| 794 |
Class<?>[] params = m.getParameterTypes(); |
| 795 |
int n = params.length; |
| 796 |
|
| 797 |
for (int i = 0; i < n; i++) { |
| 798 |
ParamOverride overrideEntry = null; |
| 799 |
if (overrideList != null) { |
| 800 |
for (ParamOverride e : overrideList) { |
| 801 |
if (e.index == i && Arrays.equals(e.arguments, params)) { |
| 802 |
overrideEntry = e; |
| 803 |
break; |
| 804 |
} |
| 805 |
} |
| 806 |
} |
| 807 |
|
| 808 |
Class<?> entryClass = params[i]; |
| 809 |
|
| 810 |
Object[] callParams = new Object[n]; |
| 811 |
|
| 812 |
for (int j = 0; j < n; j++) { |
| 813 |
if (j != i) { |
| 814 |
if (params[j].isPrimitive()) { |
| 815 |
ParamOverride overrideParam = null; |
| 816 |
if (overrideList != null) { |
| 817 |
for (ParamOverride e : overrideList) { |
| 818 |
if (e.index == j && Arrays.equals(e.arguments, params)) { |
| 819 |
overrideParam = e; |
| 820 |
break; |
| 821 |
} |
| 822 |
} |
| 823 |
} |
| 824 |
Object def = defaultPrimitive(params[j], overrideParam); |
| 825 |
if (def == null) { |
| 826 |
b.append("\r\nMissing default non-null value for " + m + " # " + j + " (" + params[j] + ")"); |
| 827 |
fail++; |
| 828 |
continue outer; |
| 829 |
} |
| 830 |
callParams[j] = def; |
| 831 |
} else { |
| 832 |
Object def = defaultValues.get(params[j]); |
| 833 |
if (def == null) { |
| 834 |
b.append("\r\nMissing default non-null value for " + m + " # " + j + " (" + params[j] + ")"); |
| 835 |
fail++; |
| 836 |
continue outer; |
| 837 |
} |
| 838 |
callParams[j] = def; |
| 839 |
} |
| 840 |
} |
| 841 |
} |
| 842 |
|
| 843 |
List<Object> entryValues = new ArrayList<>(); |
| 844 |
|
| 845 |
if (entryClass.isPrimitive()) { |
| 846 |
addCheckPrimitive(params[i], overrideEntry, entryValues); |
| 847 |
} else { |
| 848 |
entryValues.add(null); |
| 849 |
entryValues.add(overrideEntry != null && overrideEntry.mode == ParamMode.ANY); |
| 850 |
|
| 851 |
Object def = defaultValues.get(params[i]); |
| 852 |
if (def == null) { |
| 853 |
b.append("\r\nMissing default non-null value for " + m + " # " + i + " (" + params[i] + ")"); |
| 854 |
fail++; |
| 855 |
continue outer; |
| 856 |
} |
| 857 |
entryValues.add(def); |
| 858 |
entryValues.add(true); |
| 859 |
} |
| 860 |
|
| 861 |
for (int k = 0; k < entryValues.size(); k += 2) { |
| 862 |
Object[] callParams2 = callParams.clone(); |
| 863 |
|
| 864 |
Object p = entryValues.get(k); |
| 865 |
callParams2[i] = p; |
| 866 |
boolean shouldSucceed = (Boolean)entryValues.get(k + 1); |
| 867 |
|
| 868 |
boolean success = false; |
| 869 |
Throwable error = null; |
| 870 |
errors.clear(); |
| 871 |
try { |
| 872 |
m.invoke(baseObject, callParams2); |
| 873 |
success = true; |
| 874 |
} catch (Throwable ex) { |
| 875 |
// let it fail |
| 876 |
error = ex; |
| 877 |
} |
| 878 |
|
| 879 |
if (!success && error.getCause() instanceof NullPointerException) { |
| 880 |
if (!error.getCause().toString().contains("is null")) { |
| 881 |
fail++; |
| 882 |
b.append("\r\nNPEs should indicate which argument failed: " + m + " # " + i + " = " + p + ", tag = " + tag + ", params = " + Arrays.toString(callParams2)); |
| 883 |
} |
| 884 |
} |
| 885 |
if (success != shouldSucceed) { |
| 886 |
fail++; |
| 887 |
if (shouldSucceed) { |
| 888 |
b.append("\r\nFailed (should have succeeded): " + m + " # " + i + " = " + p + ", tag = " + tag + ", params = " + Arrays.toString(callParams2)); |
| 889 |
b.append("\r\n ").append(error); |
| 890 |
if (error.getCause() != null) { |
| 891 |
b.append("\r\n ").append(error.getCause()); |
| 892 |
} |
| 893 |
} else { |
| 894 |
b.append("\r\nNo failure (should have failed): " + m + " # " + i + " = " + p + ", tag = " + tag + ", params = " + Arrays.toString(callParams2)); |
| 895 |
} |
| 896 |
continue outer; |
| 897 |
} |
| 898 |
if (!errors.isEmpty()) { |
| 899 |
fail++; |
| 900 |
b.append("\r\nUndeliverable errors:"); |
| 901 |
for (Throwable err : errors) { |
| 902 |
b.append("\r\n ").append(err); |
| 903 |
if (err.getCause() != null) { |
| 904 |
b.append("\r\n ").append(err.getCause()); |
| 905 |
} |
| 906 |
} |
| 907 |
continue outer; |
| 908 |
} |
| 909 |
} |
| 910 |
} |
| 911 |
} |
| 912 |
} |
| 913 |
|
| 914 |
if (fail != 0) { |
| 915 |
throw new AssertionError("Parameter validation problems: " + fail + b.toString()); |
| 916 |
} |
| 917 |
} finally { |
| 918 |
RxJavaPlugins.reset(); |
| 919 |
} |
| 920 |
} |
| 921 |
|
| 922 |
@SuppressWarnings("rawtypes") |
| 923 |
static final class AllFunctionals |
| 924 |
implements BiFunction, BiConsumer, |
| 925 |
Predicate, BiPredicate, BooleanSupplier, |
| 926 |
Function3, Function4, Function5, Function6, Function7, Function8, Function9, |
| 927 |
FlowableOnSubscribe, ObservableOnSubscribe, SingleOnSubscribe, MaybeOnSubscribe, CompletableOnSubscribe, |
| 928 |
FlowableTransformer, ObservableTransformer, SingleTransformer, MaybeTransformer, CompletableTransformer, |
| 929 |
Subscriber, FlowableSubscriber, Observer, SingleObserver, MaybeObserver, CompletableObserver, |
| 930 |
FlowableOperator, ObservableOperator, SingleOperator, MaybeOperator, CompletableOperator, |
| 931 |
Comparator, ParallelTransformer |
| 932 |
{ |
| 933 |
|
| 934 |
@Override |
| 935 |
public ParallelFlowable apply(ParallelFlowable upstream) { |
| 936 |
return null; |
| 937 |
} |
| 938 |
|
| 939 |
@Override |
| 940 |
public Object apply(Object t1, Object t2, Object t3, Object t4, Object t5, Object t6, Object t7, Object t8, |
| 941 |
Object t9) throws Exception { |
| 942 |
return null; |
| 943 |
} |
| 944 |
|
| 945 |
@Override |
| 946 |
public Object apply(Object t1, Object t2, Object t3, Object t4, Object t5, Object t6, Object t7, Object t8) |
| 947 |
throws Exception { |
| 948 |
return null; |
| 949 |
} |
| 950 |
|
| 951 |
@Override |
| 952 |
public Object apply(Object t1, Object t2, Object t3, Object t4, Object t5, Object t6, Object t7) |
| 953 |
throws Exception { |
| 954 |
return null; |
| 955 |
} |
| 956 |
|
| 957 |
@Override |
| 958 |
public Object apply(Object t1, Object t2, Object t3, Object t4, Object t5, Object t6) throws Exception { |
| 959 |
return null; |
| 960 |
} |
| 961 |
|
| 962 |
@Override |
| 963 |
public Object apply(Object t1, Object t2, Object t3, Object t4, Object t5) throws Exception { |
| 964 |
return null; |
| 965 |
} |
| 966 |
|
| 967 |
@Override |
| 968 |
public Object apply(Object t1, Object t2, Object t3, Object t4) throws Exception { |
| 969 |
return null; |
| 970 |
} |
| 971 |
|
| 972 |
@Override |
| 973 |
public Object apply(Object t1, Object t2, Object t3) throws Exception { |
| 974 |
return null; |
| 975 |
} |
| 976 |
|
| 977 |
@Override |
| 978 |
public void accept(Object t1, Object t2) throws Exception { |
| 979 |
} |
| 980 |
|
| 981 |
@Override |
| 982 |
public Object apply(Object t1, Object t2) throws Exception { |
| 983 |
return null; |
| 984 |
} |
| 985 |
|
| 986 |
@Override |
| 987 |
public void subscribe(CompletableEmitter e) throws Exception { |
| 988 |
} |
| 989 |
|
| 990 |
@Override |
| 991 |
public void subscribe(MaybeEmitter e) throws Exception { |
| 992 |
} |
| 993 |
|
| 994 |
@Override |
| 995 |
public void subscribe(SingleEmitter e) throws Exception { |
| 996 |
} |
| 997 |
|
| 998 |
@Override |
| 999 |
public void subscribe(ObservableEmitter e) throws Exception { |
| 1000 |
} |
| 1001 |
|
| 1002 |
@Override |
| 1003 |
public void subscribe(FlowableEmitter e) throws Exception { |
| 1004 |
} |
| 1005 |
|
| 1006 |
@Override |
| 1007 |
public boolean test(Object t1, Object t2) throws Exception { |
| 1008 |
return false; |
| 1009 |
} |
| 1010 |
|
| 1011 |
@Override |
| 1012 |
public boolean test(Object t) throws Exception { |
| 1013 |
return false; |
| 1014 |
} |
| 1015 |
|
| 1016 |
@Override |
| 1017 |
public void onSuccess(Object t) { |
| 1018 |
} |
| 1019 |
|
| 1020 |
@Override |
| 1021 |
public void onSubscribe(Disposable d) { |
| 1022 |
} |
| 1023 |
|
| 1024 |
@Override |
| 1025 |
public void onSubscribe(Subscription s) { |
| 1026 |
s.request(Long.MAX_VALUE); |
| 1027 |
} |
| 1028 |
|
| 1029 |
@Override |
| 1030 |
public void onNext(Object t) { |
| 1031 |
} |
| 1032 |
|
| 1033 |
@Override |
| 1034 |
public void onError(Throwable t) { |
| 1035 |
} |
| 1036 |
|
| 1037 |
@Override |
| 1038 |
public void onComplete() { |
| 1039 |
} |
| 1040 |
|
| 1041 |
@Override |
| 1042 |
public CompletableSource apply(Completable upstream) { |
| 1043 |
return upstream; |
| 1044 |
} |
| 1045 |
|
| 1046 |
@Override |
| 1047 |
public MaybeSource apply(Maybe upstream) { |
| 1048 |
return upstream; |
| 1049 |
} |
| 1050 |
|
| 1051 |
@Override |
| 1052 |
public SingleSource apply(Single upstream) { |
| 1053 |
return upstream; |
| 1054 |
} |
| 1055 |
|
| 1056 |
@Override |
| 1057 |
public ObservableSource apply(Observable upstream) { |
| 1058 |
return upstream; |
| 1059 |
} |
| 1060 |
|
| 1061 |
@Override |
| 1062 |
public Publisher apply(Flowable upstream) { |
| 1063 |
return upstream; |
| 1064 |
} |
| 1065 |
|
| 1066 |
@Override |
| 1067 |
public CompletableObserver apply(CompletableObserver observer) throws Exception { |
| 1068 |
return observer; |
| 1069 |
} |
| 1070 |
|
| 1071 |
@Override |
| 1072 |
public MaybeObserver apply(MaybeObserver observer) throws Exception { |
| 1073 |
return observer; |
| 1074 |
} |
| 1075 |
|
| 1076 |
@Override |
| 1077 |
public SingleObserver apply(SingleObserver observer) throws Exception { |
| 1078 |
return observer; |
| 1079 |
} |
| 1080 |
|
| 1081 |
@Override |
| 1082 |
public Observer apply(Observer observer) throws Exception { |
| 1083 |
return observer; |
| 1084 |
} |
| 1085 |
|
| 1086 |
@Override |
| 1087 |
public Subscriber apply(Subscriber observer) throws Exception { |
| 1088 |
return observer; |
| 1089 |
} |
| 1090 |
|
| 1091 |
@Override |
| 1092 |
public boolean getAsBoolean() throws Exception { |
| 1093 |
return false; |
| 1094 |
} |
| 1095 |
|
| 1096 |
@Override |
| 1097 |
public int compare(Object o1, Object o2) { |
| 1098 |
return 0; |
| 1099 |
} |
| 1100 |
} |
| 1101 |
|
| 1102 |
enum ParamMode { |
| 1103 |
ANY, |
| 1104 |
NON_NEGATIVE |
| 1105 |
} |
| 1106 |
|
| 1107 |
static final class ParamIgnore { |
| 1108 |
final Class<?> clazz; |
| 1109 |
final String name; |
| 1110 |
final Class<?>[] arguments; |
| 1111 |
|
| 1112 |
ParamIgnore(Class<?> clazz, String name, Class<?>... arguments) { |
| 1113 |
this.clazz = clazz; |
| 1114 |
this.name = name; |
| 1115 |
this.arguments = arguments; |
| 1116 |
} |
| 1117 |
|
| 1118 |
@Override |
| 1119 |
public String toString() { |
| 1120 |
return clazz.getName() + " " + name; |
| 1121 |
} |
| 1122 |
} |
| 1123 |
|
| 1124 |
static final class ParamOverride { |
| 1125 |
final Class<?> clazz; |
| 1126 |
final int index; |
| 1127 |
final ParamMode mode; |
| 1128 |
final String name; |
| 1129 |
final Class<?>[] arguments; |
| 1130 |
|
| 1131 |
ParamOverride(Class<?> clazz, int index, ParamMode mode, String name, Class<?>... arguments) { |
| 1132 |
this.clazz = clazz; |
| 1133 |
this.index = index; |
| 1134 |
this.mode = mode; |
| 1135 |
this.name = name; |
| 1136 |
this.arguments = arguments; |
| 1137 |
|
| 1138 |
try { |
| 1139 |
clazz.getMethod(name, arguments); |
| 1140 |
} catch (Exception ex) { |
| 1141 |
throw new AssertionError(ex); |
| 1142 |
} |
| 1143 |
} |
| 1144 |
|
| 1145 |
@Override |
| 1146 |
public String toString() { |
| 1147 |
return clazz.getName() + " " + name; |
| 1148 |
} |
| 1149 |
} |
| 1150 |
|
| 1151 |
static final class NeverPublisher extends Flowable<Object> { |
| 1152 |
|
| 1153 |
@Override |
| 1154 |
public void subscribeActual(Subscriber<? super Object> s) { |
| 1155 |
// not invoked, the class is a placeholder default value |
| 1156 |
} |
| 1157 |
|
| 1158 |
@Override |
| 1159 |
public String toString() { |
| 1160 |
return "NeverFlowable"; |
| 1161 |
} |
| 1162 |
} |
| 1163 |
|
| 1164 |
static final class NeverObservable extends Observable<Object> { |
| 1165 |
|
| 1166 |
@Override |
| 1167 |
public void subscribeActual(Observer<? super Object> observer) { |
| 1168 |
// not invoked, the class is a placeholder default value |
| 1169 |
} |
| 1170 |
|
| 1171 |
@Override |
| 1172 |
public String toString() { |
| 1173 |
return "NeverFlowable"; |
| 1174 |
} |
| 1175 |
} |
| 1176 |
|
| 1177 |
static final class NeverSingle extends Single<Object> { |
| 1178 |
|
| 1179 |
@Override |
| 1180 |
public void subscribeActual(SingleObserver<? super Object> observer) { |
| 1181 |
// not invoked, the class is a placeholder default value |
| 1182 |
} |
| 1183 |
|
| 1184 |
@Override |
| 1185 |
public String toString() { |
| 1186 |
return "NeverSingle"; |
| 1187 |
} |
| 1188 |
} |
| 1189 |
|
| 1190 |
static final class NeverMaybe extends Maybe<Object> { |
| 1191 |
|
| 1192 |
@Override |
| 1193 |
public void subscribeActual(MaybeObserver<? super Object> observer) { |
| 1194 |
// not invoked, the class is a placeholder default value |
| 1195 |
} |
| 1196 |
|
| 1197 |
@Override |
| 1198 |
public String toString() { |
| 1199 |
return "NeverMaybe"; |
| 1200 |
} |
| 1201 |
} |
| 1202 |
static final class NeverCompletable extends Completable { |
| 1203 |
|
| 1204 |
@Override |
| 1205 |
public void subscribeActual(CompletableObserver observer) { |
| 1206 |
// not invoked, the class is a placeholder default value |
| 1207 |
} |
| 1208 |
|
| 1209 |
@Override |
| 1210 |
public String toString() { |
| 1211 |
return "NeverCompletable"; |
| 1212 |
} |
| 1213 |
} |
| 1214 |
} |