Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Javadoc checks to Checkstyle. Fix violating Javadoc. #7210

Merged
merged 1 commit into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jar {
}

license {
header rootProject.file("HEADER")
header rootProject.file("config/license/HEADER")
ext.year = Calendar.getInstance().get(Calendar.YEAR)
skipExistingHeaders true
ignoreFailures true
Expand Down Expand Up @@ -235,10 +235,11 @@ jacocoTestReport.dependsOn GCandMem
build.dependsOn jacocoTestReport

checkstyle {
configFile = file("checkstyle.xml")
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
toolVersion = checkstyleVersion
configProperties = [
"checkstyle.header.file": file("HEADER_JAVA")
"checkstyle.suppressions.file": rootProject.file("config/checkstyle/suppressions.xml"),
"checkstyle.header.file": rootProject.file("config/license/HEADER_JAVA")
]
}

Expand Down
6 changes: 6 additions & 0 deletions checkstyle.xml → config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
<module name="SuppressionFilter">
<property name="file" value="${checkstyle.suppressions.file}"/>
</module>

<!-- Headers -->
<module name="Header">
Expand All @@ -12,6 +15,9 @@
</module>

<module name="TreeWalker">
<module name="JavadocMethod"/>
<module name="MissingJavadocMethod"/>

<module name="RegexpSinglelineJava">
<property name="severity" value="warning"/>
<property name="format" value="^(?!\s+\* $).*?\s+$"/>
Expand Down
13 changes: 13 additions & 0 deletions config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>

<suppress checks="MissingJavadocMethod" files="[\\/]main[\\/]java[\\/]io[\\/]reactivex[\\/]rxjava3[\\/]internal[\\/]"/>
<suppress checks="MissingJavadocMethod" files="[\\/]jmh[\\/]java[\\/]io[\\/]reactivex[\\/]rxjava3[\\/]"/>
<suppress checks="MissingJavadocMethod" files="[\\/]test[\\/]java[\\/]io[\\/]reactivex[\\/]rxjava3[\\/]"/>

</suppressions>
File renamed without changes.
File renamed without changes.
11 changes: 6 additions & 5 deletions src/main/java/io/reactivex/rxjava3/core/Completable.java
Original file line number Diff line number Diff line change
Expand Up @@ -1908,11 +1908,12 @@ public final Completable doOnLifecycle(@NonNull Consumer<? super Disposable> onS
* <dt><b>Scheduler:</b></dt>
* <dd>{@code doOnLifecycle} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
* @param onSubscribe the consumer called when a {@link CompletableObserver} subscribes.
* @param onError the consumer called when this emits an {@code onError} event
* @param onComplete the runnable called just before when the current {@code Completable} completes normally
* @param onAfterTerminate the runnable called after this {@code Completable} completes normally
* @param onDispose the {@link Runnable} called when the downstream disposes the subscription
* @param onSubscribe the {@link Consumer} called when a {@link CompletableObserver} subscribes.
* @param onError the {@code Consumer} called when this emits an {@code onError} event
* @param onComplete the {@link Action} called just before when the current {@code Completable} completes normally
* @param onTerminate the {@code Action} called just before this {@code Completable} terminates
* @param onAfterTerminate the {@code Action} called after this {@code Completable} completes normally
* @param onDispose the {@code Action} called when the downstream disposes the subscription
* @return the new {@code Completable} instance
* @throws NullPointerException if {@code onSubscribe}, {@code onError}, {@code onComplete}
* {@code onTerminate}, {@code onAfterTerminate} or {@code onDispose} is {@code null}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/reactivex/rxjava3/core/Flowable.java
Original file line number Diff line number Diff line change
Expand Up @@ -9723,6 +9723,10 @@ public final Flowable<T> doOnComplete(@NonNull Action onComplete) {
* <dd>{@code doOnEach} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
*
* @param onNext the {@link Consumer} to invoke when the current {@code Flowable} calls {@code onNext}
* @param onError the {@code Consumer} to invoke when the current {@code Flowable} calls {@code onError}
* @param onComplete the {@link Action} to invoke when the current {@code Flowable} calls {@code onComplete}
* @param onAfterTerminate the {@code Action} to invoke when the current {@code Flowable} calls {@code onAfterTerminate}
* @return the new {@code Flowable} instance
* @throws NullPointerException if {@code onNext}, {@code onError}, {@code onComplete} or {@code onAfterTerminate} is {@code null}
* @see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/reactivex/rxjava3/core/Notification.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public final class Notification<T> {

final Object value;

/** Not meant to be implemented externally. */
/** Not meant to be implemented externally.
* @param value the value to carry around in the notification, not {@code null}
*/
private Notification(@Nullable Object value) {
this.value = value;
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/reactivex/rxjava3/core/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -8608,6 +8608,10 @@ public final Observable<T> doOnComplete(@NonNull Action onComplete) {
* <dd>{@code doOnEach} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
*
* @param onNext the {@link Consumer} to invoke when the current {@code Observable} calls {@code onNext}
* @param onError the {@code Consumer} to invoke when the current {@code Observable} calls {@code onError}
* @param onComplete the {@link Action} to invoke when the current {@code Observable} calls {@code onComplete}
* @param onAfterTerminate the {@code Action} to invoke when the current {@code Observable} calls {@code onAfterTerminate}
* @return the new {@code Observable} instance
* @throws NullPointerException if {@code onNext}, {@code onError}, {@code onComplete} or {@code onAfterTerminate} is {@code null}
* @see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ private void appendStackTrace(StringBuilder b, Throwable ex, String prefix) {
}

abstract static class PrintStreamOrWriter {
/** Prints the specified string as a line on this StreamOrWriter. */
/** Prints the specified string as a line on this StreamOrWriter.
* @param o string to print
*/
abstract void println(Object o);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ public static <T> ConnectableFlowable<T> create(Flowable<T> source,
}

/**
* Creates a OperatorReplay instance to replay values of the given source observable.
* @param source the source observable
* @param bufferFactory the factory to instantiate the appropriate buffer when the observable becomes active
* @return the connectable observable
* Creates a OperatorReplay instance to replay values of the given source {@code Flowable}.
* @param <T> the value type
* @param source the source {@code Flowable} to use
* @param bufferFactory the factory to instantiate the appropriate buffer when the {@code Flowable} becomes active
* @return the {@code ConnectableFlowable} instance
*/
static <T> ConnectableFlowable<T> create(Flowable<T> source,
final Supplier<? extends ReplayBuffer<T>> bufferFactory) {
Expand Down Expand Up @@ -544,6 +545,7 @@ public void dispose() {
}
/**
* Convenience method to auto-cast the index object.
* @param <U> type to cast index object
* @return the current index object
*/
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static <T> boolean tryAsCompletable(Object source,
* Try subscribing to a {@link MaybeSource} mapped from
* a scalar source (which implements {@link Supplier}).
* @param <T> the upstream value type
* @param <R> the downstream value type
* @param source the source reactive type ({@code Flowable} or {@code Observable})
* possibly implementing {@link Supplier}.
* @param mapper the function that turns the scalar upstream value into a
Expand Down Expand Up @@ -117,6 +118,7 @@ static <T, R> boolean tryAsMaybe(Object source,
* Try subscribing to a {@link SingleSource} mapped from
* a scalar source (which implements {@link Supplier}).
* @param <T> the upstream value type
* @param <R> the downstream value type
* @param source the source reactive type ({@code Flowable} or {@code Observable})
* possibly implementing {@link Supplier}.
* @param mapper the function that turns the scalar upstream value into a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public static <T> ConnectableObservable<T> create(ObservableSource<T> source,

/**
* Creates a OperatorReplay instance to replay values of the given source observable.
* @param <T> the value type
* @param source the source observable
* @param bufferFactory the factory to instantiate the appropriate buffer when the observable becomes active
* @return the connectable observable
Expand Down Expand Up @@ -453,6 +454,7 @@ public void dispose() {
}
/**
* Convenience method to auto-cast the index object.
* @param <U> type index to be casted to
* @return the index Object or null
*/
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ static boolean isCancelled(BooleanSupplier cancelled) {
/**
* Drains the queue based on the outstanding requests in post-completed mode (only!).
*
* @param <T> the value type
* @param n the current request amount
* @param actual the target Subscriber to send events to
* @param queue the queue to drain if in the post-complete state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public abstract class BaseTestConsumer<T, U extends BaseTestConsumer<T, U>> {
*/
protected boolean timeout;

/**
* Constructs a {@code BaseTestConsumer} with {@code CountDownLatch} set to 1.
*/
public BaseTestConsumer() {
this.values = new VolatileSizeArrayList<>();
this.errors = new VolatileSizeArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void compositeExceptionFromTwoDuplicateComposites() {
cex.getCause().printStackTrace();
}

/**
/*
* This hijacks the Throwable.printStackTrace() output and puts it in a string, where we can look for
* "CIRCULAR REFERENCE" (a String added by Throwable.printEnclosedStackTrace)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ private SchedulerTestHelper() {
/**
* Verifies that the given Scheduler does not deliver handled errors to its executing Thread's
* {@link java.lang.Thread.UncaughtExceptionHandler}.
*
* @param scheduler {@link Scheduler} to verify.
*/
static void handledErrorIsNotDeliveredToThreadHandler(Scheduler scheduler) throws InterruptedException {
Thread.UncaughtExceptionHandler originalHandler = Thread.getDefaultUncaughtExceptionHandler();
Expand Down