The following issues were found

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

Line: 29

              
    private static final long serialVersionUID = -7789753024099756196L;

    final String prefix;

    final int priority;

    final boolean nonBlocking;


            

Reported by PMD.

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

Line: 31

              
    final String prefix;

    final int priority;

    final boolean nonBlocking;

//    static volatile boolean CREATE_TRACE;


            

Reported by PMD.

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

Line: 33

              
    final int priority;

    final boolean nonBlocking;

//    static volatile boolean CREATE_TRACE;

    public RxThreadFactory(String prefix) {
        this(prefix, Thread.NORM_PRIORITY, false);

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectPeriodicTask.java
3 issues
Assigning an Object to null is a code smell. Consider refactoring.
Error

Line: 36

                      runner = Thread.currentThread();
        try {
            runnable.run();
            runner = null;
        } catch (Throwable ex) {
            // Exceptions.throwIfFatal(ex); nowhere to go
            dispose();
            runner = null;
            RxJavaPlugins.onError(ex);

            

Reported by PMD.

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

Line: 37

                      try {
            runnable.run();
            runner = null;
        } catch (Throwable ex) {
            // Exceptions.throwIfFatal(ex); nowhere to go
            dispose();
            runner = null;
            RxJavaPlugins.onError(ex);
            throw ex;

            

Reported by PMD.

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

Line: 40

                      } catch (Throwable ex) {
            // Exceptions.throwIfFatal(ex); nowhere to go
            dispose();
            runner = null;
            RxJavaPlugins.onError(ex);
            throw ex;
        }
    }
}

            

Reported by PMD.

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

Line: 32

              @State(Scope.Thread)
public class ObservableFlatMapPerf {
    @Param({ "1", "10", "100", "1000", "10000", "100000", "1000000" })
    public int count;

    Observable<Integer> source;

