Skip to content

Commit 5dbc2a8

Browse files
authoredJan 22, 2020
3.x: Add last missing throws tag to JavaDocs (#6860)
1 parent e8d59c5 commit 5dbc2a8

File tree

4 files changed

+80
-3
lines changed

4 files changed

+80
-3
lines changed
 

‎src/main/java/io/reactivex/rxjava3/core/Flowable.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public static <T> Flowable<T> amb(@NonNull Iterable<@NonNull ? extends Publisher
213213
@BackpressureSupport(BackpressureKind.PASS_THROUGH)
214214
@SchedulerSupport(SchedulerSupport.NONE)
215215
@SafeVarargs
216-
public static <T> Flowable<T> ambArray(Publisher<@NonNull ? extends T>... sources) {
216+
public static <T> Flowable<T> ambArray(@NonNull Publisher<@NonNull ? extends T>... sources) {
217217
Objects.requireNonNull(sources, "sources is null");
218218
int len = sources.length;
219219
if (len == 0) {
@@ -1915,7 +1915,7 @@ public static <T> Flowable<T> empty() {
19151915
* @param supplier
19161916
* a {@link Supplier} factory to return a {@link Throwable} for each individual {@code Subscriber}
19171917
* @param <T>
1918-
* the type of the items (ostensibly) emitted by the {@link Publisher}
1918+
* the type of the items (ostensibly) emitted by the resulting {@code Flowable}
19191919
* @return the new {@code Flowable} instance
19201920
* @throws NullPointerException if {@code supplier} is {@code null}
19211921
* @see <a href="http://reactivex.io/documentation/operators/empty-never-throw.html">ReactiveX operators documentation: Throw</a>
@@ -1944,7 +1944,7 @@ public static <T> Flowable<T> error(@NonNull Supplier<? extends Throwable> suppl
19441944
* @param throwable
19451945
* the particular {@link Throwable} to pass to {@link Subscriber#onError onError}
19461946
* @param <T>
1947-
* the type of the items (ostensibly) emitted by the {@link Publisher}
1947+
* the type of the items (ostensibly) emitted by the resulting {@code Flowable}
19481948
* @return the new {@code Flowable} instance
19491949
* @throws NullPointerException if {@code throwable} is {@code null}
19501950
* @see <a href="http://reactivex.io/documentation/operators/empty-never-throw.html">ReactiveX operators documentation: Throw</a>
@@ -8760,6 +8760,7 @@ public final Flowable<T> delay(long time, @NonNull TimeUnit unit, @NonNull Sched
87608760
* then used to delay the emission of that item by the resulting {@code Flowable} until the {@code Publisher}
87618761
* returned from {@code itemDelay} emits an item
87628762
* @return the new {@code Flowable} instance
8763+
* @throws NullPointerException if {@code subscriptionIndicator} and {@code itemDelayIndicator} is {@code null}
87638764
* @see <a href="http://reactivex.io/documentation/operators/delay.html">ReactiveX operators documentation: Delay</a>
87648765
*/
87658766
@CheckReturnValue

‎src/main/java/io/reactivex/rxjava3/core/Single.java

+1
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ public static <T> Single<T> error(@NonNull Throwable throwable) {
681681
* the type of object that the {@code Future} returns, and also the type of item to be emitted by
682682
* the resulting {@code Single}
683683
* @return the new {@code Single} that emits the item from the source {@code Future}
684+
* @throws NullPointerException if {@code future} is {@code null}
684685
* @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
685686
* @see #fromFuture(Future, long, TimeUnit)
686687
* @see #fromCompletionStage(CompletionStage)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
package io.reactivex.rxjava3.internal.util;
14+
15+
import java.io.File;
16+
import java.nio.file.Files;
17+
import java.util.List;
18+
19+
import io.reactivex.rxjava3.core.*;
20+
import io.reactivex.rxjava3.parallel.ParallelFlowable;
21+
import io.reactivex.rxjava3.testsupport.TestHelper;
22+
23+
/**
24+
* Scan the JavaDocs of the base classes and list those which do not have the {@code @throws} tag.
25+
* The lack is not an error by itself but worth looking at.
26+
*/
27+
public final class JavadocNoThrows {
28+
29+
private JavadocNoThrows() {
30+
throw new IllegalArgumentException("No instances!");
31+
}
32+
33+
public static void main(String[] args) throws Exception {
34+
for (Class<?> clazz : CLASSES) {
35+
String clazzName = clazz.getSimpleName();
36+
String packageName = clazz.getPackage().getName();
37+
File f = TestHelper.findSource(clazzName, packageName);
38+
39+
List<String> lines = Files.readAllLines(f.toPath());
40+
41+
for (int i = 1; i < lines.size(); i++) {
42+
String line = lines.get(i).trim();
43+
44+
if (line.startsWith("/**")) {
45+
boolean found = false;
46+
for (int j = i + 1; j < lines.size(); j++) {
47+
48+
String line2 = lines.get(j).trim();
49+
if (line2.startsWith("public")) {
50+
if (line2.endsWith("() {")) {
51+
found = true;
52+
}
53+
break;
54+
}
55+
if (line2.startsWith("* @throws")) {
56+
found = true;
57+
break;
58+
}
59+
}
60+
61+
if (!found) {
62+
System.out.printf(" at %s.%s.method(%s.java:%s)%n%n", packageName, clazzName, clazzName, i + 1);
63+
}
64+
}
65+
}
66+
}
67+
}
68+
69+
static final Class<?>[] CLASSES = {
70+
Flowable.class, Observable.class, Maybe.class, Single.class, Completable.class, ParallelFlowable.class
71+
};
72+
}

‎src/test/java/io/reactivex/rxjava3/validators/ParamValidationNaming.java

+3
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,9 @@ static final class ValidatorStrings {
523523
new ValidatorStrings("stage", "* @throws NullPointerException"),
524524
new ValidatorStrings("stream", "* @throws NullPointerException"),
525525
new ValidatorStrings("collector", "* @throws NullPointerException"),
526+
new ValidatorStrings("subscriptionIndicator", "* @throws NullPointerException"),
527+
new ValidatorStrings("itemDelayIndicator", "* @throws NullPointerException"),
528+
new ValidatorStrings("future", "* @throws NullPointerException"),
526529

527530
new ValidatorStrings("parallelism", "* @throws IllegalArgumentException"),
528531
new ValidatorStrings("prefetch", "* @throws IllegalArgumentException"),

0 commit comments

Comments
 (0)
Please sign in to comment.