Skip to content

Commit a1741d5

Browse files
authored
4.x: Improve Javadocs + limit line length + cleanup indentation + check (#8050)
* 4.x: Improve Javadocs + limit line length + cleanup indentation + check * Fix style checker errors
1 parent cc09289 commit a1741d5

File tree

106 files changed

+1020
-810
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1020
-810
lines changed

config/checkstyle/checkstyle.xml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,11 @@
55
This configuration file was written by the eclipse-cs plugin configuration editor
66
-->
77
<!--
8-
Checkstyle-Configuration: rxjava
8+
Checkstyle-Configuration: local
99
Description: none
1010
-->
1111
<module name="Checker">
1212
<property name="severity" value="warning"/>
13-
<module name="SuppressionFilter">
14-
<property name="file" value="${config_loc}/suppressions.xml"/>
15-
<property name="optional" value="false"/>
16-
</module>
17-
<module name="BeforeExecutionExclusionFileFilter">
18-
<property name="fileNamePattern" value="module\-info\.java$"/>
19-
</module>
2013
<module name="TreeWalker">
2114
<module name="MissingJavadocMethod"/>
2215
<module name="JavadocMethod"/>
@@ -25,9 +18,38 @@
2518
<property name="format" value="^(?!\s+\* $).*?\s+$"/>
2619
<property name="message" value="Line has trailing spaces."/>
2720
</module>
21+
<module name="RegexpSinglelineJava">
22+
<property name="severity" value="warning"/>
23+
<property name="format" value="^\*|^ {2,4}\*|^ {6,8}\*|^ {10,12}\*|\t"/>
24+
<property name="message" value="Javadoc Indentation must be 1, 5, 9, 13, etc spaces"/>
25+
</module>
26+
<module name="RegexpSinglelineJava">
27+
<property name="severity" value="warning"/>
28+
<property name="format" value="^ {1,3}//|^ {5,7}//|^ {9,11}//|^ {13,15}//|\t"/>
29+
<property name="message" value="// comments must be prefixed by 4, 8, 12, etc spaces"/>
30+
</module>
31+
<module name="RegexpSinglelineJava">
32+
<property name="severity" value="warning"/>
33+
<property name="format" value="^ {1,3}/\*|^ {5,7}/\*|^ {9,11}/\*|^ {13,15}/\*|\t"/>
34+
<property name="message" value="/* comments must be prefixed by 4, 8, 12, etc spaces"/>
35+
</module>
36+
<module name="RegexpSinglelineJava">
37+
<property name="severity" value="warning"/>
38+
<property name="format" value="^(?!\s*\*)(( {1,3}\S)|( {5,7}\S)|( {9,11}\S)|( {13,15}\S))|\t"/>
39+
<property name="message" value="Indentation must be a multiple of exactly 4 spaces (no tabs allowed)"/>
40+
</module>
41+
</module>
42+
<module name="SuppressionFilter">
43+
<property name="file" value="${config_loc}/suppressions.xml"/>
44+
</module>
45+
<module name="BeforeExecutionExclusionFileFilter">
46+
<property name="fileNamePattern" value="module\-info\.java$"/>
2847
</module>
2948
<module name="Header">
3049
<property name="fileExtensions" value="java"/>
3150
<property name="headerFile" value="${config_loc}/../license/HEADER_JAVA"/>
3251
</module>
52+
<module name="LineLength">
53+
<property name="max" value="175"/>
54+
</module>
3355
</module>

src/jmh/java/io/reactivex/rxjava4/core/MemoryPerf.java

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,21 +234,28 @@ public boolean test(Object v) {
234234
checkMemory(new Callable<Object>() {
235235
@Override
236236
public Object call() {
237-
return io.reactivex.rxjava4.core.Observable.range(1, 10).subscribeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Observer());
237+
return io.reactivex.rxjava4.core.Observable.range(1, 10)
238+
.subscribeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation())
239+
.subscribeWith(new MyRx2Observer());
238240
}
239241
}, "range+subscribeOn+consumer", "Rx2Observable");
240242

241243
checkMemory(new Callable<Object>() {
242244
@Override
243245
public Object call() {
244-
return io.reactivex.rxjava4.core.Observable.range(1, 10).observeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Observer());
246+
return io.reactivex.rxjava4.core.Observable.range(1, 10)
247+
.observeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation())
248+
.subscribeWith(new MyRx2Observer());
245249
}
246250
}, "range+observeOn+consumer", "Rx2Observable");
247251

248252
checkMemory(new Callable<Object>() {
249253
@Override
250254
public Object call() {
251-
return io.reactivex.rxjava4.core.Observable.range(1, 10).subscribeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation()).observeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Observer());
255+
return io.reactivex.rxjava4.core.Observable.range(1, 10)
256+
.subscribeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation())
257+
.observeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation())
258+
.subscribeWith(new MyRx2Observer());
252259
}
253260
}, "range+subscribeOn+observeOn+consumer", "Rx2Observable");
254261

@@ -424,21 +431,28 @@ public boolean test(Object v) {
424431
checkMemory(new Callable<Object>() {
425432
@Override
426433
public Object call() {
427-
return io.reactivex.rxjava4.core.Flowable.range(1, 10).subscribeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Subscriber());
434+
return io.reactivex.rxjava4.core.Flowable.range(1, 10)
435+
.subscribeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation())
436+
.subscribeWith(new MyRx2Subscriber());
428437
}
429438
}, "range+subscribeOn+consumer", "Rx2Flowable");
430439

431440
checkMemory(new Callable<Object>() {
432441
@Override
433442
public Object call() {
434-
return io.reactivex.rxjava4.core.Flowable.range(1, 10).observeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Subscriber());
443+
return io.reactivex.rxjava4.core.Flowable.range(1, 10)
444+
.observeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation())
445+
.subscribeWith(new MyRx2Subscriber());
435446
}
436447
}, "range+observeOn+consumer", "Rx2Flowable");
437448

438449
checkMemory(new Callable<Object>() {
439450
@Override
440451
public Object call() {
441-
return io.reactivex.rxjava4.core.Flowable.range(1, 10).subscribeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation()).observeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Subscriber());
452+
return io.reactivex.rxjava4.core.Flowable.range(1, 10)
453+
.subscribeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation())
454+
.observeOn(io.reactivex.rxjava4.schedulers.Schedulers.computation())
455+
.subscribeWith(new MyRx2Subscriber());
442456
}
443457
}, "range+subscribeOn+observeOn+consumer", "Rx2Flowable");
444458

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2855,7 +2855,9 @@ public final void subscribe(@NonNull CompletableObserver observer) {
28552855

28562856
observer = RxJavaPlugins.onSubscribe(this, observer);
28572857

2858-
Objects.requireNonNull(observer, "The RxJavaPlugins.onSubscribe hook returned a null CompletableObserver. Please check the handler provided to RxJavaPlugins.setOnCompletableSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins");
2858+
Objects.requireNonNull(observer, "The RxJavaPlugins.onSubscribe hook returned a null CompletableObserver. "
2859+
+ "Please check the handler provided to RxJavaPlugins.setOnCompletableSubscribe for invalid null returns. "
2860+
+ "Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins");
28592861

28602862
subscribeActual(observer);
28612863
} catch (NullPointerException ex) { // NOPMD

0 commit comments

Comments
 (0)