    @Setup
    public void setup() {

            

Reported by PMD.

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

Line: 34

                  @Param({ "1", "10", "100", "1000", "10000", "100000", "1000000" })
    public int count;

    Observable<Integer> source;

    @Setup
    public void setup() {
        int d = 1000000 / count;


            

Reported by PMD.

Avoid unused imports such as 'org.openjdk.jmh.annotations'
Design

Line: 19

              import java.util.Arrays;
import java.util.concurrent.TimeUnit;

import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;

import io.reactivex.rxjava3.functions.Function;

@BenchmarkMode(Mode.Throughput)

            

Reported by PMD.

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

Line: 26

              
public final class FlowableOnBackpressureReduce<T> extends AbstractFlowableWithUpstream<T, T> {

    final BiFunction<T, T, T> reducer;

    public FlowableOnBackpressureReduce(@NonNull Flowable<T> source, @NonNull  BiFunction<T, T, T> reducer) {
        super(source);
        this.reducer = reducer;
    }

            

Reported by PMD.

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

Line: 42

              
        private static final long serialVersionUID = 821363947659780367L;

        final BiFunction<T, T, T> reducer;

        BackpressureReduceSubscriber(@NonNull Subscriber<? super T> downstream, @NonNull BiFunction<T, T, T> reducer) {
            super(downstream);
            this.reducer = reducer;
        }

            

Reported by PMD.

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

Line: 60

                          } else {
                try {
                    current.lazySet(Objects.requireNonNull(reducer.apply(v, t), "The reducer returned a null value"));
                } catch (Throwable ex) {
                    Exceptions.throwIfFatal(ex);
                    upstream.cancel();
                    onError(ex);
                    return;
                }

            

Reported by PMD.

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

Line: 23

              import io.reactivex.rxjava3.disposables.Disposable;

public final class LatchedSingleObserver<T> implements SingleObserver<T> {
    final CountDownLatch cdl;
    final Blackhole bh;
    public LatchedSingleObserver(Blackhole bh) {
        this.bh = bh;
        this.cdl = new CountDownLatch(1);
    }

            

Reported by PMD.

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

Line: 24

              
public final class LatchedSingleObserver<T> implements SingleObserver<T> {
    final CountDownLatch cdl;
    final Blackhole bh;
    public LatchedSingleObserver(Blackhole bh) {
        this.bh = bh;
        this.cdl = new CountDownLatch(1);
    }


            

Reported by PMD.

Avoid printStackTrace(); use a logger call instead.
Design

Line: 43

              
    @Override
    public void onError(Throwable e) {
        e.printStackTrace();
        cdl.countDown();
    }
}

            

Reported by PMD.

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

Line: 31

               */
public final class FlowableMapPublisher<T, U> extends Flowable<U> {

    final Publisher<T> source;

    final Function<? super T, ? extends U> mapper;
    public FlowableMapPublisher(Publisher<T> source, Function<? super T, ? extends U> mapper) {
        this.source = source;
        this.mapper = mapper;

            

Reported by PMD.

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

Line: 33

              
    final Publisher<T> source;

    final Function<? super T, ? extends U> mapper;
    public FlowableMapPublisher(Publisher<T> source, Function<? super T, ? extends U> mapper) {
        this.source = source;
        this.mapper = mapper;
    }


            

Reported by PMD.

Avoid unused imports such as 'org.reactivestreams'
Design

Line: 16

              
package io.reactivex.rxjava3.internal.operators.flowable;

import org.reactivestreams.*;

import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.operators.flowable.FlowableMap.MapSubscriber;


            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/subscriptions/ArrayCompositeSubscription.java
3 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 54

                          }
            if (compareAndSet(index, o, resource)) {
                if (o != null) {
                    o.cancel();
                }
                return true;
            }
        }
    }

            

Reported by PMD.

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

Line: 90

                              Subscription o = get(i);
                if (o != SubscriptionHelper.CANCELLED) {
                    o = getAndSet(i, SubscriptionHelper.CANCELLED);
                    if (o != SubscriptionHelper.CANCELLED && o != null) {
                        o.cancel();
                    }
                }
            }
        }

            

Reported by PMD.

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

Line: 91

                              if (o != SubscriptionHelper.CANCELLED) {
                    o = getAndSet(i, SubscriptionHelper.CANCELLED);
                    if (o != SubscriptionHelper.CANCELLED && o != null) {
                        o.cancel();
                    }
                }
            }
        }
    }

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallable.java
3 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 FlowableFromCallable<T> extends Flowable<T> implements Supplier<T> {
    final Callable<? extends T> callable;
    public FlowableFromCallable(Callable<? extends T> callable) {
        this.callable = callable;
    }

    @Override

            

Reported by PMD.

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

Line: 41

                      T t;
        try {
            t = Objects.requireNonNull(callable.call(), "The callable returned a null value");
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            if (deferred.isCancelled()) {
                RxJavaPlugins.onError(ex);
            } else {
                s.onError(ex);

            

Reported by PMD.

Found 'DU'-anomaly for variable 't' (lines '40'-'52').
Error

Line: 40

              
        T t;
        try {
            t = Objects.requireNonNull(callable.call(), "The callable returned a null value");
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            if (deferred.isCancelled()) {
                RxJavaPlugins.onError(ex);
            } else {

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayList.java
3 issues
This class has too many methods, consider refactoring it.
Design

Line: 27

               * @param <T> the element type
 * @since 2.0.7
 */
public final class VolatileSizeArrayList<T> extends AtomicInteger implements List<T>, RandomAccess {

    private static final long serialVersionUID = 3972397474470203923L;

    final ArrayList<T> list;


            

Reported by PMD.

Avoid using implementation types like 'ArrayList'; use the interface instead
Design

Line: 31

              
    private static final long serialVersionUID = 3972397474470203923L;

    final ArrayList<T> list;

    public VolatileSizeArrayList() {
        list = new ArrayList<>();
    }


            

Reported by PMD.

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

Line: 31

              
    private static final long serialVersionUID = 3972397474470203923L;

    final ArrayList<T> list;

    public VolatileSizeArrayList() {
        list = new ArrayList<>();
    }


            

Reported by PMD.

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

Line: 32

               */
public final class FlowableFromAction<T> extends Flowable<T> implements Supplier<T> {

    final Action action;

    public FlowableFromAction(Action action) {
        this.action = action;
    }


            

Reported by PMD.

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

Line: 47

              
            try {
                action.run();
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                if (!qs.isDisposed()) {
                    subscriber.onError(ex);
                } else {
                    RxJavaPlugins.onError(ex);

            

Reported by PMD.

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

Line: 20

              
import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.internal.fuseable.CancellableQueueFuseable;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;

/**
 * Executes an {@link Action} and signals its exception or completes normally.

            

Reported by PMD.