The following issues were found

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

Line: 30

               *
 */
public class NewThreadWorker extends Scheduler.Worker implements Disposable {
    private final ScheduledExecutorService executor;

    volatile boolean disposed;

    public NewThreadWorker(ThreadFactory threadFactory) {
        executor = SchedulerPoolFactory.create(threadFactory);

            

Reported by PMD.

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

Line: 32

              public class NewThreadWorker extends Scheduler.Worker implements Disposable {
    private final ScheduledExecutorService executor;

    volatile boolean disposed;

    public NewThreadWorker(ThreadFactory threadFactory) {
        executor = SchedulerPoolFactory.create(threadFactory);
    }


            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 65

                      ScheduledDirectTask task = new ScheduledDirectTask(RxJavaPlugins.onSchedule(run), true);
        try {
            Future<?> f;
            if (delayTime <= 0L) {
                f = executor.submit(task);
            } else {
                f = executor.schedule(task, delayTime, unit);
            }
            task.setFuture(f);

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 89

                   */
    public Disposable schedulePeriodicallyDirect(Runnable run, long initialDelay, long period, TimeUnit unit) {
        final Runnable decoratedRun = RxJavaPlugins.onSchedule(run);
        if (period <= 0L) {

            InstantPeriodicTask periodicWrapper = new InstantPeriodicTask(decoratedRun, executor);
            try {
                Future<?> f;
                if (initialDelay <= 0L) {

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 94

                          InstantPeriodicTask periodicWrapper = new InstantPeriodicTask(decoratedRun, executor);
            try {
                Future<?> f;
                if (initialDelay <= 0L) {
                    f = executor.submit(periodicWrapper);
                } else {
                    f = executor.schedule(periodicWrapper, initialDelay, unit);
                }
                periodicWrapper.setFirst(f);

            

Reported by PMD.

These nested if statements could be combined
Design

Line: 134

                      ScheduledRunnable sr = new ScheduledRunnable(decoratedRun, parent);

        if (parent != null) {
            if (!parent.add(sr)) {
                return sr;
            }
        }

        Future<?> f;

            

Reported by PMD.

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

Line: 18

              
import java.util.concurrent.*;

import io.reactivex.rxjava3.annotations.*;
import io.reactivex.rxjava3.core.Scheduler;
import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.internal.disposables.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;


            

Reported by PMD.

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

Line: 20

              
import io.reactivex.rxjava3.annotations.*;
import io.reactivex.rxjava3.core.Scheduler;
import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.internal.disposables.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;

/**
 * Base class that manages a single-threaded ScheduledExecutorService as a

            

Reported by PMD.

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

Line: 21

              import io.reactivex.rxjava3.annotations.*;
import io.reactivex.rxjava3.core.Scheduler;
import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.internal.disposables.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;

/**
 * Base class that manages a single-threaded ScheduledExecutorService as a
 * worker but doesn't perform task-tracking operations.

            

Reported by PMD.

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

Line: 29

               * @param <T> the upstream value type
 */
public final class MaybeFilterSingle<T> extends Maybe<T> {
    final SingleSource<T> source;

    final Predicate<? super T> predicate;

    public MaybeFilterSingle(SingleSource<T> source, Predicate<? super T> predicate) {
        this.source = source;

            

Reported by PMD.

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

Line: 31

              public final class MaybeFilterSingle<T> extends Maybe<T> {
    final SingleSource<T> source;

    final Predicate<? super T> predicate;

    public MaybeFilterSingle(SingleSource<T> source, Predicate<? super T> predicate) {
        this.source = source;
        this.predicate = predicate;
    }

            

Reported by PMD.

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

Line: 45

              
    static final class FilterMaybeObserver<T> implements SingleObserver<T>, Disposable {

        final MaybeObserver<? super T> downstream;

        final Predicate<? super T> predicate;

        Disposable upstream;


            

Reported by PMD.

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

Line: 47

              
        final MaybeObserver<? super T> downstream;

        final Predicate<? super T> predicate;

        Disposable upstream;

        FilterMaybeObserver(MaybeObserver<? super T> actual, Predicate<? super T> predicate) {
            this.downstream = actual;

            

Reported by PMD.

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

Line: 49

              
        final Predicate<? super T> predicate;

        Disposable upstream;

        FilterMaybeObserver(MaybeObserver<? super T> actual, Predicate<? super T> predicate) {
            this.downstream = actual;
            this.predicate = predicate;
        }

            

Reported by PMD.

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

Line: 60

                      public void dispose() {
            Disposable d = this.upstream;
            this.upstream = DisposableHelper.DISPOSED;
            d.dispose();
        }

        @Override
        public boolean isDisposed() {
            return upstream.isDisposed();

            

Reported by PMD.

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

Line: 83

              
            try {
                b = predicate.test(value);
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                downstream.onError(ex);
                return;
            }


            

Reported by PMD.

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

Line: 16

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

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Predicate;
import io.reactivex.rxjava3.internal.disposables.DisposableHelper;


            

Reported by PMD.

Found 'DU'-anomaly for variable 'b' (lines '82'-'94').
Error

Line: 82

                          boolean b;

            try {
                b = predicate.test(value);
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                downstream.onError(ex);
                return;
            }

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableConditionalSubscriber.java
9 issues
This class has too many methods, consider refactoring it.
Design

Line: 28

               * @param <T> the upstream value type
 * @param <R> the downstream value type
 */
public abstract class BasicFuseableConditionalSubscriber<T, R> implements ConditionalSubscriber<T>, QueueSubscription<R> {

    /** The downstream subscriber. */
    protected final ConditionalSubscriber<? super R> downstream;

    /** The upstream subscription. */

            

Reported by PMD.

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

Line: 31

              public abstract class BasicFuseableConditionalSubscriber<T, R> implements ConditionalSubscriber<T>, QueueSubscription<R> {

    /** The downstream subscriber. */
    protected final ConditionalSubscriber<? super R> downstream;

    /** The upstream subscription. */
    protected Subscription upstream;

    /** The upstream's QueueSubscription if not null. */

            

Reported by PMD.

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

Line: 34

                  protected final ConditionalSubscriber<? super R> downstream;

    /** The upstream subscription. */
    protected Subscription upstream;

    /** The upstream's QueueSubscription if not null. */
    protected QueueSubscription<T> qs;

    /** Flag indicating no further onXXX event should be accepted. */

            

Reported by PMD.

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

Line: 37

                  protected Subscription upstream;

    /** The upstream's QueueSubscription if not null. */
    protected QueueSubscription<T> qs;

    /** Flag indicating no further onXXX event should be accepted. */
    protected boolean done;

    /** Holds the established fusion mode of the upstream. */

            

Reported by PMD.

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

Line: 40

                  protected QueueSubscription<T> qs;

    /** Flag indicating no further onXXX event should be accepted. */
    protected boolean done;

    /** Holds the established fusion mode of the upstream. */
    protected int sourceMode;

    /**

            

Reported by PMD.

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

Line: 43

                  protected boolean done;

    /** Holds the established fusion mode of the upstream. */
    protected int sourceMode;

    /**
     * Construct a BasicFuseableSubscriber by wrapping the given subscriber.
     * @param downstream the subscriber, not null (not verified)
     */

            

Reported by PMD.

These nested if statements could be combined
Design

Line: 135

                  protected final int transitiveBoundaryFusion(int mode) {
        QueueSubscription<T> qs = this.qs;
        if (qs != null) {
            if ((mode & BOUNDARY) == 0) {
                int m = qs.requestFusion(mode);
                if (m != NONE) {
                    sourceMode = m;
                }
                return m;

            

Reported by PMD.

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

Line: 137

                      if (qs != null) {
            if ((mode & BOUNDARY) == 0) {
                int m = qs.requestFusion(mode);
                if (m != NONE) {
                    sourceMode = m;
                }
                return m;
            }
        }

            

Reported by PMD.

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

Line: 19

              import org.reactivestreams.Subscription;

import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.internal.fuseable.*;
import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;

/**
 * Base class for a fuseable intermediate subscriber.

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingle.java
9 issues
Field source has the same name as a method
Error

Line: 30

               */
public final class MaybeSwitchIfEmptySingle<T> extends Single<T> implements HasUpstreamMaybeSource<T> {

    final MaybeSource<T> source;
    final SingleSource<? extends T> other;

    public MaybeSwitchIfEmptySingle(MaybeSource<T> source, SingleSource<? extends T> other) {
        this.source = source;
        this.other = other;

            

Reported by PMD.

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

Line: 30

               */
public final class MaybeSwitchIfEmptySingle<T> extends Single<T> implements HasUpstreamMaybeSource<T> {

    final MaybeSource<T> source;
    final SingleSource<? extends T> other;

    public MaybeSwitchIfEmptySingle(MaybeSource<T> source, SingleSource<? extends T> other) {
        this.source = source;
        this.other = other;

            

Reported by PMD.

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

Line: 31

              public final class MaybeSwitchIfEmptySingle<T> extends Single<T> implements HasUpstreamMaybeSource<T> {

    final MaybeSource<T> source;
    final SingleSource<? extends T> other;

    public MaybeSwitchIfEmptySingle(MaybeSource<T> source, SingleSource<? extends T> other) {
        this.source = source;
        this.other = other;
    }

            

Reported by PMD.

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

Line: 54

              
        private static final long serialVersionUID = 4603919676453758899L;

        final SingleObserver<? super T> downstream;

        final SingleSource<? extends T> other;

        SwitchIfEmptyMaybeObserver(SingleObserver<? super T> actual, SingleSource<? extends T> other) {
            this.downstream = actual;

            

Reported by PMD.

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

Line: 56

              
        final SingleObserver<? super T> downstream;

        final SingleSource<? extends T> other;

        SwitchIfEmptyMaybeObserver(SingleObserver<? super T> actual, SingleSource<? extends T> other) {
            this.downstream = actual;
            this.other = other;
        }

            

Reported by PMD.

These nested if statements could be combined
Design

Line: 94

                      public void onComplete() {
            Disposable d = get();
            if (d != DisposableHelper.DISPOSED) {
                if (compareAndSet(d, null)) {
                    other.subscribe(new OtherSingleObserver<T>(downstream, this));
                }
            }
        }


            

Reported by PMD.

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

Line: 102

              
        static final class OtherSingleObserver<T> implements SingleObserver<T> {

            final SingleObserver<? super T> downstream;

            final AtomicReference<Disposable> parent;
            OtherSingleObserver(SingleObserver<? super T> actual, AtomicReference<Disposable> parent) {
                this.downstream = actual;
                this.parent = parent;

            

Reported by PMD.

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

Line: 104

              
            final SingleObserver<? super T> downstream;

            final AtomicReference<Disposable> parent;
            OtherSingleObserver(SingleObserver<? super T> actual, AtomicReference<Disposable> parent) {
                this.downstream = actual;
                this.parent = parent;
            }


            

Reported by PMD.

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

Line: 18

              
import java.util.concurrent.atomic.AtomicReference;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.internal.disposables.DisposableHelper;
import io.reactivex.rxjava3.internal.fuseable.HasUpstreamMaybeSource;

/**

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAny.java
9 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 FlowableAny<T> extends AbstractFlowableWithUpstream<T, Boolean> {
    final Predicate<? super T> predicate;
    public FlowableAny(Flowable<T> source, Predicate<? super T> predicate) {
        super(source);
        this.predicate = predicate;
    }


            

Reported by PMD.

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

Line: 40

              
        private static final long serialVersionUID = -2311252482644620661L;

        final Predicate<? super T> predicate;

        Subscription upstream;

        boolean done;


            

Reported by PMD.

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

Line: 42

              
        final Predicate<? super T> predicate;

        Subscription upstream;

        boolean done;

        AnySubscriber(Subscriber<? super Boolean> actual, Predicate<? super T> predicate) {
            super(actual);

            

Reported by PMD.

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

Line: 44

              
        Subscription upstream;

        boolean done;

        AnySubscriber(Subscriber<? super Boolean> actual, Predicate<? super T> predicate) {
            super(actual);
            this.predicate = predicate;
        }

            

Reported by PMD.

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

Line: 68

                          boolean b;
            try {
                b = predicate.test(t);
            } catch (Throwable e) {
                Exceptions.throwIfFatal(e);
                upstream.cancel();
                onError(e);
                return;
            }

            

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.*;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Predicate;
import io.reactivex.rxjava3.internal.subscriptions.*;

            

Reported by PMD.

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

Line: 18

              
import org.reactivestreams.*;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Predicate;
import io.reactivex.rxjava3.internal.subscriptions.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;


            

Reported by PMD.

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

Line: 21

              import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Predicate;
import io.reactivex.rxjava3.internal.subscriptions.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;

public final class FlowableAny<T> extends AbstractFlowableWithUpstream<T, Boolean> {
    final Predicate<? super T> predicate;
    public FlowableAny(Flowable<T> source, Predicate<? super T> predicate) {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'b' (lines '67'-'79').
Error

Line: 67

                          }
            boolean b;
            try {
                b = predicate.test(t);
            } catch (Throwable e) {
                Exceptions.throwIfFatal(e);
                upstream.cancel();
                onError(e);
                return;

            

Reported by PMD.

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

Line: 33

               */
public final class MaybeTimeoutMaybe<T, U> extends AbstractMaybeWithUpstream<T, T> {

    final MaybeSource<U> other;

    final MaybeSource<? extends T> fallback;

    public MaybeTimeoutMaybe(MaybeSource<T> source, MaybeSource<U> other, MaybeSource<? extends T> fallback) {
        super(source);

            

Reported by PMD.

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

Line: 35

              
    final MaybeSource<U> other;

    final MaybeSource<? extends T> fallback;

    public MaybeTimeoutMaybe(MaybeSource<T> source, MaybeSource<U> other, MaybeSource<? extends T> fallback) {
        super(source);
        this.other = other;
        this.fallback = fallback;

            

Reported by PMD.

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

Line: 59

              
        private static final long serialVersionUID = -5955289211445418871L;

        final MaybeObserver<? super T> downstream;

        final TimeoutOtherMaybeObserver<T, U> other;

        final MaybeSource<? extends T> fallback;


            

Reported by PMD.

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

Line: 61

              
        final MaybeObserver<? super T> downstream;

        final TimeoutOtherMaybeObserver<T, U> other;

        final MaybeSource<? extends T> fallback;

        final TimeoutFallbackMaybeObserver<T> otherObserver;


            

Reported by PMD.

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

Line: 63

              
        final TimeoutOtherMaybeObserver<T, U> other;

        final MaybeSource<? extends T> fallback;

        final TimeoutFallbackMaybeObserver<T> otherObserver;

        TimeoutMainMaybeObserver(MaybeObserver<? super T> actual, MaybeSource<? extends T> fallback) {
            this.downstream = actual;

            

Reported by PMD.

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

Line: 65

              
        final MaybeSource<? extends T> fallback;

        final TimeoutFallbackMaybeObserver<T> otherObserver;

        TimeoutMainMaybeObserver(MaybeObserver<? super T> actual, MaybeSource<? extends T> fallback) {
            this.downstream = actual;
            this.other = new TimeoutOtherMaybeObserver<>(this);
            this.fallback = fallback;

            

Reported by PMD.

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

Line: 145

              
        private static final long serialVersionUID = 8663801314800248617L;

        final TimeoutMainMaybeObserver<T, U> parent;

        TimeoutOtherMaybeObserver(TimeoutMainMaybeObserver<T, U> parent) {
            this.parent = parent;
        }


            

Reported by PMD.

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

Line: 177

              
        private static final long serialVersionUID = 8663801314800248617L;

        final MaybeObserver<? super T> downstream;

        TimeoutFallbackMaybeObserver(MaybeObserver<? super T> downstream) {
            this.downstream = downstream;
        }


            

Reported by PMD.

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

Line: 19

              import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.internal.disposables.DisposableHelper;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;

/**

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCreate.java
9 issues
Avoid reassigning parameters such as 't'
Design

Line: 87

                      }

        @Override
        public boolean tryOnError(Throwable t) {
            if (t == null) {
                t = ExceptionHelper.createNullPointerException("onError called with a null Throwable.");
            }
            if (get() != DisposableHelper.DISPOSED) {
                Disposable d = getAndSet(DisposableHelper.DISPOSED);

            

Reported by PMD.

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

Line: 28

              
public final class SingleCreate<T> extends Single<T> {

    final SingleOnSubscribe<T> source;

    public SingleCreate(SingleOnSubscribe<T> source) {
        this.source = source;
    }


            

Reported by PMD.

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

Line: 41

              
        try {
            source.subscribe(parent);
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            parent.onError(ex);
        }
    }


            

Reported by PMD.

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

Line: 53

              
        private static final long serialVersionUID = -2467358622224974244L;

        final SingleObserver<? super T> downstream;

        Emitter(SingleObserver<? super T> downstream) {
            this.downstream = downstream;
        }


            

Reported by PMD.

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

Line: 72

                                      }
                    } finally {
                        if (d != null) {
                            d.dispose();
                        }
                    }
                }
            }
        }

            

Reported by PMD.

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

Line: 98

                                      downstream.onError(t);
                    } finally {
                        if (d != null) {
                            d.dispose();
                        }
                    }
                    return true;
                }
            }

            

Reported by PMD.

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

Line: 129

              
        @Override
        public String toString() {
            return String.format("%s{%s}", getClass().getSimpleName(), super.toString());
        }
    }
}

            

Reported by PMD.

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

Line: 18

              
import java.util.concurrent.atomic.AtomicReference;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Cancellable;
import io.reactivex.rxjava3.internal.disposables.*;
import io.reactivex.rxjava3.internal.util.ExceptionHelper;

            

Reported by PMD.

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

Line: 22

              import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Cancellable;
import io.reactivex.rxjava3.internal.disposables.*;
import io.reactivex.rxjava3.internal.util.ExceptionHelper;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;

public final class SingleCreate<T> extends Single<T> {


            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableSubscriber.java
9 issues
This class has too many methods, consider refactoring it.
Design

Line: 29

               * @param <T> the upstream value type
 * @param <R> the downstream value type
 */
public abstract class BasicFuseableSubscriber<T, R> implements FlowableSubscriber<T>, QueueSubscription<R> {

    /** The downstream subscriber. */
    protected final Subscriber<? super R> downstream;

    /** The upstream subscription. */

            

Reported by PMD.

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

Line: 32

              public abstract class BasicFuseableSubscriber<T, R> implements FlowableSubscriber<T>, QueueSubscription<R> {

    /** The downstream subscriber. */
    protected final Subscriber<? super R> downstream;

    /** The upstream subscription. */
    protected Subscription upstream;

    /** The upstream's QueueSubscription if not null. */

            

Reported by PMD.

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

Line: 35

                  protected final Subscriber<? super R> downstream;

    /** The upstream subscription. */
    protected Subscription upstream;

    /** The upstream's QueueSubscription if not null. */
    protected QueueSubscription<T> qs;

    /** Flag indicating no further onXXX event should be accepted. */

            

Reported by PMD.

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

Line: 38

                  protected Subscription upstream;

    /** The upstream's QueueSubscription if not null. */
    protected QueueSubscription<T> qs;

    /** Flag indicating no further onXXX event should be accepted. */
    protected boolean done;

    /** Holds the established fusion mode of the upstream. */

            

Reported by PMD.

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

Line: 41

                  protected QueueSubscription<T> qs;

    /** Flag indicating no further onXXX event should be accepted. */
    protected boolean done;

    /** Holds the established fusion mode of the upstream. */
    protected int sourceMode;

    /**

            

Reported by PMD.

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

Line: 44

                  protected boolean done;

    /** Holds the established fusion mode of the upstream. */
    protected int sourceMode;

    /**
     * Construct a BasicFuseableSubscriber by wrapping the given subscriber.
     * @param downstream the subscriber, not null (not verified)
     */

            

Reported by PMD.

These nested if statements could be combined
Design

Line: 136

                  protected final int transitiveBoundaryFusion(int mode) {
        QueueSubscription<T> qs = this.qs;
        if (qs != null) {
            if ((mode & BOUNDARY) == 0) {
                int m = qs.requestFusion(mode);
                if (m != NONE) {
                    sourceMode = m;
                }
                return m;

            

Reported by PMD.

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

Line: 138

                      if (qs != null) {
            if ((mode & BOUNDARY) == 0) {
                int m = qs.requestFusion(mode);
                if (m != NONE) {
                    sourceMode = m;
                }
                return m;
            }
        }

            

Reported by PMD.

Avoid unused imports such as 'org.reactivestreams'
Design

Line: 16

              
package io.reactivex.rxjava3.internal.subscribers;

import org.reactivestreams.*;

import io.reactivex.rxjava3.core.FlowableSubscriber;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.internal.fuseable.QueueSubscription;
import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper;

            

Reported by PMD.

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

Line: 34

               */
public final class MaybeFlatMapSingle<T, R> extends Maybe<R> {

    final MaybeSource<T> source;

    final Function<? super T, ? extends SingleSource<? extends R>> mapper;

    public MaybeFlatMapSingle(MaybeSource<T> source, Function<? super T, ? extends SingleSource<? extends R>> mapper) {
        this.source = source;

            

Reported by PMD.

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

Line: 36

              
    final MaybeSource<T> source;

    final Function<? super T, ? extends SingleSource<? extends R>> mapper;

    public MaybeFlatMapSingle(MaybeSource<T> source, Function<? super T, ? extends SingleSource<? extends R>> 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: 54

              
        private static final long serialVersionUID = 4827726964688405508L;

        final MaybeObserver<? super R> downstream;

        final Function<? super T, ? extends SingleSource<? extends R>> mapper;

        FlatMapMaybeObserver(MaybeObserver<? super R> actual, Function<? super T, ? extends SingleSource<? extends R>> mapper) {
            this.downstream = actual;

            

Reported by PMD.

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

Line: 56

              
        final MaybeObserver<? super R> downstream;

        final Function<? super T, ? extends SingleSource<? extends R>> mapper;

        FlatMapMaybeObserver(MaybeObserver<? super R> actual, Function<? super T, ? extends SingleSource<? extends R>> mapper) {
            this.downstream = actual;
            this.mapper = mapper;
        }

            

Reported by PMD.

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

Line: 86

              
            try {
                ss = Objects.requireNonNull(mapper.apply(value), "The mapper returned a null SingleSource");
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                onError(ex);
                return;
            }


            

Reported by PMD.

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

Line: 110

              
    static final class FlatMapSingleObserver<R> implements SingleObserver<R> {

        final AtomicReference<Disposable> parent;

        final MaybeObserver<? super R> downstream;

        FlatMapSingleObserver(AtomicReference<Disposable> parent, MaybeObserver<? super R> downstream) {
            this.parent = parent;

            

Reported by PMD.

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

Line: 112

              
        final AtomicReference<Disposable> parent;

        final MaybeObserver<? super R> downstream;

        FlatMapSingleObserver(AtomicReference<Disposable> parent, MaybeObserver<? super R> downstream) {
            this.parent = parent;
            this.downstream = downstream;
        }

            

Reported by PMD.

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

Line: 19

              import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.disposables.DisposableHelper;


            

Reported by PMD.

Found 'DU'-anomaly for variable 'ss' (lines '85'-'95').
Error

Line: 85

                          SingleSource<? extends R> ss;

            try {
                ss = Objects.requireNonNull(mapper.apply(value), "The mapper returned a null SingleSource");
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                onError(ex);
                return;
            }

            

Reported by PMD.

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

Line: 36

              
    private static final long serialVersionUID = -5417183359794346637L;

    final InnerQueuedObserverSupport<T> parent;

    final int prefetch;

    SimpleQueue<T> queue;


            

Reported by PMD.

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

Line: 38

              
    final InnerQueuedObserverSupport<T> parent;

    final int prefetch;

    SimpleQueue<T> queue;

    volatile boolean done;


            

Reported by PMD.

Field queue has the same name as a method
Error

Line: 40

              
    final int prefetch;

    SimpleQueue<T> queue;

    volatile boolean done;

    int fusionMode;


            

Reported by PMD.

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

Line: 40

              
    final int prefetch;

    SimpleQueue<T> queue;

    volatile boolean done;

    int fusionMode;


            

Reported by PMD.

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

Line: 44

              
    volatile boolean done;

    int fusionMode;

    public InnerQueuedObserver(InnerQueuedObserverSupport<T> parent, int prefetch) {
        this.parent = parent;
        this.prefetch = prefetch;
    }

            

Reported by PMD.

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

Line: 58

                              @SuppressWarnings("unchecked")
                QueueDisposable<T> qd = (QueueDisposable<T>) d;

                int m = qd.requestFusion(QueueDisposable.ANY);
                if (m == QueueSubscription.SYNC) {
                    fusionMode = m;
                    queue = qd;
                    done = true;
                    parent.innerComplete(this);

            

Reported by PMD.

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

Line: 59

                              QueueDisposable<T> qd = (QueueDisposable<T>) d;

                int m = qd.requestFusion(QueueDisposable.ANY);
                if (m == QueueSubscription.SYNC) {
                    fusionMode = m;
                    queue = qd;
                    done = true;
                    parent.innerComplete(this);
                    return;

            

Reported by PMD.

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

Line: 66

                                  parent.innerComplete(this);
                    return;
                }
                if (m == QueueDisposable.ASYNC) {
                    fusionMode = m;
                    queue = qd;
                    return;
                }
            }

            

Reported by PMD.

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

Line: 21

              import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.internal.disposables.DisposableHelper;
import io.reactivex.rxjava3.internal.fuseable.*;
import io.reactivex.rxjava3.internal.util.QueueDrainHelper;

/**
 * Subscriber that can fuse with the upstream and calls a support interface
 * whenever an event is available.

            

Reported by PMD.