The following issues were found

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLongTest.java
45 issues
This class has too many methods, consider refactoring it.
Design

Line: 31

              import io.reactivex.rxjava3.observers.*;
import io.reactivex.rxjava3.testsupport.*;

public class ObservableRangeLongTest extends RxJavaTest {
    @Test
    public void rangeStartAt2Count3() {
        Observer<Long> observer = TestHelper.mockObserver();

        Observable.rangeLong(2, 3).subscribe(observer);

            

Reported by PMD.

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

Line: 36

                  public void rangeStartAt2Count3() {
        Observer<Long> observer = TestHelper.mockObserver();

        Observable.rangeLong(2, 3).subscribe(observer);

        verify(observer, times(1)).onNext(2L);
        verify(observer, times(1)).onNext(3L);
        verify(observer, times(1)).onNext(4L);
        verify(observer, never()).onNext(5L);

            

Reported by PMD.

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

Line: 38

              
        Observable.rangeLong(2, 3).subscribe(observer);

        verify(observer, times(1)).onNext(2L);
        verify(observer, times(1)).onNext(3L);
        verify(observer, times(1)).onNext(4L);
        verify(observer, never()).onNext(5L);
        verify(observer, never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();

            

Reported by PMD.

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

Line: 39

                      Observable.rangeLong(2, 3).subscribe(observer);

        verify(observer, times(1)).onNext(2L);
        verify(observer, times(1)).onNext(3L);
        verify(observer, times(1)).onNext(4L);
        verify(observer, never()).onNext(5L);
        verify(observer, never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();
    }

            

Reported by PMD.

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

Line: 40

              
        verify(observer, times(1)).onNext(2L);
        verify(observer, times(1)).onNext(3L);
        verify(observer, times(1)).onNext(4L);
        verify(observer, never()).onNext(5L);
        verify(observer, never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();
    }


            

Reported by PMD.

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

Line: 41

                      verify(observer, times(1)).onNext(2L);
        verify(observer, times(1)).onNext(3L);
        verify(observer, times(1)).onNext(4L);
        verify(observer, never()).onNext(5L);
        verify(observer, never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();
    }

    @Test

            

Reported by PMD.

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

Line: 42

                      verify(observer, times(1)).onNext(3L);
        verify(observer, times(1)).onNext(4L);
        verify(observer, never()).onNext(5L);
        verify(observer, never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();
    }

    @Test
    public void rangeUnsubscribe() {

            

Reported by PMD.

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

Line: 43

                      verify(observer, times(1)).onNext(4L);
        verify(observer, never()).onNext(5L);
        verify(observer, never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();
    }

    @Test
    public void rangeUnsubscribe() {
        Observer<Long> observer = TestHelper.mockObserver();

            

Reported by PMD.

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

Line: 60

                      })
        .take(3).subscribe(observer);

        verify(observer, times(1)).onNext(1L);
        verify(observer, times(1)).onNext(2L);
        verify(observer, times(1)).onNext(3L);
        verify(observer, never()).onNext(4L);
        verify(observer, never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();

            

Reported by PMD.

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

Line: 61

                      .take(3).subscribe(observer);

        verify(observer, times(1)).onNext(1L);
        verify(observer, times(1)).onNext(2L);
        verify(observer, times(1)).onNext(3L);
        verify(observer, never()).onNext(4L);
        verify(observer, never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();
        assertEquals(3, count.get());

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimerTest.java
45 issues
This class has too many methods, consider refactoring it.
Design

Line: 38

              import io.reactivex.rxjava3.schedulers.*;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class ObservableTimerTest extends RxJavaTest {
    @Mock
    Observer<Object> observer;
    @Mock
    Observer<Long> observer2;


            

Reported by PMD.

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

Line: 40

              
public class ObservableTimerTest extends RxJavaTest {
    @Mock
    Observer<Object> observer;
    @Mock
    Observer<Long> observer2;

    TestScheduler scheduler;


            

Reported by PMD.

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

Line: 42

                  @Mock
    Observer<Object> observer;
    @Mock
    Observer<Long> observer2;

    TestScheduler scheduler;

    @Before
    public void before() {

            

Reported by PMD.

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

Line: 44

                  @Mock
    Observer<Long> observer2;

    TestScheduler scheduler;

    @Before
    public void before() {
        observer = TestHelper.mockObserver();


            

Reported by PMD.

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

Line: 57

              
    @Test
    public void timerOnce() {
        Observable.timer(100, TimeUnit.MILLISECONDS, scheduler).subscribe(observer);
        scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);

        verify(observer, times(1)).onNext(0L);
        verify(observer, times(1)).onComplete();
        verify(observer, never()).onError(any(Throwable.class));

            

Reported by PMD.

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

Line: 60

                      Observable.timer(100, TimeUnit.MILLISECONDS, scheduler).subscribe(observer);
        scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);

        verify(observer, times(1)).onNext(0L);
        verify(observer, times(1)).onComplete();
        verify(observer, never()).onError(any(Throwable.class));
    }

    @Test

            

Reported by PMD.

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

Line: 61

                      scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);

        verify(observer, times(1)).onNext(0L);
        verify(observer, times(1)).onComplete();
        verify(observer, never()).onError(any(Throwable.class));
    }

    @Test
    public void timerPeriodically() {

            

Reported by PMD.

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

Line: 62

              
        verify(observer, times(1)).onNext(0L);
        verify(observer, times(1)).onComplete();
        verify(observer, never()).onError(any(Throwable.class));
    }

    @Test
    public void timerPeriodically() {
        TestObserver<Long> to = new TestObserver<>();

            

Reported by PMD.

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

Line: 69

                  public void timerPeriodically() {
        TestObserver<Long> to = new TestObserver<>();

        Observable.interval(100, 100, TimeUnit.MILLISECONDS, scheduler).subscribe(to);

        scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);

        to.assertValue(0L);


            

Reported by PMD.

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

Line: 96

                  public void interval() {
        Observable<Long> w = Observable.interval(1, TimeUnit.SECONDS, scheduler);
        TestObserver<Long> to = new TestObserver<>();
        w.subscribe(to);

        to.assertNoValues();
        to.assertNoErrors();
        to.assertNotComplete();


            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZip.java
45 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 29

              
public final class ObservableZip<T, R> extends Observable<R> {

    final ObservableSource<? extends T>[] sources;
    final Iterable<? extends ObservableSource<? extends T>> sourcesIterable;
    final Function<? super Object[], ? extends R> zipper;
    final int bufferSize;
    final boolean delayError;


            

Reported by PMD.

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

Line: 30

              public final class ObservableZip<T, R> extends Observable<R> {

    final ObservableSource<? extends T>[] sources;
    final Iterable<? extends ObservableSource<? extends T>> sourcesIterable;
    final Function<? super Object[], ? extends R> zipper;
    final int bufferSize;
    final boolean delayError;

    public ObservableZip(ObservableSource<? extends T>[] sources,

            

Reported by PMD.

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

Line: 31

              
    final ObservableSource<? extends T>[] sources;
    final Iterable<? extends ObservableSource<? extends T>> sourcesIterable;
    final Function<? super Object[], ? extends R> zipper;
    final int bufferSize;
    final boolean delayError;

    public ObservableZip(ObservableSource<? extends T>[] sources,
            Iterable<? extends ObservableSource<? extends T>> sourcesIterable,

            

Reported by PMD.

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

Line: 32

                  final ObservableSource<? extends T>[] sources;
    final Iterable<? extends ObservableSource<? extends T>> sourcesIterable;
    final Function<? super Object[], ? extends R> zipper;
    final int bufferSize;
    final boolean delayError;

    public ObservableZip(ObservableSource<? extends T>[] sources,
            Iterable<? extends ObservableSource<? extends T>> sourcesIterable,
            Function<? super Object[], ? extends R> zipper,

            

Reported by PMD.

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

Line: 33

                  final Iterable<? extends ObservableSource<? extends T>> sourcesIterable;
    final Function<? super Object[], ? extends R> zipper;
    final int bufferSize;
    final boolean delayError;

    public ObservableZip(ObservableSource<? extends T>[] sources,
            Iterable<? extends ObservableSource<? extends T>> sourcesIterable,
            Function<? super Object[], ? extends R> zipper,
            int bufferSize,

            

Reported by PMD.

The user-supplied array 'sources' is stored directly.
Design

Line: 35

                  final int bufferSize;
    final boolean delayError;

    public ObservableZip(ObservableSource<? extends T>[] sources,
            Iterable<? extends ObservableSource<? extends T>> sourcesIterable,
            Function<? super Object[], ? extends R> zipper,
            int bufferSize,
            boolean delayError) {
        this.sources = sources;

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 56

                          sources = new ObservableSource[8];
            for (ObservableSource<? extends T> p : sourcesIterable) {
                if (count == sources.length) {
                    ObservableSource<? extends T>[] b = new ObservableSource[count + (count >> 2)];
                    System.arraycopy(sources, 0, b, 0, count);
                    sources = b;
                }
                sources[count++] = p;
            }

            

Reported by PMD.

The class 'ZipCoordinator' has a Standard Cyclomatic Complexity of 4 (Highest = 13).
Design

Line: 75

                      zc.subscribe(sources, bufferSize);
    }

    static final class ZipCoordinator<T, R> extends AtomicInteger implements Disposable {

        private static final long serialVersionUID = 2983708048395377667L;
        final Observer<? super R> downstream;
        final Function<? super Object[], ? extends R> zipper;
        final ZipObserver<T, R>[] observers;

            

Reported by PMD.

The class 'ZipCoordinator' has a Modified Cyclomatic Complexity of 4 (Highest = 13).
Design

Line: 75

                      zc.subscribe(sources, bufferSize);
    }

    static final class ZipCoordinator<T, R> extends AtomicInteger implements Disposable {

        private static final long serialVersionUID = 2983708048395377667L;
        final Observer<? super R> downstream;
        final Function<? super Object[], ? extends R> zipper;
        final ZipObserver<T, R>[] observers;

            

Reported by PMD.

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

Line: 78

                  static final class ZipCoordinator<T, R> extends AtomicInteger implements Disposable {

        private static final long serialVersionUID = 2983708048395377667L;
        final Observer<? super R> downstream;
        final Function<? super Object[], ? extends R> zipper;
        final ZipObserver<T, R>[] observers;
        final T[] row;
        final boolean delayError;


            

Reported by PMD.

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

Line: 23

              import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;

public class FlowableStartWithTest {

    @Test
    public void justCompletableComplete() {
        Flowable.just(1).startWith(Completable.complete())
        .test()

            

Reported by PMD.

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

Line: 26

              public class FlowableStartWithTest {

    @Test
    public void justCompletableComplete() {
        Flowable.just(1).startWith(Completable.complete())
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 27

              
    @Test
    public void justCompletableComplete() {
        Flowable.just(1).startWith(Completable.complete())
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 27

              
    @Test
    public void justCompletableComplete() {
        Flowable.just(1).startWith(Completable.complete())
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 27

              
    @Test
    public void justCompletableComplete() {
        Flowable.just(1).startWith(Completable.complete())
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 33

                  }

    @Test
    public void emptyCompletableComplete() {
        Flowable.empty().startWith(Completable.complete())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 34

              
    @Test
    public void emptyCompletableComplete() {
        Flowable.empty().startWith(Completable.complete())
        .test()
        .assertResult();
    }

    @Test

            

Reported by PMD.

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

Line: 34

              
    @Test
    public void emptyCompletableComplete() {
        Flowable.empty().startWith(Completable.complete())
        .test()
        .assertResult();
    }

    @Test

            

Reported by PMD.

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

Line: 34

              
    @Test
    public void emptyCompletableComplete() {
        Flowable.empty().startWith(Completable.complete())
        .test()
        .assertResult();
    }

    @Test

            

Reported by PMD.

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

Line: 47

                      .test()
        .assertFailure(TestException.class);

        verify(run, never()).run();
    }

    @Test
    public void justSingleJust() {
        Flowable.just(1).startWith(Single.just(2))

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableStartWithTest.java
44 issues
This class has too many methods, consider refactoring it.
Design

Line: 23

              import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;

public class ObservableStartWithTest {

    @Test
    public void justCompletableComplete() {
        Observable.just(1).startWith(Completable.complete())
        .test()

            

Reported by PMD.

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

Line: 26

              public class ObservableStartWithTest {

    @Test
    public void justCompletableComplete() {
        Observable.just(1).startWith(Completable.complete())
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 27

              
    @Test
    public void justCompletableComplete() {
        Observable.just(1).startWith(Completable.complete())
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 27

              
    @Test
    public void justCompletableComplete() {
        Observable.just(1).startWith(Completable.complete())
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 27

              
    @Test
    public void justCompletableComplete() {
        Observable.just(1).startWith(Completable.complete())
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 33

                  }

    @Test
    public void emptyCompletableComplete() {
        Observable.empty().startWith(Completable.complete())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 34

              
    @Test
    public void emptyCompletableComplete() {
        Observable.empty().startWith(Completable.complete())
        .test()
        .assertResult();
    }

    @Test

            

Reported by PMD.

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

Line: 34

              
    @Test
    public void emptyCompletableComplete() {
        Observable.empty().startWith(Completable.complete())
        .test()
        .assertResult();
    }

    @Test

            

Reported by PMD.

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

Line: 34

              
    @Test
    public void emptyCompletableComplete() {
        Observable.empty().startWith(Completable.complete())
        .test()
        .assertResult();
    }

    @Test

            

Reported by PMD.

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

Line: 47

                      .test()
        .assertFailure(TestException.class);

        verify(run, never()).run();
    }

    @Test
    public void justSingleJust() {
        Observable.just(1).startWith(Single.just(2))

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromSupplierTest.java
44 issues
This class has too many methods, consider refactoring it.
Design

Line: 36

              import io.reactivex.rxjava3.schedulers.Schedulers;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class SingleFromSupplierTest extends RxJavaTest {

    @Test
    public void fromSupplierValue() {
        Single.fromSupplier(new Supplier<Integer>() {
            @Override public Integer get() throws Exception {

            

Reported by PMD.

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

Line: 39

              public class SingleFromSupplierTest extends RxJavaTest {

    @Test
    public void fromSupplierValue() {
        Single.fromSupplier(new Supplier<Integer>() {
            @Override public Integer get() throws Exception {
                return 5;
            }
        })

            

Reported by PMD.

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

Line: 50

                  }

    @Test
    public void fromSupplierError() {
        Single.fromSupplier(new Supplier<Integer>() {
            @Override public Integer get() throws Exception {
                throw new UnsupportedOperationException();
            }
        })

            

Reported by PMD.

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

Line: 61

                  }

    @Test
    public void fromSupplierNull() {
        Single.fromSupplier(new Supplier<Integer>() {
            @Override public Integer get() throws Exception {
                return null;
            }
        })

            

Reported by PMD.

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

Line: 72

                  }

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

        Supplier<Integer> supplier = new Supplier<Integer>() {
            @Override
            public Integer get() throws Exception {

            

Reported by PMD.

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

Line: 82

                          }
        };

        Single.fromSupplier(supplier)
                .test()
                .assertResult(1);

        assertEquals(1, atomicInteger.get());


            

Reported by PMD.

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

Line: 82

                          }
        };

        Single.fromSupplier(supplier)
                .test()
                .assertResult(1);

        assertEquals(1, atomicInteger.get());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 86

                              .test()
                .assertResult(1);

        assertEquals(1, atomicInteger.get());

        Single.fromSupplier(supplier)
                .test()
                .assertResult(2);


            

Reported by PMD.

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

Line: 88

              
        assertEquals(1, atomicInteger.get());

        Single.fromSupplier(supplier)
                .test()
                .assertResult(2);

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

            

Reported by PMD.

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

Line: 88

              
        assertEquals(1, atomicInteger.get());

        Single.fromSupplier(supplier)
                .test()
                .assertResult(2);

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

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiter.java
44 issues
The class 'SubscriptionArbiter' has a Standard Cyclomatic Complexity of 5 (Highest = 17).
Design

Line: 26

              /**
 * Arbitrates requests and cancellation between Subscriptions.
 */
public class SubscriptionArbiter extends AtomicInteger implements Subscription {

    private static final long serialVersionUID = -2189523197179400958L;

    /**
     * The current subscription which may null if no Subscriptions have been set.

            

Reported by PMD.

The class 'SubscriptionArbiter' has a Modified Cyclomatic Complexity of 5 (Highest = 17).
Design

Line: 26

              /**
 * Arbitrates requests and cancellation between Subscriptions.
 */
public class SubscriptionArbiter extends AtomicInteger implements Subscription {

    private static final long serialVersionUID = -2189523197179400958L;

    /**
     * The current subscription which may null if no Subscriptions have been set.

            

Reported by PMD.

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

Line: 33

                  /**
     * The current subscription which may null if no Subscriptions have been set.
     */
    Subscription actual;

    /**
     * The current outstanding request amount.
     */
    long requested;

            

Reported by PMD.

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

Line: 38

                  /**
     * The current outstanding request amount.
     */
    long requested;

    final AtomicReference<Subscription> missedSubscription;

    final AtomicLong missedRequested;


            

Reported by PMD.

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

Line: 40

                   */
    long requested;

    final AtomicReference<Subscription> missedSubscription;

    final AtomicLong missedRequested;

    final AtomicLong missedProduced;


            

Reported by PMD.

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

Line: 42

              
    final AtomicReference<Subscription> missedSubscription;

    final AtomicLong missedRequested;

    final AtomicLong missedProduced;

    final boolean cancelOnReplace;


            

Reported by PMD.

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

Line: 44

              
    final AtomicLong missedRequested;

    final AtomicLong missedProduced;

    final boolean cancelOnReplace;

    volatile boolean cancelled;


            

Reported by PMD.

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

Line: 46

              
    final AtomicLong missedProduced;

    final boolean cancelOnReplace;

    volatile boolean cancelled;

    protected boolean unbounded;


            

Reported by PMD.

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

Line: 48

              
    final boolean cancelOnReplace;

    volatile boolean cancelled;

    protected boolean unbounded;

    public SubscriptionArbiter(boolean cancelOnReplace) {
        this.cancelOnReplace = cancelOnReplace;

            

Reported by PMD.

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

Line: 50

              
    volatile boolean cancelled;

    protected boolean unbounded;

    public SubscriptionArbiter(boolean cancelOnReplace) {
        this.cancelOnReplace = cancelOnReplace;
        missedSubscription = new AtomicReference<>();
        missedRequested = new AtomicLong();

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplierTest.java
44 issues
The String literal 'unchecked' appears 4 times in this file; the first occurrence is on line 38
Error

Line: 38

              
public class FlowableFromSupplierTest extends RxJavaTest {

    @SuppressWarnings("unchecked")
    @Test
    public void shouldNotInvokeFuncUntilSubscription() throws Throwable {
        Supplier<Object> func = mock(Supplier.class);

        when(func.get()).thenReturn(new Object());

            

Reported by PMD.

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

Line: 43

                  public void shouldNotInvokeFuncUntilSubscription() throws Throwable {
        Supplier<Object> func = mock(Supplier.class);

        when(func.get()).thenReturn(new Object());

        Flowable<Object> fromSupplierFlowable = Flowable.fromSupplier(func);

        verifyNoInteractions(func);


            

Reported by PMD.

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

Line: 49

              
        verifyNoInteractions(func);

        fromSupplierFlowable.subscribe();

        verify(func).get();
    }

    @SuppressWarnings("unchecked")

            

Reported by PMD.

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

Line: 51

              
        fromSupplierFlowable.subscribe();

        verify(func).get();
    }

    @SuppressWarnings("unchecked")
    @Test
    public void shouldCallOnNextAndOnCompleted() throws Throwable {

            

Reported by PMD.

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

Line: 59

                  public void shouldCallOnNextAndOnCompleted() throws Throwable {
        Supplier<String> func = mock(Supplier.class);

        when(func.get()).thenReturn("test_value");

        Flowable<String> fromSupplierFlowable = Flowable.fromSupplier(func);

        Subscriber<String> subscriber = TestHelper.mockSubscriber();


            

Reported by PMD.

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

Line: 59

                  public void shouldCallOnNextAndOnCompleted() throws Throwable {
        Supplier<String> func = mock(Supplier.class);

        when(func.get()).thenReturn("test_value");

        Flowable<String> fromSupplierFlowable = Flowable.fromSupplier(func);

        Subscriber<String> subscriber = TestHelper.mockSubscriber();


            

Reported by PMD.

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

Line: 65

              
        Subscriber<String> subscriber = TestHelper.mockSubscriber();

        fromSupplierFlowable.subscribe(subscriber);

        verify(subscriber).onNext("test_value");
        verify(subscriber).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }

            

Reported by PMD.

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

Line: 67

              
        fromSupplierFlowable.subscribe(subscriber);

        verify(subscriber).onNext("test_value");
        verify(subscriber).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }

    @SuppressWarnings("unchecked")

            

Reported by PMD.

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

Line: 68

                      fromSupplierFlowable.subscribe(subscriber);

        verify(subscriber).onNext("test_value");
        verify(subscriber).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }

    @SuppressWarnings("unchecked")
    @Test

            

Reported by PMD.

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

Line: 69

              
        verify(subscriber).onNext("test_value");
        verify(subscriber).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }

    @SuppressWarnings("unchecked")
    @Test
    public void shouldCallOnError() throws Throwable {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayListTest.java
44 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 27

              public class VolatileSizeArrayListTest extends RxJavaTest {

    @Test
    public void normal() {
        List<Integer> list = new VolatileSizeArrayList<>();

        assertTrue(list.isEmpty());
        assertEquals(0, list.size());
        assertFalse(list.contains(1));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 30

                  public void normal() {
        List<Integer> list = new VolatileSizeArrayList<>();

        assertTrue(list.isEmpty());
        assertEquals(0, list.size());
        assertFalse(list.contains(1));
        assertFalse(list.remove((Integer)1));

        list = new VolatileSizeArrayList<>(16);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 31

                      List<Integer> list = new VolatileSizeArrayList<>();

        assertTrue(list.isEmpty());
        assertEquals(0, list.size());
        assertFalse(list.contains(1));
        assertFalse(list.remove((Integer)1));

        list = new VolatileSizeArrayList<>(16);
        assertTrue(list.add(1));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 32

              
        assertTrue(list.isEmpty());
        assertEquals(0, list.size());
        assertFalse(list.contains(1));
        assertFalse(list.remove((Integer)1));

        list = new VolatileSizeArrayList<>(16);
        assertTrue(list.add(1));
        assertTrue(list.addAll(Arrays.asList(3, 4, 7)));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 33

                      assertTrue(list.isEmpty());
        assertEquals(0, list.size());
        assertFalse(list.contains(1));
        assertFalse(list.remove((Integer)1));

        list = new VolatileSizeArrayList<>(16);
        assertTrue(list.add(1));
        assertTrue(list.addAll(Arrays.asList(3, 4, 7)));
        list.add(1, 2);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 36

                      assertFalse(list.remove((Integer)1));

        list = new VolatileSizeArrayList<>(16);
        assertTrue(list.add(1));
        assertTrue(list.addAll(Arrays.asList(3, 4, 7)));
        list.add(1, 2);
        assertTrue(list.addAll(4, Arrays.asList(5, 6)));

        assertTrue(list.contains(2));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

              
        list = new VolatileSizeArrayList<>(16);
        assertTrue(list.add(1));
        assertTrue(list.addAll(Arrays.asList(3, 4, 7)));
        list.add(1, 2);
        assertTrue(list.addAll(4, Arrays.asList(5, 6)));

        assertTrue(list.contains(2));
        assertFalse(list.remove((Integer)10));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

                      assertTrue(list.add(1));
        assertTrue(list.addAll(Arrays.asList(3, 4, 7)));
        list.add(1, 2);
        assertTrue(list.addAll(4, Arrays.asList(5, 6)));

        assertTrue(list.contains(2));
        assertFalse(list.remove((Integer)10));

        assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7), list);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 41

                      list.add(1, 2);
        assertTrue(list.addAll(4, Arrays.asList(5, 6)));

        assertTrue(list.contains(2));
        assertFalse(list.remove((Integer)10));

        assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7), list);
        assertFalse(list.isEmpty());
        assertEquals(7, list.size());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 42

                      assertTrue(list.addAll(4, Arrays.asList(5, 6)));

        assertTrue(list.contains(2));
        assertFalse(list.remove((Integer)10));

        assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7), list);
        assertFalse(list.isEmpty());
        assertEquals(7, list.size());


            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/functions/Functions.java
44 issues
This class has a bunch of public methods and attributes
Design

Line: 14

               * the License for the specific language governing permissions and limitations under the License.
 */

package io.reactivex.rxjava3.internal.functions;

import java.util.*;
import java.util.concurrent.*;

import org.reactivestreams.Subscription;

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 31

              /**
 * Utility methods to convert the BiFunction, Function3..Function9 instances to Function of Object array.
 */
public final class Functions {

    /** Utility class. */
    private Functions() {
        throw new IllegalStateException("No instances!");
    }

            

Reported by PMD.

Field IDENTITY has the same name as a method
Error

Line: 83

                  }

    /** A singleton identity function. */
    static final Function<Object, Object> IDENTITY = new Identity();

    /**
     * Returns an identity function that simply returns its argument.
     * @param <T> the input and output value type
     * @return the identity function

            

Reported by PMD.

The String literal 'unchecked' appears 18 times in this file; the first occurrence is on line 90
Error

Line: 90

                   * @param <T> the input and output value type
     * @return the identity function
     */
    @SuppressWarnings("unchecked")
    @NonNull
    public static <T> Function<T, T> identity() {
        return (Function<T, T>)IDENTITY;
    }


            

Reported by PMD.

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

Line: 147

                  }

    static final class FutureAction implements Action {
        final Future<?> future;

        FutureAction(Future<?> future) {
            this.future = future;
        }


            

Reported by PMD.

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

Line: 170

                  }

    static final class JustValue<T, U> implements Callable<U>, Supplier<U>, Function<T, U> {
        final U value;

        JustValue(U value) {
            this.value = value;
        }


            

Reported by PMD.

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

Line: 227

                  }

    static final class CastToClass<T, U> implements Function<T, U> {
        final Class<U> clazz;

        CastToClass(Class<U> clazz) {
            this.clazz = clazz;
        }


            

Reported by PMD.

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

Line: 252

                  }

    static final class ArrayListCapacityCallable<T> implements Supplier<List<T>> {
        final int capacity;

        ArrayListCapacityCallable(int capacity) {
            this.capacity = capacity;
        }


            

Reported by PMD.

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

Line: 269

                  }

    static final class EqualsPredicate<T> implements Predicate<T> {
        final T value;

        EqualsPredicate(T value) {
            this.value = value;
        }


            

Reported by PMD.

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

Line: 299

                  }

    static final class NotificationOnNext<T> implements Consumer<T> {
        final Consumer<? super Notification<T>> onNotification;

        NotificationOnNext(Consumer<? super Notification<T>> onNotification) {
            this.onNotification = onNotification;
        }


            

Reported by PMD.