The following issues were found

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/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsing.java
23 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 28

              import io.reactivex.rxjava3.plugins.RxJavaPlugins;

public final class FlowableUsing<T, D> extends Flowable<T> {
    final Supplier<? extends D> resourceSupplier;
    final Function<? super D, ? extends Publisher<? extends T>> sourceSupplier;
    final Consumer<? super D> disposer;
    final boolean eager;

    public FlowableUsing(Supplier<? extends D> resourceSupplier,

            

Reported by PMD.

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

Line: 29

              
public final class FlowableUsing<T, D> extends Flowable<T> {
    final Supplier<? extends D> resourceSupplier;
    final Function<? super D, ? extends Publisher<? extends T>> sourceSupplier;
    final Consumer<? super D> disposer;
    final boolean eager;

    public FlowableUsing(Supplier<? extends D> resourceSupplier,
            Function<? super D, ? extends Publisher<? extends T>> sourceSupplier,

            

Reported by PMD.

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

Line: 30

              public final class FlowableUsing<T, D> extends Flowable<T> {
    final Supplier<? extends D> resourceSupplier;
    final Function<? super D, ? extends Publisher<? extends T>> sourceSupplier;
    final Consumer<? super D> disposer;
    final boolean eager;

    public FlowableUsing(Supplier<? extends D> resourceSupplier,
            Function<? super D, ? extends Publisher<? extends T>> sourceSupplier,
            Consumer<? super D> disposer,

            

Reported by PMD.

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

Line: 31

                  final Supplier<? extends D> resourceSupplier;
    final Function<? super D, ? extends Publisher<? extends T>> sourceSupplier;
    final Consumer<? super D> disposer;
    final boolean eager;

    public FlowableUsing(Supplier<? extends D> resourceSupplier,
            Function<? super D, ? extends Publisher<? extends T>> sourceSupplier,
            Consumer<? super D> disposer,
            boolean eager) {

            

Reported by PMD.

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

Line: 49

              
        try {
            resource = resourceSupplier.get();
        } catch (Throwable e) {
            Exceptions.throwIfFatal(e);
            EmptySubscription.error(e, s);
            return;
        }


            

Reported by PMD.

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

Line: 58

                      Publisher<? extends T> source;
        try {
            source = Objects.requireNonNull(sourceSupplier.apply(resource), "The sourceSupplier returned a null Publisher");
        } catch (Throwable e) {
            Exceptions.throwIfFatal(e);
            try {
                disposer.accept(resource);
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);

            

Reported by PMD.

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

Line: 62

                          Exceptions.throwIfFatal(e);
            try {
                disposer.accept(resource);
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                EmptySubscription.error(new CompositeException(e, ex), s);
                return;
            }
            EmptySubscription.error(e, s);

            

Reported by PMD.

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

Line: 73

              
        UsingSubscriber<T, D> us = new UsingSubscriber<>(s, resource, disposer, eager);

        source.subscribe(us);
    }

    static final class UsingSubscriber<T, D> extends AtomicBoolean implements FlowableSubscriber<T>, Subscription {

        private static final long serialVersionUID = 5904473792286235046L;

            

Reported by PMD.

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

Line: 80

              
        private static final long serialVersionUID = 5904473792286235046L;

        final Subscriber<? super T> downstream;
        final D resource;
        final Consumer<? super D> disposer;
        final boolean eager;

        Subscription upstream;

            

Reported by PMD.

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

Line: 81

                      private static final long serialVersionUID = 5904473792286235046L;

        final Subscriber<? super T> downstream;
        final D resource;
        final Consumer<? super D> disposer;
        final boolean eager;

        Subscription upstream;


            

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.

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/completable/CompletableRetryTest.java
23 issues
Avoid throwing raw exception types.
Design

Line: 38

                              numberOfSubscribeCalls.incrementAndGet();

                if (atomicInteger.decrementAndGet() != 0) {
                    throw new RuntimeException();
                }

                throw new IllegalArgumentException();
            }
        })

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 65

                              numberOfSubscribeCalls.incrementAndGet();

                if (atomicInteger.decrementAndGet() != 0) {
                    throw new RuntimeException();
                }
            }
        })
            .retry(2, Functions.alwaysTrue())
            .test()

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 86

                              numberOfSubscribeCalls.incrementAndGet();

                if (atomicInteger.decrementAndGet() != 0) {
                    throw new RuntimeException();
                }
            }
        })
            .retry(1, Functions.alwaysTrue())
            .test()

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 107

                              numberOfSubscribeCalls.incrementAndGet();

                if (atomicInteger.decrementAndGet() != 0) {
                    throw new RuntimeException();
                }
            }
        })
            .retry(0, Functions.alwaysTrue())
            .test()

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 52

                          .test()
            .assertFailure(IllegalArgumentException.class);

        assertEquals(3, numberOfSubscribeCalls.get());
    }

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 73

                          .test()
            .assertResult();

        assertEquals(3, numberOfSubscribeCalls.get());
    }

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 94

                          .test()
            .assertFailure(RuntimeException.class);

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

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 115

                          .test()
            .assertFailure(RuntimeException.class);

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

    @Test
    public void untilTrueEmpty() {
        Completable.complete()

            

Reported by PMD.

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

Line: 119

                  }

    @Test
    public void untilTrueEmpty() {
        Completable.complete()
        .retryUntil(() -> true)
        .test()
        .assertResult();
    }

            

