The following issues were found

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

Line: 27

              import io.reactivex.rxjava3.plugins.RxJavaPlugins;

public final class ObservableDebounceTimed<T> extends AbstractObservableWithUpstream<T, T> {
    final long timeout;
    final TimeUnit unit;
    final Scheduler scheduler;

    public ObservableDebounceTimed(ObservableSource<T> source, long timeout, TimeUnit unit, Scheduler scheduler) {
        super(source);

            

Reported by PMD.

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

Line: 28

              
public final class ObservableDebounceTimed<T> extends AbstractObservableWithUpstream<T, T> {
    final long timeout;
    final TimeUnit unit;
    final Scheduler scheduler;

    public ObservableDebounceTimed(ObservableSource<T> source, long timeout, TimeUnit unit, Scheduler scheduler) {
        super(source);
        this.timeout = timeout;

            

Reported by PMD.

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

Line: 29

              public final class ObservableDebounceTimed<T> extends AbstractObservableWithUpstream<T, T> {
    final long timeout;
    final TimeUnit unit;
    final Scheduler scheduler;

    public ObservableDebounceTimed(ObservableSource<T> source, long timeout, TimeUnit unit, Scheduler scheduler) {
        super(source);
        this.timeout = timeout;
        this.unit = unit;

            

Reported by PMD.

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

Line: 47

              
    static final class DebounceTimedObserver<T>
    implements Observer<T>, Disposable {
        final Observer<? super T> downstream;
        final long timeout;
        final TimeUnit unit;
        final Scheduler.Worker worker;

        Disposable upstream;

            

Reported by PMD.

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

Line: 48

                  static final class DebounceTimedObserver<T>
    implements Observer<T>, Disposable {
        final Observer<? super T> downstream;
        final long timeout;
        final TimeUnit unit;
        final Scheduler.Worker worker;

        Disposable upstream;


            

Reported by PMD.

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

Line: 49

                  implements Observer<T>, Disposable {
        final Observer<? super T> downstream;
        final long timeout;
        final TimeUnit unit;
        final Scheduler.Worker worker;

        Disposable upstream;

        Disposable timer;

            

Reported by PMD.

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

Line: 50

                      final Observer<? super T> downstream;
        final long timeout;
        final TimeUnit unit;
        final Scheduler.Worker worker;

        Disposable upstream;

        Disposable timer;


            

Reported by PMD.

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

Line: 52

                      final TimeUnit unit;
        final Scheduler.Worker worker;

        Disposable upstream;

        Disposable timer;

        volatile long index;


            

Reported by PMD.

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

Line: 54

              
        Disposable upstream;

        Disposable timer;

        volatile long index;

        boolean done;


            

Reported by PMD.

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

Line: 56

              
        Disposable timer;

        volatile long index;

        boolean done;

        DebounceTimedObserver(Observer<? super T> actual, long timeout, TimeUnit unit, Worker worker) {
            this.downstream = actual;

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/queue/SpscLinkedArrayQueue.java
16 issues
Avoid throwing null pointer exceptions.
Design

Line: 69

                  @Override
    public boolean offer(final T e) {
        if (null == e) {
            throw new NullPointerException("Null is not a valid element");
        }
        // local load of field to avoid repeated loads after volatile reads
        final AtomicReferenceArray<Object> buffer = producerBuffer;
        final long index = lpProducerIndex();
        final int mask = producerMask;

            

Reported by PMD.

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

Line: 32

               * than the producer.
 * @param <T> the contained value type
 */
public final class SpscLinkedArrayQueue<T> implements SimplePlainQueue<T> {
    static final int MAX_LOOK_AHEAD_STEP = Integer.getInteger("jctools.spsc.max.lookahead.step", 4096);
    final AtomicLong producerIndex = new AtomicLong();

    int producerLookAheadStep;
    long producerLookAhead;

            

Reported by PMD.

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

Line: 34

               */
public final class SpscLinkedArrayQueue<T> implements SimplePlainQueue<T> {
    static final int MAX_LOOK_AHEAD_STEP = Integer.getInteger("jctools.spsc.max.lookahead.step", 4096);
    final AtomicLong producerIndex = new AtomicLong();

    int producerLookAheadStep;
    long producerLookAhead;

    final int producerMask;

            

Reported by PMD.

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

Line: 36

                  static final int MAX_LOOK_AHEAD_STEP = Integer.getInteger("jctools.spsc.max.lookahead.step", 4096);
    final AtomicLong producerIndex = new AtomicLong();

    int producerLookAheadStep;
    long producerLookAhead;

    final int producerMask;

    AtomicReferenceArray<Object> producerBuffer;

            

Reported by PMD.

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

Line: 37

                  final AtomicLong producerIndex = new AtomicLong();

    int producerLookAheadStep;
    long producerLookAhead;

    final int producerMask;

    AtomicReferenceArray<Object> producerBuffer;
    final int consumerMask;

            

Reported by PMD.

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

Line: 39

                  int producerLookAheadStep;
    long producerLookAhead;

    final int producerMask;

    AtomicReferenceArray<Object> producerBuffer;
    final int consumerMask;
    AtomicReferenceArray<Object> consumerBuffer;
    final AtomicLong consumerIndex = new AtomicLong();

            

Reported by PMD.

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

Line: 41

              
    final int producerMask;

    AtomicReferenceArray<Object> producerBuffer;
    final int consumerMask;
    AtomicReferenceArray<Object> consumerBuffer;
    final AtomicLong consumerIndex = new AtomicLong();

    private static final Object HAS_NEXT = new Object();

            

Reported by PMD.

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

Line: 42

                  final int producerMask;

    AtomicReferenceArray<Object> producerBuffer;
    final int consumerMask;
    AtomicReferenceArray<Object> consumerBuffer;
    final AtomicLong consumerIndex = new AtomicLong();

    private static final Object HAS_NEXT = new Object();


            

Reported by PMD.

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

Line: 43

              
    AtomicReferenceArray<Object> producerBuffer;
    final int consumerMask;
    AtomicReferenceArray<Object> consumerBuffer;
    final AtomicLong consumerIndex = new AtomicLong();

    private static final Object HAS_NEXT = new Object();

    public SpscLinkedArrayQueue(final int bufferSize) {

            

Reported by PMD.

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

Line: 44

                  AtomicReferenceArray<Object> producerBuffer;
    final int consumerMask;
    AtomicReferenceArray<Object> consumerBuffer;
    final AtomicLong consumerIndex = new AtomicLong();

    private static final Object HAS_NEXT = new Object();

    public SpscLinkedArrayQueue(final int bufferSize) {
        int p2capacity = Pow2.roundToPowerOfTwo(Math.max(8, bufferSize));

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTask.java
16 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 33

              
    private static final long serialVersionUID = 1811839108042568751L;

    protected final Runnable runnable;

    protected final boolean interruptOnCancel;

    protected Thread runner;


            

Reported by PMD.

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

Line: 35

              
    protected final Runnable runnable;

    protected final boolean interruptOnCancel;

    protected Thread runner;

    protected static final FutureTask<Void> FINISHED = new FutureTask<>(Functions.EMPTY_RUNNABLE, null);


            

Reported by PMD.

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

Line: 37

              
    protected final boolean interruptOnCancel;

    protected Thread runner;

    protected static final FutureTask<Void> FINISHED = new FutureTask<>(Functions.EMPTY_RUNNABLE, null);

    protected static final FutureTask<Void> DISPOSED = new FutureTask<>(Functions.EMPTY_RUNNABLE, null);


            

Reported by PMD.

Use equals() to compare object references.
Error

Line: 51

                  @Override
    public final void dispose() {
        Future<?> f = get();
        if (f != FINISHED && f != DISPOSED) {
            if (compareAndSet(f, DISPOSED)) {
                if (f != null) {
                    cancelFuture(f);
                }
            }

            

Reported by PMD.

Use equals() to compare object references.
Error

Line: 51

                  @Override
    public final void dispose() {
        Future<?> f = get();
        if (f != FINISHED && f != DISPOSED) {
            if (compareAndSet(f, DISPOSED)) {
                if (f != null) {
                    cancelFuture(f);
                }
            }

            

Reported by PMD.

These nested if statements could be combined
Design

Line: 52

                  public final void dispose() {
        Future<?> f = get();
        if (f != FINISHED && f != DISPOSED) {
            if (compareAndSet(f, DISPOSED)) {
                if (f != null) {
                    cancelFuture(f);
                }
            }
        }

            

Reported by PMD.

Deeply nested if..then statements are hard to read
Design

Line: 53

                      Future<?> f = get();
        if (f != FINISHED && f != DISPOSED) {
            if (compareAndSet(f, DISPOSED)) {
                if (f != null) {
                    cancelFuture(f);
                }
            }
        }
    }

            

Reported by PMD.

These nested if statements could be combined
Design

Line: 53

                      Future<?> f = get();
        if (f != FINISHED && f != DISPOSED) {
            if (compareAndSet(f, DISPOSED)) {
                if (f != null) {
                    cancelFuture(f);
                }
            }
        }
    }

            

Reported by PMD.

Use equals() to compare object references.
Error

Line: 63

                  @Override
    public final boolean isDisposed() {
        Future<?> f = get();
        return f == FINISHED || f == DISPOSED;
    }

    public final void setFuture(Future<?> future) {
        for (;;) {
            Future<?> f = get();

            

Reported by PMD.

Use equals() to compare object references.
Error

Line: 63

                  @Override
    public final boolean isDisposed() {
        Future<?> f = get();
        return f == FINISHED || f == DISPOSED;
    }

    public final void setFuture(Future<?> future) {
        for (;;) {
            Future<?> f = get();

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycle.java
16 issues
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 FlowableDoOnLifecycle<T> extends AbstractFlowableWithUpstream<T, T> {
    private final Consumer<? super Subscription> onSubscribe;
    private final LongConsumer onRequest;
    private final Action onCancel;

    public FlowableDoOnLifecycle(Flowable<T> source, Consumer<? super Subscription> onSubscribe,
            LongConsumer onRequest, Action onCancel) {

            

Reported by PMD.

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

Line: 26

              
public final class FlowableDoOnLifecycle<T> extends AbstractFlowableWithUpstream<T, T> {
    private final Consumer<? super Subscription> onSubscribe;
    private final LongConsumer onRequest;
    private final Action onCancel;

    public FlowableDoOnLifecycle(Flowable<T> source, Consumer<? super Subscription> onSubscribe,
            LongConsumer onRequest, Action onCancel) {
        super(source);

            

Reported by PMD.

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

Line: 27

              public final class FlowableDoOnLifecycle<T> extends AbstractFlowableWithUpstream<T, T> {
    private final Consumer<? super Subscription> onSubscribe;
    private final LongConsumer onRequest;
    private final Action onCancel;

    public FlowableDoOnLifecycle(Flowable<T> source, Consumer<? super Subscription> onSubscribe,
            LongConsumer onRequest, Action onCancel) {
        super(source);
        this.onSubscribe = onSubscribe;

            

Reported by PMD.

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

Line: 43

                  }

    static final class SubscriptionLambdaSubscriber<T> implements FlowableSubscriber<T>, Subscription {
        final Subscriber<? super T> downstream;
        final Consumer<? super Subscription> onSubscribe;
        final LongConsumer onRequest;
        final Action onCancel;

        Subscription upstream;

            

Reported by PMD.

Field onSubscribe has the same name as a method
Error

Line: 44

              
    static final class SubscriptionLambdaSubscriber<T> implements FlowableSubscriber<T>, Subscription {
        final Subscriber<? super T> downstream;
        final Consumer<? super Subscription> onSubscribe;
        final LongConsumer onRequest;
        final Action onCancel;

        Subscription upstream;


            

Reported by PMD.

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

Line: 44

              
    static final class SubscriptionLambdaSubscriber<T> implements FlowableSubscriber<T>, Subscription {
        final Subscriber<? super T> downstream;
        final Consumer<? super Subscription> onSubscribe;
        final LongConsumer onRequest;
        final Action onCancel;

        Subscription upstream;


            

Reported by PMD.

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

Line: 45

                  static final class SubscriptionLambdaSubscriber<T> implements FlowableSubscriber<T>, Subscription {
        final Subscriber<? super T> downstream;
        final Consumer<? super Subscription> onSubscribe;
        final LongConsumer onRequest;
        final Action onCancel;

        Subscription upstream;

        SubscriptionLambdaSubscriber(Subscriber<? super T> actual,

            

Reported by PMD.

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

Line: 46

                      final Subscriber<? super T> downstream;
        final Consumer<? super Subscription> onSubscribe;
        final LongConsumer onRequest;
        final Action onCancel;

        Subscription upstream;

        SubscriptionLambdaSubscriber(Subscriber<? super T> actual,
                Consumer<? super Subscription> onSubscribe,

            

Reported by PMD.

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

Line: 48

                      final LongConsumer onRequest;
        final Action onCancel;

        Subscription upstream;

        SubscriptionLambdaSubscriber(Subscriber<? super T> actual,
                Consumer<? super Subscription> onSubscribe,
                LongConsumer onRequest,
                Action onCancel) {

            

Reported by PMD.

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

Line: 65

                          // this way, multiple calls to onSubscribe can show up in tests that use doOnSubscribe to validate behavior
            try {
                onSubscribe.accept(s);
            } catch (Throwable e) {
                Exceptions.throwIfFatal(e);
                s.cancel();
                this.upstream = SubscriptionHelper.CANCELLED;
                EmptySubscription.error(e, downstream);
                return;

            

Reported by PMD.

src/jmh/java/io/reactivex/rxjava3/core/RangePerf.java
16 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 32

              @State(Scope.Thread)
public class RangePerf {
    @Param({ "1", "1000", "1000000" })
    public int times;

    Flowable<Integer> range;

    Flowable<Integer> rangeAsync;


            

Reported by PMD.

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

Line: 34

                  @Param({ "1", "1000", "1000000" })
    public int times;

    Flowable<Integer> range;

    Flowable<Integer> rangeAsync;

    Flowable<Integer> rangeAsyncPipeline;


            

Reported by PMD.

Field rangeAsync has the same name as a method
Error

Line: 36

              
    Flowable<Integer> range;

    Flowable<Integer> rangeAsync;

    Flowable<Integer> rangeAsyncPipeline;

    @Setup
    public void setup() {

            

Reported by PMD.

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

Line: 36

              
    Flowable<Integer> range;

    Flowable<Integer> rangeAsync;

    Flowable<Integer> rangeAsyncPipeline;

    @Setup
    public void setup() {

            

Reported by PMD.

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

Line: 38

              
    Flowable<Integer> rangeAsync;

    Flowable<Integer> rangeAsyncPipeline;

    @Setup
    public void setup() {
        range = Flowable.range(1, times);


            

Reported by PMD.

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

Line: 59

                  }

//    @Benchmark
    public void rangeAsync(Blackhole bh) throws Exception {
        PerfSubscriber lo = new PerfSubscriber(bh);

        rangeAsync.subscribe(lo);

        if (times == 1) {

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 64

              
        rangeAsync.subscribe(lo);

        if (times == 1) {
            while (lo.latch.getCount() != 0) { }
        } else {
            lo.latch.await();
        }
    }

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 65

                      rangeAsync.subscribe(lo);

        if (times == 1) {
            while (lo.latch.getCount() != 0) { }
        } else {
            lo.latch.await();
        }
    }


            

Reported by PMD.

Avoid empty while statements
Error

Line: 65

                      rangeAsync.subscribe(lo);

        if (times == 1) {
            while (lo.latch.getCount() != 0) { }
        } else {
            lo.latch.await();
        }
    }


            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 67

                      if (times == 1) {
            while (lo.latch.getCount() != 0) { }
        } else {
            lo.latch.await();
        }
    }

//    @Benchmark
    public void rangePipeline(Blackhole bh) throws Exception {

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/schedulers/IoScheduler.java
16 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 42

                  private static final TimeUnit KEEP_ALIVE_UNIT = TimeUnit.SECONDS;

    static final ThreadWorker SHUTDOWN_THREAD_WORKER;
    final ThreadFactory threadFactory;
    final AtomicReference<CachedWorkerPool> pool;

    /** The name of the system property for setting the thread priority for this Scheduler. */
    private static final String KEY_IO_PRIORITY = "rx3.io-priority";


            

Reported by PMD.

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

Line: 43

              
    static final ThreadWorker SHUTDOWN_THREAD_WORKER;
    final ThreadFactory threadFactory;
    final AtomicReference<CachedWorkerPool> pool;

    /** The name of the system property for setting the thread priority for this Scheduler. */
    private static final String KEY_IO_PRIORITY = "rx3.io-priority";

    /** The name of the system property for setting the release behaviour for this Scheduler. */

            

Reported by PMD.

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

Line: 74

                  }

    static final class CachedWorkerPool implements Runnable {
        private final long keepAliveTime;
        private final ConcurrentLinkedQueue<ThreadWorker> expiringWorkerQueue;
        final CompositeDisposable allWorkers;
        private final ScheduledExecutorService evictorService;
        private final Future<?> evictorTask;
        private final ThreadFactory threadFactory;

            

Reported by PMD.

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

Line: 75

              
    static final class CachedWorkerPool implements Runnable {
        private final long keepAliveTime;
        private final ConcurrentLinkedQueue<ThreadWorker> expiringWorkerQueue;
        final CompositeDisposable allWorkers;
        private final ScheduledExecutorService evictorService;
        private final Future<?> evictorTask;
        private final ThreadFactory threadFactory;


            

Reported by PMD.

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

Line: 76

                  static final class CachedWorkerPool implements Runnable {
        private final long keepAliveTime;
        private final ConcurrentLinkedQueue<ThreadWorker> expiringWorkerQueue;
        final CompositeDisposable allWorkers;
        private final ScheduledExecutorService evictorService;
        private final Future<?> evictorTask;
        private final ThreadFactory threadFactory;

        CachedWorkerPool(long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory) {

            

Reported by PMD.

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

Line: 77

                      private final long keepAliveTime;
        private final ConcurrentLinkedQueue<ThreadWorker> expiringWorkerQueue;
        final CompositeDisposable allWorkers;
        private final ScheduledExecutorService evictorService;
        private final Future<?> evictorTask;
        private final ThreadFactory threadFactory;

        CachedWorkerPool(long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory) {
            this.keepAliveTime = unit != null ? unit.toNanos(keepAliveTime) : 0L;

            

Reported by PMD.

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

Line: 78

                      private final ConcurrentLinkedQueue<ThreadWorker> expiringWorkerQueue;
        final CompositeDisposable allWorkers;
        private final ScheduledExecutorService evictorService;
        private final Future<?> evictorTask;
        private final ThreadFactory threadFactory;

        CachedWorkerPool(long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory) {
            this.keepAliveTime = unit != null ? unit.toNanos(keepAliveTime) : 0L;
            this.expiringWorkerQueue = new ConcurrentLinkedQueue<>();

            

Reported by PMD.

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

Line: 79

                      final CompositeDisposable allWorkers;
        private final ScheduledExecutorService evictorService;
        private final Future<?> evictorTask;
        private final ThreadFactory threadFactory;

        CachedWorkerPool(long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory) {
            this.keepAliveTime = unit != null ? unit.toNanos(keepAliveTime) : 0L;
            this.expiringWorkerQueue = new ConcurrentLinkedQueue<>();
            this.allWorkers = new CompositeDisposable();

            

Reported by PMD.

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

Line: 197

                  }

    public int size() {
        return pool.get().allWorkers.size();
    }

    static final class EventLoopWorker extends Scheduler.Worker implements Runnable {
        private final CompositeDisposable tasks;
        private final CachedWorkerPool pool;

            

Reported by PMD.

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

Line: 197

                  }

    public int size() {
        return pool.get().allWorkers.size();
    }

    static final class EventLoopWorker extends Scheduler.Worker implements Runnable {
        private final CompositeDisposable tasks;
        private final CachedWorkerPool pool;

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableSubscriberTest.java
16 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 29

              public class BasicFuseableSubscriberTest extends RxJavaTest {

    @Test
    public void offerThrows() {
        BasicFuseableSubscriber<Integer, Integer> fcs = new BasicFuseableSubscriber<Integer, Integer>(new TestSubscriber<>(0L)) {

            @Override
            public void onNext(Integer t) {
            }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 52

              
        TestHelper.assertNoOffer(fcs);

        assertFalse(fcs.isEmpty());
        fcs.clear();
        assertTrue(fcs.isEmpty());
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 54

              
        assertFalse(fcs.isEmpty());
        fcs.clear();
        assertTrue(fcs.isEmpty());
    }

    @Test
    public void implementationStopsOnSubscribe() {
        TestSubscriber<Integer> ts = new TestSubscriber<>();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 86

              
        bfs.onSubscribe(new BooleanSubscription());

        assertFalse(ts.hasSubscription());
    }
}

            

Reported by PMD.

Avoid unused imports such as 'org.junit.Assert'
Design

Line: 16

              
package io.reactivex.rxjava3.internal.subscribers;

import static org.junit.Assert.*;

import org.junit.Test;

import io.reactivex.rxjava3.annotations.*;
import io.reactivex.rxjava3.core.RxJavaTest;

            

Reported by PMD.

Avoid unused imports such as 'io.reactivex.rxjava3.annotations'
Design

Line: 20

              
import org.junit.Test;

import io.reactivex.rxjava3.annotations.*;
import io.reactivex.rxjava3.core.RxJavaTest;
import io.reactivex.rxjava3.internal.subscriptions.*;
import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.TestHelper;


            

Reported by PMD.

Avoid unused imports such as 'io.reactivex.rxjava3.internal.subscriptions'
Design

Line: 22

              
import io.reactivex.rxjava3.annotations.*;
import io.reactivex.rxjava3.core.RxJavaTest;
import io.reactivex.rxjava3.internal.subscriptions.*;
import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class BasicFuseableSubscriberTest extends RxJavaTest {


            

Reported by PMD.

Found 'DU'-anomaly for variable 'fcs' (lines '30'-'55').
Error

Line: 30

              
    @Test
    public void offerThrows() {
        BasicFuseableSubscriber<Integer, Integer> fcs = new BasicFuseableSubscriber<Integer, Integer>(new TestSubscriber<>(0L)) {

            @Override
            public void onNext(Integer t) {
            }


            

Reported by PMD.

Found 'DU'-anomaly for variable 'fcs' (lines '30'-'55').
Error

Line: 30

              
    @Test
    public void offerThrows() {
        BasicFuseableSubscriber<Integer, Integer> fcs = new BasicFuseableSubscriber<Integer, Integer>(new TestSubscriber<>(0L)) {

            @Override
            public void onNext(Integer t) {
            }


            

Reported by PMD.

Found 'DU'-anomaly for variable 'fcs' (lines '30'-'55').
Error

Line: 30

              
    @Test
    public void offerThrows() {
        BasicFuseableSubscriber<Integer, Integer> fcs = new BasicFuseableSubscriber<Integer, Integer>(new TestSubscriber<>(0L)) {

            @Override
            public void onNext(Integer t) {
            }


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/subscribers/EmptyComponentTest.java
16 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 33

              public class EmptyComponentTest extends RxJavaTest {

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

        try {
            TestHelper.checkEnum(EmptyComponent.class);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 41

              
            EmptyComponent c = EmptyComponent.INSTANCE;

            assertTrue(c.isDisposed());

            c.request(10);

            c.request(-10);


            

Reported by PMD.

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

Line: 41

              
            EmptyComponent c = EmptyComponent.INSTANCE;

            assertTrue(c.isDisposed());

            c.request(10);

            c.request(-10);


            

Reported by PMD.

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

Line: 43

              
            assertTrue(c.isDisposed());

            c.request(10);

            c.request(-10);

            Disposable d = Disposable.empty();


            

Reported by PMD.

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

Line: 45

              
            c.request(10);

            c.request(-10);

            Disposable d = Disposable.empty();

            c.onSubscribe(d);


            

Reported by PMD.

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

Line: 49

              
            Disposable d = Disposable.empty();

            c.onSubscribe(d);

            assertTrue(d.isDisposed());

            BooleanSubscription s = new BooleanSubscription();


            

Reported by PMD.

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

Line: 51

              
            c.onSubscribe(d);

            assertTrue(d.isDisposed());

            BooleanSubscription s = new BooleanSubscription();

            c.onSubscribe(s);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 51

              
            c.onSubscribe(d);

            assertTrue(d.isDisposed());

            BooleanSubscription s = new BooleanSubscription();

            c.onSubscribe(s);


            

Reported by PMD.

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

Line: 55

              
            BooleanSubscription s = new BooleanSubscription();

            c.onSubscribe(s);

            assertTrue(s.isCancelled());

            c.onNext(null);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 57

              
            c.onSubscribe(s);

            assertTrue(s.isCancelled());

            c.onNext(null);

            c.onNext(1);


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactoryTest.java
15 issues
JUnit tests should include assert() or fail()
Design

Line: 28

              public class SchedulerPoolFactoryTest extends RxJavaTest {

    @Test
    public void utilityClass() {
        TestHelper.checkUtilityClass(SchedulerPoolFactory.class);
    }

    @Test
    public void boolPropertiesDisabledReturnsDefaultDisabled() throws Throwable {

            

Reported by PMD.

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

Line: 33

                  }

    @Test
    public void boolPropertiesDisabledReturnsDefaultDisabled() throws Throwable {
        assertTrue(SchedulerPoolFactory.getBooleanProperty(false, "key", false, true, failingPropertiesAccessor));
        assertFalse(SchedulerPoolFactory.getBooleanProperty(false, "key", true, false, failingPropertiesAccessor));
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 34

              
    @Test
    public void boolPropertiesDisabledReturnsDefaultDisabled() throws Throwable {
        assertTrue(SchedulerPoolFactory.getBooleanProperty(false, "key", false, true, failingPropertiesAccessor));
        assertFalse(SchedulerPoolFactory.getBooleanProperty(false, "key", true, false, failingPropertiesAccessor));
    }

    @Test
    public void boolPropertiesEnabledMissingReturnsDefaultMissing() throws Throwable {

            

Reported by PMD.

The String literal 'key' appears 6 times in this file; the first occurrence is on line 34
Error

Line: 34

              
    @Test
    public void boolPropertiesDisabledReturnsDefaultDisabled() throws Throwable {
        assertTrue(SchedulerPoolFactory.getBooleanProperty(false, "key", false, true, failingPropertiesAccessor));
        assertFalse(SchedulerPoolFactory.getBooleanProperty(false, "key", true, false, failingPropertiesAccessor));
    }

    @Test
    public void boolPropertiesEnabledMissingReturnsDefaultMissing() throws Throwable {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 35

                  @Test
    public void boolPropertiesDisabledReturnsDefaultDisabled() throws Throwable {
        assertTrue(SchedulerPoolFactory.getBooleanProperty(false, "key", false, true, failingPropertiesAccessor));
        assertFalse(SchedulerPoolFactory.getBooleanProperty(false, "key", true, false, failingPropertiesAccessor));
    }

    @Test
    public void boolPropertiesEnabledMissingReturnsDefaultMissing() throws Throwable {
        assertTrue(SchedulerPoolFactory.getBooleanProperty(true, "key", true, false, missingPropertiesAccessor));

            

Reported by PMD.

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

Line: 39

                  }

    @Test
    public void boolPropertiesEnabledMissingReturnsDefaultMissing() throws Throwable {
        assertTrue(SchedulerPoolFactory.getBooleanProperty(true, "key", true, false, missingPropertiesAccessor));
        assertFalse(SchedulerPoolFactory.getBooleanProperty(true, "key", false, true, missingPropertiesAccessor));
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

              
    @Test
    public void boolPropertiesEnabledMissingReturnsDefaultMissing() throws Throwable {
        assertTrue(SchedulerPoolFactory.getBooleanProperty(true, "key", true, false, missingPropertiesAccessor));
        assertFalse(SchedulerPoolFactory.getBooleanProperty(true, "key", false, true, missingPropertiesAccessor));
    }

    @Test
    public void boolPropertiesFailureReturnsDefaultMissing() throws Throwable {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 41

                  @Test
    public void boolPropertiesEnabledMissingReturnsDefaultMissing() throws Throwable {
        assertTrue(SchedulerPoolFactory.getBooleanProperty(true, "key", true, false, missingPropertiesAccessor));
        assertFalse(SchedulerPoolFactory.getBooleanProperty(true, "key", false, true, missingPropertiesAccessor));
    }

    @Test
    public void boolPropertiesFailureReturnsDefaultMissing() throws Throwable {
        assertTrue(SchedulerPoolFactory.getBooleanProperty(true, "key", true, false, failingPropertiesAccessor));

            

Reported by PMD.

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

Line: 45

                  }

    @Test
    public void boolPropertiesFailureReturnsDefaultMissing() throws Throwable {
        assertTrue(SchedulerPoolFactory.getBooleanProperty(true, "key", true, false, failingPropertiesAccessor));
        assertFalse(SchedulerPoolFactory.getBooleanProperty(true, "key", false, true, failingPropertiesAccessor));
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 46

              
    @Test
    public void boolPropertiesFailureReturnsDefaultMissing() throws Throwable {
        assertTrue(SchedulerPoolFactory.getBooleanProperty(true, "key", true, false, failingPropertiesAccessor));
        assertFalse(SchedulerPoolFactory.getBooleanProperty(true, "key", false, true, failingPropertiesAccessor));
    }

    @Test
    public void boolPropertiesReturnsValue() throws Throwable {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDefaultIfEmptyTest.java
15 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 29

                  @Test
    public void defaultIfEmpty() {
        Observable<Integer> source = Observable.just(1, 2, 3);
        Observable<Integer> observable = source.defaultIfEmpty(10);

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

        observable.subscribe(observer);


            

Reported by PMD.

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

Line: 33

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

        observable.subscribe(observer);

        verify(observer, never()).onNext(10);
        verify(observer).onNext(1);
        verify(observer).onNext(2);
        verify(observer).onNext(3);

            

Reported by PMD.

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

Line: 35

              
        observable.subscribe(observer);

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

            

Reported by PMD.

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

Line: 36

                      observable.subscribe(observer);

        verify(observer, never()).onNext(10);
        verify(observer).onNext(1);
        verify(observer).onNext(2);
        verify(observer).onNext(3);
        verify(observer).onComplete();
        verify(observer, never()).onError(any(Throwable.class));
    }

            

Reported by PMD.

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

Line: 37

              
        verify(observer, never()).onNext(10);
        verify(observer).onNext(1);
        verify(observer).onNext(2);
        verify(observer).onNext(3);
        verify(observer).onComplete();
        verify(observer, never()).onError(any(Throwable.class));
    }


            

Reported by PMD.

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

Line: 38

                      verify(observer, never()).onNext(10);
        verify(observer).onNext(1);
        verify(observer).onNext(2);
        verify(observer).onNext(3);
        verify(observer).onComplete();
        verify(observer, never()).onError(any(Throwable.class));
    }

    @Test

            

Reported by PMD.

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

Line: 39

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

    @Test
    public void defaultIfEmptyWithEmpty() {

            

Reported by PMD.

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

Line: 40

                      verify(observer).onNext(2);
        verify(observer).onNext(3);
        verify(observer).onComplete();
        verify(observer, never()).onError(any(Throwable.class));
    }

    @Test
    public void defaultIfEmptyWithEmpty() {
        Observable<Integer> source = Observable.empty();

            

Reported by PMD.

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

Line: 46

                  @Test
    public void defaultIfEmptyWithEmpty() {
        Observable<Integer> source = Observable.empty();
        Observable<Integer> observable = source.defaultIfEmpty(10);

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

        observable.subscribe(observer);


            

Reported by PMD.

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

Line: 50

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

        observable.subscribe(observer);

        verify(observer).onNext(10);
        verify(observer).onComplete();
        verify(observer, never()).onError(any(Throwable.class));
    }

            

Reported by PMD.