Skip to content

Commit 5c0ca03

Browse files
Added Javadoc checks to Checkstyle. Fix violating Javadoc. (#7210)
Add JavadocMethod and MissingJavadocMethod checks to Checkstyle. Checks ensure there are no missing Javadoc comments for public methods, and that each of the Javadoc comments describe all method parameters. Add suppressions.xml Checkstyle configuration file to exclude Jmh, Test, and Internal from MissingJavadocMethod check. Move Checkstyle configuration files and License headers into config directory. Fix Javadoc comments that violate the added checks.
1 parent ea8c183 commit 5c0ca03

File tree

17 files changed

+60
-15
lines changed

17 files changed

+60
-15
lines changed

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jar {
129129
}
130130

131131
license {
132-
header rootProject.file("HEADER")
132+
header rootProject.file("config/license/HEADER")
133133
ext.year = Calendar.getInstance().get(Calendar.YEAR)
134134
skipExistingHeaders true
135135
ignoreFailures true
@@ -234,10 +234,11 @@ jacocoTestReport.dependsOn GCandMem
234234
build.dependsOn jacocoTestReport
235235

236236
checkstyle {
237-
configFile = file("checkstyle.xml")
237+
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
238238
toolVersion = checkstyleVersion
239239
configProperties = [
240-
"checkstyle.header.file": file("HEADER_JAVA")
240+
"checkstyle.suppressions.file": rootProject.file("config/checkstyle/suppressions.xml"),
241+
"checkstyle.header.file": rootProject.file("config/license/HEADER_JAVA")
241242
]
242243
}
243244

checkstyle.xml renamed to config/checkstyle/checkstyle.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"https://checkstyle.org/dtds/configuration_1_3.dtd">
55

66
<module name="Checker">
7+
<module name="SuppressionFilter">
8+
<property name="file" value="${checkstyle.suppressions.file}"/>
9+
</module>
710

811
<!-- Headers -->
912
<module name="Header">
@@ -12,6 +15,9 @@
1215
</module>
1316

1417
<module name="TreeWalker">
18+
<module name="JavadocMethod"/>
19+
<module name="MissingJavadocMethod"/>
20+
1521
<module name="RegexpSinglelineJava">
1622
<property name="severity" value="warning"/>
1723
<property name="format" value="^(?!\s+\* $).*?\s+$"/>

config/checkstyle/suppressions.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0"?>
2+
3+
<!DOCTYPE suppressions PUBLIC
4+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
5+
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
6+
7+
<suppressions>
8+
9+
<suppress checks="MissingJavadocMethod" files="[\\/]main[\\/]java[\\/]io[\\/]reactivex[\\/]rxjava3[\\/]internal[\\/]"/>
10+
<suppress checks="MissingJavadocMethod" files="[\\/]jmh[\\/]java[\\/]io[\\/]reactivex[\\/]rxjava3[\\/]"/>
11+
<suppress checks="MissingJavadocMethod" files="[\\/]test[\\/]java[\\/]io[\\/]reactivex[\\/]rxjava3[\\/]"/>
12+
13+
</suppressions>
File renamed without changes.
File renamed without changes.

src/main/java/io/reactivex/rxjava3/core/Completable.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,11 +1908,12 @@ public final Completable doOnLifecycle(@NonNull Consumer<? super Disposable> onS
19081908
* <dt><b>Scheduler:</b></dt>
19091909
* <dd>{@code doOnLifecycle} does not operate by default on a particular {@link Scheduler}.</dd>
19101910
* </dl>
1911-
* @param onSubscribe the consumer called when a {@link CompletableObserver} subscribes.
1912-
* @param onError the consumer called when this emits an {@code onError} event
1913-
* @param onComplete the runnable called just before when the current {@code Completable} completes normally
1914-
* @param onAfterTerminate the runnable called after this {@code Completable} completes normally
1915-
* @param onDispose the {@link Runnable} called when the downstream disposes the subscription
1911+
* @param onSubscribe the {@link Consumer} called when a {@link CompletableObserver} subscribes.
1912+
* @param onError the {@code Consumer} called when this emits an {@code onError} event
1913+
* @param onComplete the {@link Action} called just before when the current {@code Completable} completes normally
1914+
* @param onTerminate the {@code Action} called just before this {@code Completable} terminates
1915+
* @param onAfterTerminate the {@code Action} called after this {@code Completable} completes normally
1916+
* @param onDispose the {@code Action} called when the downstream disposes the subscription
19161917
* @return the new {@code Completable} instance
19171918
* @throws NullPointerException if {@code onSubscribe}, {@code onError}, {@code onComplete}
19181919
* {@code onTerminate}, {@code onAfterTerminate} or {@code onDispose} is {@code null}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9723,6 +9723,10 @@ public final Flowable<T> doOnComplete(@NonNull Action onComplete) {
97239723
* <dd>{@code doOnEach} does not operate by default on a particular {@link Scheduler}.</dd>
97249724
* </dl>
97259725
*
9726+
* @param onNext the {@link Consumer} to invoke when the current {@code Flowable} calls {@code onNext}
9727+
* @param onError the {@code Consumer} to invoke when the current {@code Flowable} calls {@code onError}
9728+
* @param onComplete the {@link Action} to invoke when the current {@code Flowable} calls {@code onComplete}
9729+
* @param onAfterTerminate the {@code Action} to invoke when the current {@code Flowable} calls {@code onAfterTerminate}
97269730
* @return the new {@code Flowable} instance
97279731
* @throws NullPointerException if {@code onNext}, {@code onError}, {@code onComplete} or {@code onAfterTerminate} is {@code null}
97289732
* @see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>

src/main/java/io/reactivex/rxjava3/core/Notification.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public final class Notification<T> {
2626

2727
final Object value;
2828

29-
/** Not meant to be implemented externally. */
29+
/** Not meant to be implemented externally.
30+
* @param value the value to carry around in the notification, not {@code null}
31+
*/
3032
private Notification(@Nullable Object value) {
3133
this.value = value;
3234
}

src/main/java/io/reactivex/rxjava3/core/Observable.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8608,6 +8608,10 @@ public final Observable<T> doOnComplete(@NonNull Action onComplete) {
86088608
* <dd>{@code doOnEach} does not operate by default on a particular {@link Scheduler}.</dd>
86098609
* </dl>
86108610
*
8611+
* @param onNext the {@link Consumer} to invoke when the current {@code Observable} calls {@code onNext}
8612+
* @param onError the {@code Consumer} to invoke when the current {@code Observable} calls {@code onError}
8613+
* @param onComplete the {@link Action} to invoke when the current {@code Observable} calls {@code onComplete}
8614+
* @param onAfterTerminate the {@code Action} to invoke when the current {@code Observable} calls {@code onAfterTerminate}
86118615
* @return the new {@code Observable} instance
86128616
* @throws NullPointerException if {@code onNext}, {@code onError}, {@code onComplete} or {@code onAfterTerminate} is {@code null}
86138617
* @see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>

src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ private void appendStackTrace(StringBuilder b, Throwable ex, String prefix) {
229229
}
230230

231231
abstract static class PrintStreamOrWriter {
232-
/** Prints the specified string as a line on this StreamOrWriter. */
232+
/** Prints the specified string as a line on this StreamOrWriter.
233+
* @param o string to print
234+
*/
233235
abstract void println(Object o);
234236
}
235237

0 commit comments

Comments
 (0)