The following issues were found

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptyTest.java
38 issues
This class has too many methods, consider refactoring it.
Design

Line: 26

              import io.reactivex.rxjava3.processors.PublishProcessor;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class MaybeIsEmptyTest extends RxJavaTest {

    @Test
    public void normal() {
        Maybe.just(1)
        .isEmpty()

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 29

              public class MaybeIsEmptyTest extends RxJavaTest {

    @Test
    public void normal() {
        Maybe.just(1)
        .isEmpty()
        .test()
        .assertResult(false);
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 30

              
    @Test
    public void normal() {
        Maybe.just(1)
        .isEmpty()
        .test()
        .assertResult(false);
    }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 30

              
    @Test
    public void normal() {
        Maybe.just(1)
        .isEmpty()
        .test()
        .assertResult(false);
    }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 30

              
    @Test
    public void normal() {
        Maybe.just(1)
        .isEmpty()
        .test()
        .assertResult(false);
    }


            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 37

                  }

    @Test
    public void empty() {
        Maybe.empty()
        .isEmpty()
        .test()
        .assertResult(true);
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 38

              
    @Test
    public void empty() {
        Maybe.empty()
        .isEmpty()
        .test()
        .assertResult(true);
    }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 38

              
    @Test
    public void empty() {
        Maybe.empty()
        .isEmpty()
        .test()
        .assertResult(true);
    }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 38

              
    @Test
    public void empty() {
        Maybe.empty()
        .isEmpty()
        .test()
        .assertResult(true);
    }


            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 45

                  }

    @Test
    public void error() {
        Maybe.error(new TestException())
        .isEmpty()
        .test()
        .assertFailure(TestException.class);
    }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToCompletableTest.java
38 issues
JUnit tests should include assert() or fail()
Design

Line: 30

              public class FlowableToCompletableTest extends RxJavaTest {

    @Test
    public void justSingleItemObservable() {
        TestSubscriber<String> subscriber = TestSubscriber.create();
        Completable cmp = Flowable.just("Hello World!").ignoreElements();
        cmp.<String>toFlowable().subscribe(subscriber);

        subscriber.assertNoValues();

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 32

                  @Test
    public void justSingleItemObservable() {
        TestSubscriber<String> subscriber = TestSubscriber.create();
        Completable cmp = Flowable.just("Hello World!").ignoreElements();
        cmp.<String>toFlowable().subscribe(subscriber);

        subscriber.assertNoValues();
        subscriber.assertComplete();
        subscriber.assertNoErrors();

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 33

                  public void justSingleItemObservable() {
        TestSubscriber<String> subscriber = TestSubscriber.create();
        Completable cmp = Flowable.just("Hello World!").ignoreElements();
        cmp.<String>toFlowable().subscribe(subscriber);

        subscriber.assertNoValues();
        subscriber.assertComplete();
        subscriber.assertNoErrors();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 33

                  public void justSingleItemObservable() {
        TestSubscriber<String> subscriber = TestSubscriber.create();
        Completable cmp = Flowable.just("Hello World!").ignoreElements();
        cmp.<String>toFlowable().subscribe(subscriber);

        subscriber.assertNoValues();
        subscriber.assertComplete();
        subscriber.assertNoErrors();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 35

                      Completable cmp = Flowable.just("Hello World!").ignoreElements();
        cmp.<String>toFlowable().subscribe(subscriber);

        subscriber.assertNoValues();
        subscriber.assertComplete();
        subscriber.assertNoErrors();
    }

    @Test

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 36

                      cmp.<String>toFlowable().subscribe(subscriber);

        subscriber.assertNoValues();
        subscriber.assertComplete();
        subscriber.assertNoErrors();
    }

    @Test
    public void errorObservable() {

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 37

              
        subscriber.assertNoValues();
        subscriber.assertComplete();
        subscriber.assertNoErrors();
    }

    @Test
    public void errorObservable() {
        TestSubscriber<String> subscriber = TestSubscriber.create();

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 41

                  }

    @Test
    public void errorObservable() {
        TestSubscriber<String> subscriber = TestSubscriber.create();
        IllegalArgumentException error = new IllegalArgumentException("Error");
        Completable cmp = Flowable.<String>error(error).ignoreElements();
        cmp.<String>toFlowable().subscribe(subscriber);


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 44

                  public void errorObservable() {
        TestSubscriber<String> subscriber = TestSubscriber.create();
        IllegalArgumentException error = new IllegalArgumentException("Error");
        Completable cmp = Flowable.<String>error(error).ignoreElements();
        cmp.<String>toFlowable().subscribe(subscriber);

        subscriber.assertError(error);
        subscriber.assertNoValues();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 44

                  public void errorObservable() {
        TestSubscriber<String> subscriber = TestSubscriber.create();
        IllegalArgumentException error = new IllegalArgumentException("Error");
        Completable cmp = Flowable.<String>error(error).ignoreElements();
        cmp.<String>toFlowable().subscribe(subscriber);

        subscriber.assertError(error);
        subscriber.assertNoValues();
    }

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelMapTry.java
38 issues
Avoid reassigning parameters such as 'subscribers'
Design

Line: 51

                  }

    @Override
    public void subscribe(Subscriber<? super R>[] subscribers) {
        subscribers = RxJavaPlugins.onSubscribe(this, subscribers);

        if (!validate(subscribers)) {
            return;
        }

            

Reported by PMD.

Avoid using a branching statement as the last in a loop.
Error

Line: 167

                              }

                downstream.onNext(v);
                return true;
            }
        }

        @Override
        public void onError(Throwable t) {

            

Reported by PMD.

Avoid using a branching statement as the last in a loop.
Error

Line: 279

                                  }
                }

                return downstream.tryOnNext(v);
            }
        }

        @Override
        public void onError(Throwable t) {

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 37

               */
public final class ParallelMapTry<T, R> extends ParallelFlowable<R> {

    final ParallelFlowable<T> source;

    final Function<? super T, ? extends R> mapper;

    final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 39

              
    final ParallelFlowable<T> source;

    final Function<? super T, ? extends R> mapper;

    final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

    public ParallelMapTry(ParallelFlowable<T> source, Function<? super T, ? extends R> mapper,
            BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler) {

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 41

              
    final Function<? super T, ? extends R> mapper;

    final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

    public ParallelMapTry(ParallelFlowable<T> source, Function<? super T, ? extends R> mapper,
            BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler) {
        this.source = source;
        this.mapper = mapper;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 81

              
    static final class ParallelMapTrySubscriber<T, R> implements ConditionalSubscriber<T>, Subscription {

        final Subscriber<? super R> downstream;

        final Function<? super T, ? extends R> mapper;

        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 83

              
        final Subscriber<? super R> downstream;

        final Function<? super T, ? extends R> mapper;

        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

        Subscription upstream;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 85

              
        final Function<? super T, ? extends R> mapper;

        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

        Subscription upstream;

        boolean done;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 87

              
        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

        Subscription upstream;

        boolean done;

        ParallelMapTrySubscriber(Subscriber<? super R> actual, Function<? super T, ? extends R> mapper,
                BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler) {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotificationTest.java
38 issues
JUnit tests should include assert() or fail()
Design

Line: 31

              
public class FlowableMapNotificationTest extends RxJavaTest {
    @Test
    public void just() {
        TestSubscriber<Object> ts = new TestSubscriber<>();
        Flowable.just(1)
        .flatMap(
                new Function<Integer, Flowable<Object>>() {
                    @Override

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 61

                  }

    @Test
    public void backpressure() {
        TestSubscriber<Object> ts = TestSubscriber.create(0L);

        new FlowableMapNotification<>(Flowable.range(1, 3),
                new Function<Integer, Integer>() {
                    @Override

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 85

                              }
        ).subscribe(ts);

        ts.assertNoValues();
        ts.assertNoErrors();
        ts.assertNotComplete();

        ts.request(3);


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 86

                      ).subscribe(ts);

        ts.assertNoValues();
        ts.assertNoErrors();
        ts.assertNotComplete();

        ts.request(3);

        ts.assertValues(2, 3, 4);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 87

              
        ts.assertNoValues();
        ts.assertNoErrors();
        ts.assertNotComplete();

        ts.request(3);

        ts.assertValues(2, 3, 4);
        ts.assertNoErrors();

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 89

                      ts.assertNoErrors();
        ts.assertNotComplete();

        ts.request(3);

        ts.assertValues(2, 3, 4);
        ts.assertNoErrors();
        ts.assertNotComplete();


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 91

              
        ts.request(3);

        ts.assertValues(2, 3, 4);
        ts.assertNoErrors();
        ts.assertNotComplete();

        ts.request(1);


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 92

                      ts.request(3);

        ts.assertValues(2, 3, 4);
        ts.assertNoErrors();
        ts.assertNotComplete();

        ts.request(1);

        ts.assertValues(2, 3, 4, 5);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 93

              
        ts.assertValues(2, 3, 4);
        ts.assertNoErrors();
        ts.assertNotComplete();

        ts.request(1);

        ts.assertValues(2, 3, 4, 5);
        ts.assertNoErrors();

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 95

                      ts.assertNoErrors();
        ts.assertNotComplete();

        ts.request(1);

        ts.assertValues(2, 3, 4, 5);
        ts.assertNoErrors();
        ts.assertComplete();
    }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/observers/CompletableConsumersTest.java
38 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 50

              
public class CompletableConsumersTest implements Consumer<Object>, Action {

    final CompositeDisposable composite = new CompositeDisposable();

    final CompletableSubject processor = CompletableSubject.create();

    final List<Object> events = new ArrayList<>();


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 52

              
    final CompositeDisposable composite = new CompositeDisposable();

    final CompletableSubject processor = CompletableSubject.create();

    final List<Object> events = new ArrayList<>();

    @Override
    public void run() throws Exception {

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 54

              
    final CompletableSubject processor = CompletableSubject.create();

    final List<Object> events = new ArrayList<>();

    @Override
    public void run() throws Exception {
        events.add("OnComplete");
    }

            

Reported by PMD.

The String literal 'OnComplete' appears 4 times in this file; the first occurrence is on line 58
Error

Line: 58

              
    @Override
    public void run() throws Exception {
        events.add("OnComplete");
    }

    @Override
    public void accept(Object t) throws Exception {
        events.add(t);

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 67

                  }

    @Test
    public void onErrorNormal() {

        processor.subscribe(this, this, composite);

        assertTrue(composite.size() > 0);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 71

              
        processor.subscribe(this, this, composite);

        assertTrue(composite.size() > 0);

        assertTrue(events.toString(), events.isEmpty());

        processor.onComplete();


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 77

              
        processor.onComplete();

        assertEquals(0, composite.size());

        assertEquals(Arrays.<Object>asList("OnComplete"), events);

    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 79

              
        assertEquals(0, composite.size());

        assertEquals(Arrays.<Object>asList("OnComplete"), events);

    }

    @Test
    public void onErrorError() {

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 84

                  }

    @Test
    public void onErrorError() {

        Disposable d = processor.subscribe(this, this, composite);

        assertTrue(d.getClass().toString(), ((LambdaConsumerIntrospection)d).hasCustomOnError());


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 88

              
        Disposable d = processor.subscribe(this, this, composite);

        assertTrue(d.getClass().toString(), ((LambdaConsumerIntrospection)d).hasCustomOnError());

        assertTrue(composite.size() > 0);

        assertTrue(events.toString(), events.isEmpty());


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableBlockingStreamTest.java
38 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 32

              
    @Test
    public void empty() {
        try (Stream<Integer> stream = Observable.<Integer>empty().blockingStream()) {
            assertEquals(0, stream.toArray().length);
        }
    }

    @Test

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 32

              
    @Test
    public void empty() {
        try (Stream<Integer> stream = Observable.<Integer>empty().blockingStream()) {
            assertEquals(0, stream.toArray().length);
        }
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 33

                  @Test
    public void empty() {
        try (Stream<Integer> stream = Observable.<Integer>empty().blockingStream()) {
            assertEquals(0, stream.toArray().length);
        }
    }

    @Test
    public void just() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 33

                  @Test
    public void empty() {
        try (Stream<Integer> stream = Observable.<Integer>empty().blockingStream()) {
            assertEquals(0, stream.toArray().length);
        }
    }

    @Test
    public void just() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 39

              
    @Test
    public void just() {
        try (Stream<Integer> stream = Observable.just(1).blockingStream()) {
            assertArrayEquals(new Integer[] { 1 }, stream.toArray(Integer[]::new));
        }
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

                  @Test
    public void just() {
        try (Stream<Integer> stream = Observable.just(1).blockingStream()) {
            assertArrayEquals(new Integer[] { 1 }, stream.toArray(Integer[]::new));
        }
    }

    @Test
    public void range() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 46

              
    @Test
    public void range() {
        try (Stream<Integer> stream = Observable.range(1, 5).blockingStream()) {
            assertArrayEquals(new Integer[] { 1, 2, 3, 4, 5 }, stream.toArray(Integer[]::new));
        }
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 47

                  @Test
    public void range() {
        try (Stream<Integer> stream = Observable.range(1, 5).blockingStream()) {
            assertArrayEquals(new Integer[] { 1, 2, 3, 4, 5 }, stream.toArray(Integer[]::new));
        }
    }

    @Test
    public void rangeBackpressured() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 53

              
    @Test
    public void rangeBackpressured() {
        try (Stream<Integer> stream = Observable.range(1, 5).blockingStream(1)) {
            assertArrayEquals(new Integer[] { 1, 2, 3, 4, 5 }, stream.toArray(Integer[]::new));
        }
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 54

                  @Test
    public void rangeBackpressured() {
        try (Stream<Integer> stream = Observable.range(1, 5).blockingStream(1)) {
            assertArrayEquals(new Integer[] { 1, 2, 3, 4, 5 }, stream.toArray(Integer[]::new));
        }
    }

    @Test
    public void rangeAsyncBackpressured() {

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelDoOnNextTry.java
38 issues
Avoid reassigning parameters such as 'subscribers'
Design

Line: 50

                  }

    @Override
    public void subscribe(Subscriber<? super T>[] subscribers) {
        subscribers = RxJavaPlugins.onSubscribe(this, subscribers);

        if (!validate(subscribers)) {
            return;
        }

            

Reported by PMD.

Avoid using a branching statement as the last in a loop.
Error

Line: 164

                              }

                downstream.onNext(t);
                return true;
            }
        }

        @Override
        public void onError(Throwable t) {

            

Reported by PMD.

Avoid using a branching statement as the last in a loop.
Error

Line: 274

                                  }
                }

                return downstream.tryOnNext(t);
            }
        }

        @Override
        public void onError(Throwable t) {

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 36

               */
public final class ParallelDoOnNextTry<T> extends ParallelFlowable<T> {

    final ParallelFlowable<T> source;

    final Consumer<? super T> onNext;

    final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 38

              
    final ParallelFlowable<T> source;

    final Consumer<? super T> onNext;

    final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

    public ParallelDoOnNextTry(ParallelFlowable<T> source, Consumer<? super T> onNext,
            BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler) {

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 40

              
    final Consumer<? super T> onNext;

    final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

    public ParallelDoOnNextTry(ParallelFlowable<T> source, Consumer<? super T> onNext,
            BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler) {
        this.source = source;
        this.onNext = onNext;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 80

              
    static final class ParallelDoOnNextSubscriber<T> implements ConditionalSubscriber<T>, Subscription {

        final Subscriber<? super T> downstream;

        final Consumer<? super T> onNext;

        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;


            

Reported by PMD.

Field onNext has the same name as a method
Error

Line: 82

              
        final Subscriber<? super T> downstream;

        final Consumer<? super T> onNext;

        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

        Subscription upstream;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 82

              
        final Subscriber<? super T> downstream;

        final Consumer<? super T> onNext;

        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

        Subscription upstream;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 84

              
        final Consumer<? super T> onNext;

        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

        Subscription upstream;

        boolean done;


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnableTest.java
38 issues
Avoid throwing raw exception types.
Design

Line: 137

                                  try {
                        cdl2.await(5, TimeUnit.SECONDS);
                    } catch (InterruptedException ex) {
                        throw new RuntimeException(ex);
                    }
                }
            }).subscribeOn(Schedulers.single()).test();

            assertTrue(cdl1.await(5, TimeUnit.SECONDS));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 46

                          .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());
    }

    @Test
    public void fromRunnableTwice() {
        final AtomicInteger atomicInteger = new AtomicInteger();

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 50

                  }

    @Test
    public void fromRunnableTwice() {
        final AtomicInteger atomicInteger = new AtomicInteger();

        Runnable run = new Runnable() {
            @Override
            public void run() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 60

                          }
        };

        Maybe.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 60

                          }
        };

        Maybe.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 64

                          .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());

        Maybe.fromRunnable(run)
            .test()
            .assertResult();


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 66

              
        assertEquals(1, atomicInteger.get());

        Maybe.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 66

              
        assertEquals(1, atomicInteger.get());

        Maybe.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 70

                          .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

    @Test
    public void fromRunnableInvokesLazy() {
        final AtomicInteger atomicInteger = new AtomicInteger();

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 74

                  }

    @Test
    public void fromRunnableInvokesLazy() {
        final AtomicInteger atomicInteger = new AtomicInteger();

        final Maybe<Object> maybe = Maybe.fromRunnable(new Runnable() {
            @Override public void run() {
                atomicInteger.incrementAndGet();

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/util/OperatorMatrixGenerator.java
38 issues
The class 'OperatorMatrixGenerator' has a Modified Cyclomatic Complexity of 6 (Highest = 16).
Design

Line: 30

               * Should be run with the main project directory as working directory where the {@code docs}
 * folder is.
 */
public final class OperatorMatrixGenerator {

    private OperatorMatrixGenerator() {
        throw new IllegalStateException("No instances!");
    }


            

Reported by PMD.

The class 'OperatorMatrixGenerator' has a Standard Cyclomatic Complexity of 6 (Highest = 16).
Design

Line: 30

               * Should be run with the main project directory as working directory where the {@code docs}
 * folder is.
 */
public final class OperatorMatrixGenerator {

    private OperatorMatrixGenerator() {
        throw new IllegalStateException("No instances!");
    }


            

Reported by PMD.

When doing a String.toLowerCase()/toUpperCase() call, use a Locale
Error

Line: 45

                  };

    static String header(String type) {
        return "![" + type + "](https://raw.github.com/wiki/ReactiveX/RxJava/images/opmatrix-" + type.toLowerCase() + ".png)";
    }

    public static void main(String[] args) throws IOException {
        Set<String> operatorSet = new HashSet<>();
        Map<Class<?>, Set<String>> operatorMap = new HashMap<>();

            

Reported by PMD.

The method 'main(String)' has a cyclomatic complexity of 18.
Design

Line: 48

                      return "![" + type + "](https://raw.github.com/wiki/ReactiveX/RxJava/images/opmatrix-" + type.toLowerCase() + ".png)";
    }

    public static void main(String[] args) throws IOException {
        Set<String> operatorSet = new HashSet<>();
        Map<Class<?>, Set<String>> operatorMap = new HashMap<>();

        for (Class<?> clazz : CLASSES) {
            Set<String> set = operatorMap.computeIfAbsent(clazz, c -> new HashSet<>());

            

Reported by PMD.

The method 'main(String)' has an NPath complexity of 2598, current threshold is 200
Design

Line: 48

                      return "![" + type + "](https://raw.github.com/wiki/ReactiveX/RxJava/images/opmatrix-" + type.toLowerCase() + ".png)";
    }

    public static void main(String[] args) throws IOException {
        Set<String> operatorSet = new HashSet<>();
        Map<Class<?>, Set<String>> operatorMap = new HashMap<>();

        for (Class<?> clazz : CLASSES) {
            Set<String> set = operatorMap.computeIfAbsent(clazz, c -> new HashSet<>());

            

Reported by PMD.

Avoid really long methods.
Design

Line: 48

                      return "![" + type + "](https://raw.github.com/wiki/ReactiveX/RxJava/images/opmatrix-" + type.toLowerCase() + ".png)";
    }

    public static void main(String[] args) throws IOException {
        Set<String> operatorSet = new HashSet<>();
        Map<Class<?>, Set<String>> operatorMap = new HashMap<>();

        for (Class<?> clazz : CLASSES) {
            Set<String> set = operatorMap.computeIfAbsent(clazz, c -> new HashSet<>());

            

Reported by PMD.

The method 'main' has a Modified Cyclomatic Complexity of 16.
Design

Line: 48

                      return "![" + type + "](https://raw.github.com/wiki/ReactiveX/RxJava/images/opmatrix-" + type.toLowerCase() + ".png)";
    }

    public static void main(String[] args) throws IOException {
        Set<String> operatorSet = new HashSet<>();
        Map<Class<?>, Set<String>> operatorMap = new HashMap<>();

        for (Class<?> clazz : CLASSES) {
            Set<String> set = operatorMap.computeIfAbsent(clazz, c -> new HashSet<>());

            

Reported by PMD.

The method 'main' has a Standard Cyclomatic Complexity of 16.
Design

Line: 48

                      return "![" + type + "](https://raw.github.com/wiki/ReactiveX/RxJava/images/opmatrix-" + type.toLowerCase() + ".png)";
    }

    public static void main(String[] args) throws IOException {
        Set<String> operatorSet = new HashSet<>();
        Map<Class<?>, Set<String>> operatorMap = new HashMap<>();

        for (Class<?> clazz : CLASSES) {
            Set<String> set = operatorMap.computeIfAbsent(clazz, c -> new HashSet<>());

            

Reported by PMD.

The method 'main(String)' has a NCSS line count of 96.
Design

Line: 48

                      return "![" + type + "](https://raw.github.com/wiki/ReactiveX/RxJava/images/opmatrix-" + type.toLowerCase() + ".png)";
    }

    public static void main(String[] args) throws IOException {
        Set<String> operatorSet = new HashSet<>();
        Map<Class<?>, Set<String>> operatorMap = new HashMap<>();

        for (Class<?> clazz : CLASSES) {
            Set<String> set = operatorMap.computeIfAbsent(clazz, c -> new HashSet<>());

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 53

                      Map<Class<?>, Set<String>> operatorMap = new HashMap<>();

        for (Class<?> clazz : CLASSES) {
            Set<String> set = operatorMap.computeIfAbsent(clazz, c -> new HashSet<>());

            for (Method m : clazz.getMethods()) {
                String name = m.getName();
                if (!name.equals("bufferSize")
                        && m.getDeclaringClass() == clazz

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOtherTest.java
38 issues
This class has too many methods, consider refactoring it.
Design

Line: 30

              import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class FlowableDelaySubscriptionOtherTest extends RxJavaTest {
    @Test
    public void noPrematureSubscription() {
        PublishProcessor<Object> other = PublishProcessor.create();

        TestSubscriber<Integer> ts = new TestSubscriber<>();

            

Reported by PMD.

The String literal 'Premature subscription' appears 7 times in this file; the first occurrence is on line 53
Error

Line: 53

                      ts.assertNoErrors();
        ts.assertNoValues();

        Assert.assertEquals("Premature subscription", 0, subscribed.get());

        other.onNext(1);

        Assert.assertEquals("No subscription", 1, subscribed.get());


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 55

              
        Assert.assertEquals("Premature subscription", 0, subscribed.get());

        other.onNext(1);

        Assert.assertEquals("No subscription", 1, subscribed.get());

        ts.assertValue(1);
        ts.assertNoErrors();

            

Reported by PMD.

The String literal 'No subscription' appears 5 times in this file; the first occurrence is on line 57
Error

Line: 57

              
        other.onNext(1);

        Assert.assertEquals("No subscription", 1, subscribed.get());

        ts.assertValue(1);
        ts.assertNoErrors();
        ts.assertComplete();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 88

              
        Assert.assertEquals("Premature subscription", 0, subscribed.get());

        other.onNext(1);
        other.onNext(2);

        Assert.assertEquals("No subscription", 1, subscribed.get());

        ts.assertValue(1);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 89

                      Assert.assertEquals("Premature subscription", 0, subscribed.get());

        other.onNext(1);
        other.onNext(2);

        Assert.assertEquals("No subscription", 1, subscribed.get());

        ts.assertValue(1);
        ts.assertNoErrors();

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 122

              
        Assert.assertEquals("Premature subscription", 0, subscribed.get());

        other.onComplete();

        Assert.assertEquals("No subscription", 1, subscribed.get());

        ts.assertValue(1);
        ts.assertNoErrors();

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 155

              
        Assert.assertEquals("Premature subscription", 0, subscribed.get());

        other.onComplete();

        Assert.assertEquals("No subscription", 1, subscribed.get());

        ts.assertNoValues();
        ts.assertNotComplete();

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 222

              
        Assert.assertEquals("Premature subscription", 0, subscribed.get());

        other.onNext(1);

        Assert.assertEquals("No subscription", 1, subscribed.get());

        Assert.assertFalse("Not unsubscribed from other", other.hasSubscribers());


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 226

              
        Assert.assertEquals("No subscription", 1, subscribed.get());

        Assert.assertFalse("Not unsubscribed from other", other.hasSubscribers());

        ts.assertNotComplete();
        ts.assertNoErrors();
        ts.assertNoValues();


            

Reported by PMD.