The following issues were found

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableForEachTest.java
23 issues
JUnit assertions should include a message
Design

Line: 52

                          }
        });

        assertEquals(Arrays.asList(1, 2, 3), list);
    }

    @Test
    public void forEachWileWithError() {
        final List<Object> list = new ArrayList<>();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 78

                          }
        });

        assertEquals(Arrays.asList(1, 2, 3, 4, 5, 100), list);
    }

    @Test
    public void badSource() {
        TestHelper.checkBadSourceObservable(new Function<Observable<Integer>, Object>() {

            

Reported by PMD.

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

Line: 82

                  }

    @Test
    public void badSource() {
        TestHelper.checkBadSourceObservable(new Function<Observable<Integer>, Object>() {
            @Override
            public Object apply(Observable<Integer> f) throws Exception {
                return f.forEachWhile(Functions.alwaysTrue());
            }

            

Reported by PMD.

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

Line: 92

                  }

    @Test
    public void dispose() {
        PublishSubject<Integer> ps = PublishSubject.create();

        Disposable d = ps.forEachWhile(Functions.alwaysTrue());

        assertFalse(d.isDisposed());

            

Reported by PMD.

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

Line: 95

                  public void dispose() {
        PublishSubject<Integer> ps = PublishSubject.create();

        Disposable d = ps.forEachWhile(Functions.alwaysTrue());

        assertFalse(d.isDisposed());

        d.dispose();


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 97

              
        Disposable d = ps.forEachWhile(Functions.alwaysTrue());

        assertFalse(d.isDisposed());

        d.dispose();

        assertTrue(d.isDisposed());
    }

            

Reported by PMD.

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

Line: 97

              
        Disposable d = ps.forEachWhile(Functions.alwaysTrue());

        assertFalse(d.isDisposed());

        d.dispose();

        assertTrue(d.isDisposed());
    }

            

Reported by PMD.

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

Line: 99

              
        assertFalse(d.isDisposed());

        d.dispose();

        assertTrue(d.isDisposed());
    }

    @Test

            

Reported by PMD.

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

Line: 101

              
        d.dispose();

        assertTrue(d.isDisposed());
    }

    @Test
    public void whilePredicateThrows() {
        List<Throwable> errors = TestHelper.trackPluginErrors();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 101

              
        d.dispose();

        assertTrue(d.isDisposed());
    }

    @Test
    public void whilePredicateThrows() {
        List<Throwable> errors = TestHelper.trackPluginErrors();

            

Reported by PMD.

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

Line: 32

               *
 */
public class ObservableZipCompletionTest extends RxJavaTest {
    BiFunction<String, String, String> concat2Strings;

    PublishSubject<String> s1;
    PublishSubject<String> s2;
    Observable<String> zipped;


            

Reported by PMD.

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

Line: 34

              public class ObservableZipCompletionTest extends RxJavaTest {
    BiFunction<String, String, String> concat2Strings;

    PublishSubject<String> s1;
    PublishSubject<String> s2;
    Observable<String> zipped;

    Observer<String> observer;
    InOrder inOrder;

            

Reported by PMD.

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

Line: 35

                  BiFunction<String, String, String> concat2Strings;

    PublishSubject<String> s1;
    PublishSubject<String> s2;
    Observable<String> zipped;

    Observer<String> observer;
    InOrder inOrder;


            

Reported by PMD.

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

Line: 36

              
    PublishSubject<String> s1;
    PublishSubject<String> s2;
    Observable<String> zipped;

    Observer<String> observer;
    InOrder inOrder;

    @Before

            

Reported by PMD.

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

Line: 38

                  PublishSubject<String> s2;
    Observable<String> zipped;

    Observer<String> observer;
    InOrder inOrder;

    @Before
    public void setUp() {
        concat2Strings = new BiFunction<String, String, String>() {

            

Reported by PMD.

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

Line: 39

                  Observable<String> zipped;

    Observer<String> observer;
    InOrder inOrder;

    @Before
    public void setUp() {
        concat2Strings = new BiFunction<String, String, String>() {
            @Override

            

Reported by PMD.

The String literal 'a-1' appears 4 times in this file; the first occurrence is on line 66
Error

Line: 66

                      s1.onNext("b");
        s1.onComplete();
        s2.onNext("1");
        inOrder.verify(observer, times(1)).onNext("a-1");
        s2.onNext("2");
        inOrder.verify(observer, times(1)).onNext("b-2");
        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }

            

Reported by PMD.

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

Line: 66

                      s1.onNext("b");
        s1.onComplete();
        s2.onNext("1");
        inOrder.verify(observer, times(1)).onNext("a-1");
        s2.onNext("2");
        inOrder.verify(observer, times(1)).onNext("b-2");
        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }

            

Reported by PMD.

The String literal 'b-2' appears 4 times in this file; the first occurrence is on line 68
Error

Line: 68

                      s2.onNext("1");
        inOrder.verify(observer, times(1)).onNext("a-1");
        s2.onNext("2");
        inOrder.verify(observer, times(1)).onNext("b-2");
        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }

    @Test

            

Reported by PMD.

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

Line: 68

                      s2.onNext("1");
        inOrder.verify(observer, times(1)).onNext("a-1");
        s2.onNext("2");
        inOrder.verify(observer, times(1)).onNext("b-2");
        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }

    @Test

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromMaybeTest.java
23 issues
JUnit tests should include assert() or fail()
Design

Line: 30

              public class SingleFromMaybeTest extends RxJavaTest {

    @Test
    public void success() {
        Single.fromMaybe(Maybe.just(1).hide())
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 31

              
    @Test
    public void success() {
        Single.fromMaybe(Maybe.just(1).hide())
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 31

              
    @Test
    public void success() {
        Single.fromMaybe(Maybe.just(1).hide())
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 31

              
    @Test
    public void success() {
        Single.fromMaybe(Maybe.just(1).hide())
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 37

                  }

    @Test
    public void empty() {
        Single.fromMaybe(Maybe.empty().hide())
        .test()
        .assertFailure(NoSuchElementException.class);
    }


            

Reported by PMD.

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

Line: 38

              
    @Test
    public void empty() {
        Single.fromMaybe(Maybe.empty().hide())
        .test()
        .assertFailure(NoSuchElementException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 38

              
    @Test
    public void empty() {
        Single.fromMaybe(Maybe.empty().hide())
        .test()
        .assertFailure(NoSuchElementException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 38

              
    @Test
    public void empty() {
        Single.fromMaybe(Maybe.empty().hide())
        .test()
        .assertFailure(NoSuchElementException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 44

                  }

    @Test
    public void emptyDefault() {
        Single.fromMaybe(Maybe.empty().hide(), 1)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 45

              
    @Test
    public void emptyDefault() {
        Single.fromMaybe(Maybe.empty().hide(), 1)
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromPublisherTest.java
23 issues
JUnit tests should include assert() or fail()
Design

Line: 34

              public class SingleFromPublisherTest extends RxJavaTest {

    @Test
    public void just() {
        Single.fromPublisher(Flowable.just(1))
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 35

              
    @Test
    public void just() {
        Single.fromPublisher(Flowable.just(1))
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 35

              
    @Test
    public void just() {
        Single.fromPublisher(Flowable.just(1))
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 41

                  }

    @Test
    public void range() {
        Single.fromPublisher(Flowable.range(1, 3))
        .test()
        .assertFailure(IndexOutOfBoundsException.class);
    }


            

Reported by PMD.

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

Line: 42

              
    @Test
    public void range() {
        Single.fromPublisher(Flowable.range(1, 3))
        .test()
        .assertFailure(IndexOutOfBoundsException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 42

              
    @Test
    public void range() {
        Single.fromPublisher(Flowable.range(1, 3))
        .test()
        .assertFailure(IndexOutOfBoundsException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 48

                  }

    @Test
    public void empty() {
        Single.fromPublisher(Flowable.empty())
        .test()
        .assertFailure(NoSuchElementException.class);
    }


            

Reported by PMD.

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

Line: 49

              
    @Test
    public void empty() {
        Single.fromPublisher(Flowable.empty())
        .test()
        .assertFailure(NoSuchElementException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 49

              
    @Test
    public void empty() {
        Single.fromPublisher(Flowable.empty())
        .test()
        .assertFailure(NoSuchElementException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 55

                  }

    @Test
    public void error() {
        Single.fromPublisher(Flowable.error(new TestException()))
        .test()
        .assertFailure(TestException.class);
    }


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilterTest.java
23 issues
Position literals first in String comparisons
Design

Line: 39

              
            @Override
            public boolean test(String t1) {
                return t1.equals("two");
            }
        });

        Observer<String> observer = TestHelper.mockObserver();


            

Reported by PMD.

Position literals first in String comparisons
Design

Line: 39

              
            @Override
            public boolean test(String t1) {
                return t1.equals("two");
            }
        });

        Observer<String> observer = TestHelper.mockObserver();


            

Reported by PMD.

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

Line: 47

              
        observable.subscribe(observer);

        verify(observer, Mockito.never()).onNext("one");
        verify(observer, times(1)).onNext("two");
        verify(observer, Mockito.never()).onNext("three");
        verify(observer, Mockito.never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();
    }

            

Reported by PMD.

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

Line: 48

                      observable.subscribe(observer);

        verify(observer, Mockito.never()).onNext("one");
        verify(observer, times(1)).onNext("two");
        verify(observer, Mockito.never()).onNext("three");
        verify(observer, Mockito.never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();
    }


            

Reported by PMD.

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

Line: 49

              
        verify(observer, Mockito.never()).onNext("one");
        verify(observer, times(1)).onNext("two");
        verify(observer, Mockito.never()).onNext("three");
        verify(observer, Mockito.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: 50

                      verify(observer, Mockito.never()).onNext("one");
        verify(observer, times(1)).onNext("two");
        verify(observer, Mockito.never()).onNext("three");
        verify(observer, Mockito.never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();
    }

    @Test
    public void dispose() {

            

Reported by PMD.

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

Line: 51

                      verify(observer, times(1)).onNext("two");
        verify(observer, Mockito.never()).onNext("three");
        verify(observer, Mockito.never()).onError(any(Throwable.class));
        verify(observer, times(1)).onComplete();
    }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Observable.range(1, 5).filter(Functions.alwaysTrue()));

            

Reported by PMD.

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

Line: 55

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Observable.range(1, 5).filter(Functions.alwaysTrue()));
    }

    @Test
    public void doubleOnSubscribe() {

            

Reported by PMD.

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

Line: 56

              
    @Test
    public void dispose() {
        TestHelper.checkDisposed(Observable.range(1, 5).filter(Functions.alwaysTrue()));
    }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeObservable(new Function<Observable<Object>, ObservableSource<Object>>() {

            

Reported by PMD.

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

Line: 60

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeObservable(new Function<Observable<Object>, ObservableSource<Object>>() {
            @Override
            public ObservableSource<Object> apply(Observable<Object> o) throws Exception {
                return o.filter(Functions.alwaysTrue());
            }

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUsing.java
23 issues
Avoid reassigning parameters such as 'e'
Design

Line: 186

              
        @SuppressWarnings("unchecked")
        @Override
        public void onError(Throwable e) {
            upstream = DisposableHelper.DISPOSED;
            if (eager) {
                Object resource = getAndSet(this);
                if (resource != this) {
                    try {

            

Reported by PMD.

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

Line: 35

               */
public final class MaybeUsing<T, D> extends Maybe<T> {

    final Supplier<? extends D> resourceSupplier;

    final Function<? super D, ? extends MaybeSource<? extends T>> sourceSupplier;

    final Consumer<? super D> resourceDisposer;


            

Reported by PMD.

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

Line: 37

              
    final Supplier<? extends D> resourceSupplier;

    final Function<? super D, ? extends MaybeSource<? extends T>> sourceSupplier;

    final Consumer<? super D> resourceDisposer;

    final boolean eager;


            

Reported by PMD.

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

Line: 39

              
    final Function<? super D, ? extends MaybeSource<? extends T>> sourceSupplier;

    final Consumer<? super D> resourceDisposer;

    final boolean eager;

    public MaybeUsing(Supplier<? extends D> resourceSupplier,
            Function<? super D, ? extends MaybeSource<? extends T>> sourceSupplier,

            

Reported by PMD.

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

Line: 41

              
    final Consumer<? super D> resourceDisposer;

    final boolean eager;

    public MaybeUsing(Supplier<? extends D> resourceSupplier,
            Function<? super D, ? extends MaybeSource<? extends T>> sourceSupplier,
            Consumer<? super D> resourceDisposer,
            boolean eager) {

            

Reported by PMD.

A catch statement should never catch throwable since it includes errors.
Error

Line: 59

              
        try {
            resource = resourceSupplier.get();
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            EmptyDisposable.error(ex, observer);
            return;
        }


            

Reported by PMD.

A catch statement should never catch throwable since it includes errors.
Error

Line: 69

              
        try {
            source = Objects.requireNonNull(sourceSupplier.apply(resource), "The sourceSupplier returned a null MaybeSource");
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            if (eager) {
                try {
                    resourceDisposer.accept(resource);
                } catch (Throwable exc) {

            

Reported by PMD.

A catch statement should never catch throwable since it includes errors.
Error

Line: 74

                          if (eager) {
                try {
                    resourceDisposer.accept(resource);
                } catch (Throwable exc) {
                    Exceptions.throwIfFatal(exc);
                    EmptyDisposable.error(new CompositeException(ex, exc), observer);
                    return;
                }
            }

            

Reported by PMD.

A catch statement should never catch throwable since it includes errors.
Error

Line: 86

                          if (!eager) {
                try {
                    resourceDisposer.accept(resource);
                } catch (Throwable exc) {
                    Exceptions.throwIfFatal(exc);
                    RxJavaPlugins.onError(exc);
                }
            }
            return;

            

Reported by PMD.

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

Line: 103

              
        private static final long serialVersionUID = -674404550052917487L;

        final MaybeObserver<? super T> downstream;

        final Consumer<? super D> disposer;

        final boolean eager;


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeMapOptionalTest.java
23 issues
JUnit tests should include assert() or fail()
Design

Line: 31

              public class MaybeMapOptionalTest extends RxJavaTest {

    @Test
    public void successSuccess() {
        Maybe.just(1)
        .mapOptional(Optional::of)
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 32

              
    @Test
    public void successSuccess() {
        Maybe.just(1)
        .mapOptional(Optional::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 32

              
    @Test
    public void successSuccess() {
        Maybe.just(1)
        .mapOptional(Optional::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 32

              
    @Test
    public void successSuccess() {
        Maybe.just(1)
        .mapOptional(Optional::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 39

                  }

    @Test
    public void successEmpty() {
        Maybe.just(1)
        .mapOptional(v -> Optional.empty())
        .test()
        .assertResult();
    }

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void successEmpty() {
        Maybe.just(1)
        .mapOptional(v -> Optional.empty())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 40

              
    @Test
    public void successEmpty() {
        Maybe.just(1)
        .mapOptional(v -> Optional.empty())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 40

              
    @Test
    public void successEmpty() {
        Maybe.just(1)
        .mapOptional(v -> Optional.empty())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 51

                      @SuppressWarnings("unchecked")
        Function<? super Integer, Optional<? extends Integer>> f = mock(Function.class);

        Maybe.<Integer>empty()
        .mapOptional(f)
        .test()
        .assertResult();

        verify(f, never()).apply(any());

            

Reported by PMD.

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

Line: 51

                      @SuppressWarnings("unchecked")
        Function<? super Integer, Optional<? extends Integer>> f = mock(Function.class);

        Maybe.<Integer>empty()
        .mapOptional(f)
        .test()
        .assertResult();

        verify(f, never()).apply(any());

            

Reported by PMD.

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

Line: 33

               */
public final class MaybeConcatArray<T> extends Flowable<T> {

    final MaybeSource<? extends T>[] sources;

    public MaybeConcatArray(MaybeSource<? extends T>[] sources) {
        this.sources = sources;
    }


            

Reported by PMD.

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

Line: 35

              
    final MaybeSource<? extends T>[] sources;

    public MaybeConcatArray(MaybeSource<? extends T>[] sources) {
        this.sources = sources;
    }

    @Override
    protected void subscribeActual(Subscriber<? super T> s) {

            

Reported by PMD.

The class 'ConcatMaybeObserver' has a Standard Cyclomatic Complexity of 2 (Highest = 10).
Design

Line: 46

                      parent.drain();
    }

    static final class ConcatMaybeObserver<T>
    extends AtomicInteger
    implements MaybeObserver<T>, Subscription {

        private static final long serialVersionUID = 3520831347801429610L;


            

Reported by PMD.

The class 'ConcatMaybeObserver' has a Modified Cyclomatic Complexity of 2 (Highest = 10).
Design

Line: 46

                      parent.drain();
    }

    static final class ConcatMaybeObserver<T>
    extends AtomicInteger
    implements MaybeObserver<T>, Subscription {

        private static final long serialVersionUID = 3520831347801429610L;


            

Reported by PMD.

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

Line: 52

              
        private static final long serialVersionUID = 3520831347801429610L;

        final Subscriber<? super T> downstream;

        final AtomicLong requested;

        final AtomicReference<Object> current;


            

Reported by PMD.

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

Line: 54

              
        final Subscriber<? super T> downstream;

        final AtomicLong requested;

        final AtomicReference<Object> current;

        final SequentialDisposable disposables;


            

Reported by PMD.

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

Line: 56

              
        final AtomicLong requested;

        final AtomicReference<Object> current;

        final SequentialDisposable disposables;

        final MaybeSource<? extends T>[] sources;


            

Reported by PMD.

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

Line: 58

              
        final AtomicReference<Object> current;

        final SequentialDisposable disposables;

        final MaybeSource<? extends T>[] sources;

        int index;


            

Reported by PMD.

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

Line: 60

              
        final SequentialDisposable disposables;

        final MaybeSource<? extends T>[] sources;

        int index;

        long produced;


            

Reported by PMD.

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

Line: 62

              
        final MaybeSource<? extends T>[] sources;

        int index;

        long produced;

        ConcatMaybeObserver(Subscriber<? super T> actual, MaybeSource<? extends T>[] sources) {
            this.downstream = actual;

            

Reported by PMD.

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

Line: 31

              
public class SubscriberResourceWrapperTest extends RxJavaTest {

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

    SubscriberResourceWrapper<Integer> s = new SubscriberResourceWrapper<>(ts);

    @Test
    public void cancel() {

            

Reported by PMD.

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

Line: 33

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

    SubscriberResourceWrapper<Integer> s = new SubscriberResourceWrapper<>(ts);

    @Test
    public void cancel() {
        BooleanSubscription bs = new BooleanSubscription();
        Disposable d = Disposable.empty();

            

Reported by PMD.

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

Line: 36

                  SubscriberResourceWrapper<Integer> s = new SubscriberResourceWrapper<>(ts);

    @Test
    public void cancel() {
        BooleanSubscription bs = new BooleanSubscription();
        Disposable d = Disposable.empty();

        s.setResource(d);


            

Reported by PMD.

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

Line: 44

              
        s.onSubscribe(bs);

        assertFalse(d.isDisposed());
        assertFalse(s.isDisposed());

        ts.cancel();

        assertTrue(bs.isCancelled());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 44

              
        s.onSubscribe(bs);

        assertFalse(d.isDisposed());
        assertFalse(s.isDisposed());

        ts.cancel();

        assertTrue(bs.isCancelled());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 45

                      s.onSubscribe(bs);

        assertFalse(d.isDisposed());
        assertFalse(s.isDisposed());

        ts.cancel();

        assertTrue(bs.isCancelled());
        assertTrue(d.isDisposed());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 49

              
        ts.cancel();

        assertTrue(bs.isCancelled());
        assertTrue(d.isDisposed());
        assertTrue(s.isDisposed());
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 50

                      ts.cancel();

        assertTrue(bs.isCancelled());
        assertTrue(d.isDisposed());
        assertTrue(s.isDisposed());
    }

    @Test
    public void error() {

            

Reported by PMD.

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

Line: 50

                      ts.cancel();

        assertTrue(bs.isCancelled());
        assertTrue(d.isDisposed());
        assertTrue(s.isDisposed());
    }

    @Test
    public void error() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 51

              
        assertTrue(bs.isCancelled());
        assertTrue(d.isDisposed());
        assertTrue(s.isDisposed());
    }

    @Test
    public void error() {
        BooleanSubscription bs = new BooleanSubscription();

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetachTest.java
23 issues
Do not explicitly trigger a garbage collection.
Error

Line: 46

              
        o = null;

        System.gc();
        Thread.sleep(200);

        Assert.assertNull("Object retained!", wr.get());

    }

            

Reported by PMD.

Do not explicitly trigger a garbage collection.
Error

Line: 97

                      o = null;
        to.dispose();

        System.gc();
        Thread.sleep(200);

        Assert.assertNull("Object retained!", wr.get());

    }

            

Reported by PMD.

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

Line: 28

              
public class ObservableDetachTest extends RxJavaTest {

    Object o;

    @Test
    public void just() throws Exception {
        o = new Object();


            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 31

                  Object o;

    @Test
    public void just() throws Exception {
        o = new Object();

        WeakReference<Object> wr = new WeakReference<>(o);

        TestObserver<Object> to = new TestObserver<>();

            

Reported by PMD.

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

Line: 38

              
        TestObserver<Object> to = new TestObserver<>();

        Observable.just(o).count().toObservable().onTerminateDetach().subscribe(to);

        to.assertValue(1L);
        to.assertComplete();
        to.assertNoErrors();


            

Reported by PMD.

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

Line: 38

              
        TestObserver<Object> to = new TestObserver<>();

        Observable.just(o).count().toObservable().onTerminateDetach().subscribe(to);

        to.assertValue(1L);
        to.assertComplete();
        to.assertNoErrors();


            

Reported by PMD.

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

Line: 38

              
        TestObserver<Object> to = new TestObserver<>();

        Observable.just(o).count().toObservable().onTerminateDetach().subscribe(to);

        to.assertValue(1L);
        to.assertComplete();
        to.assertNoErrors();


            

Reported by PMD.

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

Line: 38

              
        TestObserver<Object> to = new TestObserver<>();

        Observable.just(o).count().toObservable().onTerminateDetach().subscribe(to);

        to.assertValue(1L);
        to.assertComplete();
        to.assertNoErrors();


            

Reported by PMD.

Assigning an Object to null is a code smell. Consider refactoring.
Error

Line: 44

                      to.assertComplete();
        to.assertNoErrors();

        o = null;

        System.gc();
        Thread.sleep(200);

        Assert.assertNull("Object retained!", wr.get());

            

Reported by PMD.

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

Line: 68

                  public void empty() {
        TestObserver<Object> to = new TestObserver<>();

        Observable.empty().onTerminateDetach().subscribe(to);

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

            

Reported by PMD.