Reported by PMD.

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

Line: 120

              
    @Test
    public void untilTrueEmpty() {
        Completable.complete()
        .retryUntil(() -> true)
        .test()
        .assertResult();
    }


            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/subscribers/SafeSubscriber.java
23 issues
Avoid reassigning parameters such as 't'
Design

Line: 129

                  }

    @Override
    public void onError(@NonNull Throwable t) {
        if (done) {
            RxJavaPlugins.onError(t);
            return;
        }
        done = true;

            

Reported by PMD.

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

Line: 33

               */
public final class SafeSubscriber<@NonNull T> implements FlowableSubscriber<T>, Subscription {
    /** The actual Subscriber. */
    final Subscriber<? super T> downstream;
    /** The subscription. */
    Subscription upstream;
    /** Indicates a terminal state. */
    boolean done;


            

Reported by PMD.

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

Line: 35

                  /** The actual Subscriber. */
    final Subscriber<? super T> downstream;
    /** The subscription. */
    Subscription upstream;
    /** Indicates a terminal state. */
    boolean done;

    /**
     * Constructs a {@code SafeSubscriber} by wrapping the given actual {@link Subscriber}.

            

Reported by PMD.

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

Line: 37

                  /** The subscription. */
    Subscription upstream;
    /** Indicates a terminal state. */
    boolean done;

    /**
     * Constructs a {@code SafeSubscriber} by wrapping the given actual {@link Subscriber}.
     * @param downstream the actual {@code Subscriber} to wrap, not {@code null} (not validated)
     */

            

Reported by PMD.

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

Line: 53

                          this.upstream = s;
            try {
                downstream.onSubscribe(this);
            } catch (Throwable e) {
                Exceptions.throwIfFatal(e);
                done = true;
                // can't call onError because the actual's state may be corrupt at this point
                try {
                    s.cancel();

            

Reported by PMD.

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

Line: 59

                              // can't call onError because the actual's state may be corrupt at this point
                try {
                    s.cancel();
                } catch (Throwable e1) {
                    Exceptions.throwIfFatal(e1);
                    RxJavaPlugins.onError(new CompositeException(e, e1));
                    return;
                }
                RxJavaPlugins.onError(e);

            

Reported by PMD.

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

Line: 83

                          Throwable ex = ExceptionHelper.createNullPointerException("onNext called with a null Throwable.");
            try {
                upstream.cancel();
            } catch (Throwable e1) {
                Exceptions.throwIfFatal(e1);
                onError(new CompositeException(ex, e1));
                return;
            }
            onError(ex);

            

Reported by PMD.

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

Line: 94

              
        try {
            downstream.onNext(t);
        } catch (Throwable e) {
            Exceptions.throwIfFatal(e);
            try {
                upstream.cancel();
            } catch (Throwable e1) {
                Exceptions.throwIfFatal(e1);

            

Reported by PMD.

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

Line: 98

                          Exceptions.throwIfFatal(e);
            try {
                upstream.cancel();
            } catch (Throwable e1) {
                Exceptions.throwIfFatal(e1);
                onError(new CompositeException(e, e1));
                return;
            }
            onError(e);

            

Reported by PMD.

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

Line: 113

              
        try {
            downstream.onSubscribe(EmptySubscription.INSTANCE);
        } catch (Throwable e) {
            Exceptions.throwIfFatal(e);
            // can't call onError because the actual's state may be corrupt at this point
            RxJavaPlugins.onError(new CompositeException(ex, e));
            return;
        }

            

Reported by PMD.

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

Line: 33

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

    PublishProcessor<String> s1;
    PublishProcessor<String> s2;
    Flowable<String> zipped;


            

Reported by PMD.

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

Line: 35

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

    PublishProcessor<String> s1;
    PublishProcessor<String> s2;
    Flowable<String> zipped;

    Subscriber<String> subscriber;
    InOrder inOrder;

            

Reported by PMD.

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

Line: 36

                  BiFunction<String, String, String> concat2Strings;

    PublishProcessor<String> s1;
    PublishProcessor<String> s2;
    Flowable<String> zipped;

    Subscriber<String> subscriber;
    InOrder inOrder;


            

Reported by PMD.

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

Line: 37

              
    PublishProcessor<String> s1;
    PublishProcessor<String> s2;
    Flowable<String> zipped;

    Subscriber<String> subscriber;
    InOrder inOrder;

    @Before

            

Reported by PMD.

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

Line: 39

                  PublishProcessor<String> s2;
    Flowable<String> zipped;

    Subscriber<String> subscriber;
    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: 40

                  Flowable<String> zipped;

    Subscriber<String> subscriber;
    InOrder inOrder;

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

            

Reported by PMD.

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

Line: 67

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

            

Reported by PMD.

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

Line: 67

                      s1.onNext("b");
        s1.onComplete();
        s2.onNext("1");
        inOrder.verify(subscriber, times(1)).onNext("a-1");
        s2.onNext("2");
        inOrder.verify(subscriber, times(1)).onNext("b-2");
        inOrder.verify(subscriber, 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 69
Error

Line: 69

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

    @Test

            

Reported by PMD.

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

Line: 69

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

    @Test

            

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/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerate.java
23 issues
Avoid reassigning parameters such as 't'
Design

Line: 155

                      }

        @Override
        public void onError(Throwable t) {
            if (terminate) {
                RxJavaPlugins.onError(t);
            } else {
                if (t == null) {
                    t = ExceptionHelper.createNullPointerException("onError called with a null Throwable.");

            

Reported by PMD.

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

Line: 25

              import io.reactivex.rxjava3.plugins.RxJavaPlugins;

public final class ObservableGenerate<T, S> extends Observable<T> {
    final Supplier<S> stateSupplier;
    final BiFunction<S, Emitter<T>, S> generator;
    final Consumer<? super S> disposeState;

    public ObservableGenerate(Supplier<S> stateSupplier, BiFunction<S, Emitter<T>, S> generator,
            Consumer<? super S> disposeState) {

            

Reported by PMD.

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

Line: 26

              
public final class ObservableGenerate<T, S> extends Observable<T> {
    final Supplier<S> stateSupplier;
    final BiFunction<S, Emitter<T>, S> generator;
    final Consumer<? super S> disposeState;

    public ObservableGenerate(Supplier<S> stateSupplier, BiFunction<S, Emitter<T>, S> generator,
            Consumer<? super S> disposeState) {
        this.stateSupplier = stateSupplier;

            

Reported by PMD.

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

Line: 27

              public final class ObservableGenerate<T, S> extends Observable<T> {
    final Supplier<S> stateSupplier;
    final BiFunction<S, Emitter<T>, S> generator;
    final Consumer<? super S> disposeState;

    public ObservableGenerate(Supplier<S> stateSupplier, BiFunction<S, Emitter<T>, S> generator,
            Consumer<? super S> disposeState) {
        this.stateSupplier = stateSupplier;
        this.generator = generator;

            

Reported by PMD.

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

Line: 42

              
        try {
            state = stateSupplier.get();
        } catch (Throwable e) {
            Exceptions.throwIfFatal(e);
            EmptyDisposable.error(e, observer);
            return;
        }


            

Reported by PMD.

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

Line: 56

                  static final class GeneratorDisposable<T, S>
    implements Emitter<T>, Disposable {

        final Observer<? super T> downstream;
        final BiFunction<S, ? super Emitter<T>, S> generator;
        final Consumer<? super S> disposeState;

        S state;


            

Reported by PMD.

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

Line: 57

                  implements Emitter<T>, Disposable {

        final Observer<? super T> downstream;
        final BiFunction<S, ? super Emitter<T>, S> generator;
        final Consumer<? super S> disposeState;

        S state;

        volatile boolean cancelled;

            

Reported by PMD.

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

Line: 58

              
        final Observer<? super T> downstream;
        final BiFunction<S, ? super Emitter<T>, S> generator;
        final Consumer<? super S> disposeState;

        S state;

        volatile boolean cancelled;


            

Reported by PMD.

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

Line: 60

                      final BiFunction<S, ? super Emitter<T>, S> generator;
        final Consumer<? super S> disposeState;

        S state;

        volatile boolean cancelled;

        boolean terminate;


            

Reported by PMD.

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

Line: 62

              
        S state;

        volatile boolean cancelled;

        boolean terminate;

        boolean hasNext;


            

Reported by PMD.