The following issues were found

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

Line: 41

               */
public final class FlowableCollectWithCollectorSingle<T, A, R> extends Single<R> implements FuseToFlowable<R> {

    final Flowable<T> source;

    final Collector<? super T, A, R> collector;

    public FlowableCollectWithCollectorSingle(Flowable<T> source, Collector<? super T, A, R> collector) {
        this.source = source;

            

Reported by PMD.

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

Line: 43

              
    final Flowable<T> source;

    final Collector<? super T, A, R> collector;

    public FlowableCollectWithCollectorSingle(Flowable<T> source, Collector<? super T, A, R> collector) {
        this.source = source;
        this.collector = collector;
    }

            

Reported by PMD.

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

Line: 62

                      Function<A, R> finisher;

        try {
            container = collector.supplier().get();
            accumulator = collector.accumulator();
            finisher = collector.finisher();
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            EmptyDisposable.error(ex, observer);

            

Reported by PMD.

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

Line: 65

                          container = collector.supplier().get();
            accumulator = collector.accumulator();
            finisher = collector.finisher();
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            EmptyDisposable.error(ex, observer);
            return;
        }


            

Reported by PMD.

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

Line: 76

              
    static final class CollectorSingleObserver<T, A, R> implements FlowableSubscriber<T>, Disposable {

        final SingleObserver<? super R> downstream;

        final BiConsumer<A, T> accumulator;

        final Function<A, R> finisher;


            

Reported by PMD.

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

Line: 78

              
        final SingleObserver<? super R> downstream;

        final BiConsumer<A, T> accumulator;

        final Function<A, R> finisher;

        Subscription upstream;


            

Reported by PMD.

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

Line: 80

              
        final BiConsumer<A, T> accumulator;

        final Function<A, R> finisher;

        Subscription upstream;

        boolean done;


            

Reported by PMD.

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

Line: 82

              
        final Function<A, R> finisher;

        Subscription upstream;

        boolean done;

        A container;


            

Reported by PMD.

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

Line: 84

              
        Subscription upstream;

        boolean done;

        A container;

        CollectorSingleObserver(SingleObserver<? super R> downstream, A container, BiConsumer<A, T> accumulator, Function<A, R> finisher) {
            this.downstream = downstream;

            

Reported by PMD.

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

Line: 86

              
        boolean done;

        A container;

        CollectorSingleObserver(SingleObserver<? super R> downstream, A container, BiConsumer<A, T> accumulator, Function<A, R> finisher) {
            this.downstream = downstream;
            this.container = container;
            this.accumulator = accumulator;

            

Reported by PMD.

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

Line: 31

               */
public final class SingleScheduler extends Scheduler {

    final ThreadFactory threadFactory;
    final AtomicReference<ScheduledExecutorService> executor = new AtomicReference<>();

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


            

Reported by PMD.

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

Line: 32

              public final class SingleScheduler extends Scheduler {

    final ThreadFactory threadFactory;
    final AtomicReference<ScheduledExecutorService> executor = new AtomicReference<>();

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

    private static final String THREAD_NAME_PREFIX = "RxSingleScheduler";

            

Reported by PMD.

Field SHUTDOWN has the same name as a method
Error

Line: 41

              
    static final RxThreadFactory SINGLE_THREAD_FACTORY;

    static final ScheduledExecutorService SHUTDOWN;
    static {
        SHUTDOWN = Executors.newScheduledThreadPool(0);
        SHUTDOWN.shutdown();

        int priority = Math.max(Thread.MIN_PRIORITY, Math.min(Thread.MAX_PRIORITY,

            

Reported by PMD.

Use equals() to compare object references.
Error

Line: 76

                      ScheduledExecutorService next = null;
        for (;;) {
            ScheduledExecutorService current = executor.get();
            if (current != SHUTDOWN) {
                if (next != null) {
                    next.shutdown();
                }
                return;
            }

            

Reported by PMD.

Use equals() to compare object references.
Error

Line: 95

                  @Override
    public void shutdown() {
        ScheduledExecutorService current =  executor.getAndSet(SHUTDOWN);
        if (current != SHUTDOWN) {
            current.shutdownNow();
        }
    }

    @NonNull

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 112

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

            

Reported by PMD.

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

Line: 113

                      try {
            Future<?> f;
            if (delay <= 0L) {
                f = executor.get().submit(task);
            } else {
                f = executor.get().schedule(task, delay, unit);
            }
            task.setFuture(f);
            return task;

            

Reported by PMD.

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

Line: 115

                          if (delay <= 0L) {
                f = executor.get().submit(task);
            } else {
                f = executor.get().schedule(task, delay, unit);
            }
            task.setFuture(f);
            return task;
        } catch (RejectedExecutionException ex) {
            RxJavaPlugins.onError(ex);

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 129

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

            ScheduledExecutorService exec = executor.get();

            InstantPeriodicTask periodicWrapper = new InstantPeriodicTask(decoratedRun, exec);
            Future<?> f;

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 136

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

            

Reported by PMD.

src/jmh/java/io/reactivex/rxjava3/core/EachTypeFlatMapPerf.java
19 issues
The class 'EachTypeFlatMapPerf' is suspected to be a Data Class (WOC=11.111%, NOPA=1, NOAM=8, WMC=9)
Design

Line: 30

              @OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class EachTypeFlatMapPerf {
    @Param({ "1", "1000", "1000000" })
    public int times;

    Flowable<Integer> bpRange;
    Observable<Integer> nbpRange;

            

Reported by PMD.

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

Line: 32

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

    Flowable<Integer> bpRange;
    Observable<Integer> nbpRange;
    Single<Integer> singleJust;


            

Reported by PMD.

Field bpRange has the same name as a method
Error

Line: 34

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

    Flowable<Integer> bpRange;
    Observable<Integer> nbpRange;
    Single<Integer> singleJust;

    Flowable<Integer> bpRangeMapJust;
    Observable<Integer> nbpRangeMapJust;

            

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> bpRange;
    Observable<Integer> nbpRange;
    Single<Integer> singleJust;

    Flowable<Integer> bpRangeMapJust;
    Observable<Integer> nbpRangeMapJust;

            

Reported by PMD.

Field nbpRange has the same name as a method
Error

Line: 35

                  public int times;

    Flowable<Integer> bpRange;
    Observable<Integer> nbpRange;
    Single<Integer> singleJust;

    Flowable<Integer> bpRangeMapJust;
    Observable<Integer> nbpRangeMapJust;
    Single<Integer> singleJustMapJust;

            

Reported by PMD.

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

Line: 35

                  public int times;

    Flowable<Integer> bpRange;
    Observable<Integer> nbpRange;
    Single<Integer> singleJust;

    Flowable<Integer> bpRangeMapJust;
    Observable<Integer> nbpRangeMapJust;
    Single<Integer> singleJustMapJust;

            

Reported by PMD.

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

Line: 36

              
    Flowable<Integer> bpRange;
    Observable<Integer> nbpRange;
    Single<Integer> singleJust;

    Flowable<Integer> bpRangeMapJust;
    Observable<Integer> nbpRangeMapJust;
    Single<Integer> singleJustMapJust;


            

Reported by PMD.

Field singleJust has the same name as a method
Error

Line: 36

              
    Flowable<Integer> bpRange;
    Observable<Integer> nbpRange;
    Single<Integer> singleJust;

    Flowable<Integer> bpRangeMapJust;
    Observable<Integer> nbpRangeMapJust;
    Single<Integer> singleJustMapJust;


            

Reported by PMD.

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

Line: 38

                  Observable<Integer> nbpRange;
    Single<Integer> singleJust;

    Flowable<Integer> bpRangeMapJust;
    Observable<Integer> nbpRangeMapJust;
    Single<Integer> singleJustMapJust;

    Flowable<Integer> bpRangeMapRange;
    Observable<Integer> nbpRangeMapRange;

            

Reported by PMD.

Field bpRangeMapJust has the same name as a method
Error

Line: 38

                  Observable<Integer> nbpRange;
    Single<Integer> singleJust;

    Flowable<Integer> bpRangeMapJust;
    Observable<Integer> nbpRangeMapJust;
    Single<Integer> singleJustMapJust;

    Flowable<Integer> bpRangeMapRange;
    Observable<Integer> nbpRangeMapRange;

            

Reported by PMD.

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

Line: 38

               */
public final class ObservableCollectWithCollector<T, A, R> extends Observable<R> {

    final Observable<T> source;

    final Collector<? super T, A, R> collector;

    public ObservableCollectWithCollector(Observable<T> source, Collector<? super T, A, R> collector) {
        this.source = source;

            

Reported by PMD.

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

Line: 40

              
    final Observable<T> source;

    final Collector<? super T, A, R> collector;

    public ObservableCollectWithCollector(Observable<T> source, Collector<? super T, A, R> collector) {
        this.source = source;
        this.collector = collector;
    }

            

Reported by PMD.

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

Line: 54

                      Function<A, R> finisher;

        try {
            container = collector.supplier().get();
            accumulator = collector.accumulator();
            finisher = collector.finisher();
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            EmptyDisposable.error(ex, observer);

            

Reported by PMD.

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

Line: 57

                          container = collector.supplier().get();
            accumulator = collector.accumulator();
            finisher = collector.finisher();
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            EmptyDisposable.error(ex, observer);
            return;
        }


            

Reported by PMD.

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

Line: 72

              
        private static final long serialVersionUID = -229544830565448758L;

        final BiConsumer<A, T> accumulator;

        final Function<A, R> finisher;

        Disposable upstream;


            

Reported by PMD.

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

Line: 74

              
        final BiConsumer<A, T> accumulator;

        final Function<A, R> finisher;

        Disposable upstream;

        boolean done;


            

Reported by PMD.

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

Line: 76

              
        final Function<A, R> finisher;

        Disposable upstream;

        boolean done;

        A container;


            

Reported by PMD.

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

Line: 78

              
        Disposable upstream;

        boolean done;

        A container;

        CollectorObserver(Observer<? super R> downstream, A container, BiConsumer<A, T> accumulator, Function<A, R> finisher) {
            super(downstream);

            

Reported by PMD.

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

Line: 80

              
        boolean done;

        A container;

        CollectorObserver(Observer<? super R> downstream, A container, BiConsumer<A, T> accumulator, Function<A, R> finisher) {
            super(downstream);
            this.container = container;
            this.accumulator = accumulator;

            

Reported by PMD.

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

Line: 105

                          }
            try {
                accumulator.accept(container, t);
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                upstream.dispose();
                onError(ex);
            }
        }

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/observers/SafeObserver.java
19 issues
Avoid reassigning parameters such as 't'
Design

Line: 139

                  }

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

            

Reported by PMD.

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

Line: 32

               */
public final class SafeObserver<T> implements Observer<T>, Disposable {
    /** The actual Subscriber. */
    final Observer<? super T> downstream;
    /** The subscription. */
    Disposable upstream;
    /** Indicates a terminal state. */
    boolean done;


            

Reported by PMD.

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

Line: 34

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

    /**
     * Constructs a {@code SafeObserver} by wrapping the given actual {@link Observer}.

            

Reported by PMD.

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

Line: 36

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

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

            

Reported by PMD.

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

Line: 52

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

            

Reported by PMD.

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

Line: 58

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

            

Reported by PMD.

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

Line: 92

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

            

Reported by PMD.

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

Line: 103

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

            

Reported by PMD.

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

Line: 107

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

            

Reported by PMD.

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

Line: 123

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

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/observable/ObservableCombineLatestTests.java
19 issues
System.out.println is used
Design

Line: 50

                  Consumer<Result> action = new Consumer<Result>() {
        @Override
        public void accept(Result t1) {
            System.out.println("Result: " + t1);
        }
    };

    Consumer<ExtendedResult> extendedAction = new Consumer<ExtendedResult>() {
        @Override

            

Reported by PMD.

System.out.println is used
Design

Line: 57

                  Consumer<ExtendedResult> extendedAction = new Consumer<ExtendedResult>() {
        @Override
        public void accept(ExtendedResult t1) {
            System.out.println("Result: " + t1);
        }
    };
}

            

Reported by PMD.

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

Line: 27

                   * This won't compile if super/extends isn't done correctly on generics.
     */
    @Test
    public void covarianceOfCombineLatest() {
        Observable<HorrorMovie> horrors = Observable.just(new HorrorMovie());
        Observable<CoolRating> ratings = Observable.just(new CoolRating());

        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);

            

Reported by PMD.

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

Line: 31

                      Observable<HorrorMovie> horrors = Observable.just(new HorrorMovie());
        Observable<CoolRating> ratings = Observable.just(new CoolRating());

        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Observable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);


            

Reported by PMD.

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

Line: 31

                      Observable<HorrorMovie> horrors = Observable.just(new HorrorMovie());
        Observable<CoolRating> ratings = Observable.just(new CoolRating());

        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Observable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);


            

Reported by PMD.

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

Line: 32

                      Observable<CoolRating> ratings = Observable.just(new CoolRating());

        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Observable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);

        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine);

            

Reported by PMD.

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

Line: 32

                      Observable<CoolRating> ratings = Observable.just(new CoolRating());

        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Observable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);

        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine);

            

Reported by PMD.

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

Line: 33

              
        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Observable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);

        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine);
    }

            

Reported by PMD.

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

Line: 33

              
        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Observable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);

        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine);
    }

            

Reported by PMD.

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

Line: 34

                      Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Observable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);

        Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine);
    }


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/subscribers/SinglePostCompleteSubscriberTest.java
18 issues
JUnit tests should include assert() or fail()
Design

Line: 26

              public class SinglePostCompleteSubscriberTest extends RxJavaTest {

    @Test
    public void requestCompleteRace() {
        for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
            final TestSubscriber<Integer> ts = new TestSubscriber<>(0L);

            final SinglePostCompleteSubscriber<Integer, Integer> spc = new SinglePostCompleteSubscriber<Integer, Integer>(ts) {
                private static final long serialVersionUID = -2848918821531562637L;

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 28

                  @Test
    public void requestCompleteRace() {
        for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
            final TestSubscriber<Integer> ts = new TestSubscriber<>(0L);

            final SinglePostCompleteSubscriber<Integer, Integer> spc = new SinglePostCompleteSubscriber<Integer, Integer>(ts) {
                private static final long serialVersionUID = -2848918821531562637L;

                @Override

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 30

                      for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
            final TestSubscriber<Integer> ts = new TestSubscriber<>(0L);

            final SinglePostCompleteSubscriber<Integer, Integer> spc = new SinglePostCompleteSubscriber<Integer, Integer>(ts) {
                private static final long serialVersionUID = -2848918821531562637L;

                @Override
                public void onNext(Integer t) {
                }

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 47

                              }
            };

            spc.onSubscribe(new BooleanSubscription());

            Runnable r1 = new Runnable() {
                @Override
                public void run() {
                    spc.onComplete();

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 49

              
            spc.onSubscribe(new BooleanSubscription());

            Runnable r1 = new Runnable() {
                @Override
                public void run() {
                    spc.onComplete();
                }
            };

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 56

                              }
            };

            Runnable r2 = new Runnable() {
                @Override
                public void run() {
                    ts.request(1);
                }
            };

            

Reported by PMD.

Found 'DD'-anomaly for variable 'serialVersionUID' (lines '31'-'31').
Error

Line: 31

                          final TestSubscriber<Integer> ts = new TestSubscriber<>(0L);

            final SinglePostCompleteSubscriber<Integer, Integer> spc = new SinglePostCompleteSubscriber<Integer, Integer>(ts) {
                private static final long serialVersionUID = -2848918821531562637L;

                @Override
                public void onNext(Integer t) {
                }


            

Reported by PMD.

Found 'DD'-anomaly for variable 'serialVersionUID' (lines '31'-'31').
Error

Line: 31

                          final TestSubscriber<Integer> ts = new TestSubscriber<>(0L);

            final SinglePostCompleteSubscriber<Integer, Integer> spc = new SinglePostCompleteSubscriber<Integer, Integer>(ts) {
                private static final long serialVersionUID = -2848918821531562637L;

                @Override
                public void onNext(Integer t) {
                }


            

Reported by PMD.

Found 'DD'-anomaly for variable 'serialVersionUID' (lines '31'-'31').
Error

Line: 31

                          final TestSubscriber<Integer> ts = new TestSubscriber<>(0L);

            final SinglePostCompleteSubscriber<Integer, Integer> spc = new SinglePostCompleteSubscriber<Integer, Integer>(ts) {
                private static final long serialVersionUID = -2848918821531562637L;

                @Override
                public void onNext(Integer t) {
                }


            

Reported by PMD.

Found 'DU'-anomaly for variable 'serialVersionUID' (lines '31'-'67').
Error

Line: 31

                          final TestSubscriber<Integer> ts = new TestSubscriber<>(0L);

            final SinglePostCompleteSubscriber<Integer, Integer> spc = new SinglePostCompleteSubscriber<Integer, Integer>(ts) {
                private static final long serialVersionUID = -2848918821531562637L;

                @Override
                public void onNext(Integer t) {
                }


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/util/JavadocNoThrows.java
18 issues
System.out.printf is used
Design

Line: 63

                                  }

                    if (!found) {
                        System.out.printf(" at %s.%s.method(%s.java:%s)%n%n", packageName, clazzName, clazzName, i + 1);
                    }
                }
            }
        }
    }

            

Reported by PMD.

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

Line: 34

                      throw new IllegalArgumentException("No instances!");
    }

    public static void main(String[] args) throws Exception {
        for (Class<?> clazz : CLASSES) {
            String clazzName = clazz.getSimpleName();
            String packageName = clazz.getPackage().getName();
            File f = TestHelper.findSource(clazzName, packageName);


            

Reported by PMD.

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

Line: 37

                  public static void main(String[] args) throws Exception {
        for (Class<?> clazz : CLASSES) {
            String clazzName = clazz.getSimpleName();
            String packageName = clazz.getPackage().getName();
            File f = TestHelper.findSource(clazzName, packageName);

            List<String> lines = Files.readAllLines(f.toPath());

            for (int i = 1; i < lines.size(); i++) {

            

Reported by PMD.

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

Line: 40

                          String packageName = clazz.getPackage().getName();
            File f = TestHelper.findSource(clazzName, packageName);

            List<String> lines = Files.readAllLines(f.toPath());

            for (int i = 1; i < lines.size(); i++) {
                String line = lines.get(i).trim();

                if (line.startsWith("/**")) {

            

Reported by PMD.

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

Line: 42

              
            List<String> lines = Files.readAllLines(f.toPath());

            for (int i = 1; i < lines.size(); i++) {
                String line = lines.get(i).trim();

                if (line.startsWith("/**")) {
                    boolean found = false;
                    for (int j = i + 1; j < lines.size(); j++) {

            

Reported by PMD.

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

Line: 43

                          List<String> lines = Files.readAllLines(f.toPath());

            for (int i = 1; i < lines.size(); i++) {
                String line = lines.get(i).trim();

                if (line.startsWith("/**")) {
                    boolean found = false;
                    for (int j = i + 1; j < lines.size(); j++) {


            

Reported by PMD.

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

Line: 43

                          List<String> lines = Files.readAllLines(f.toPath());

            for (int i = 1; i < lines.size(); i++) {
                String line = lines.get(i).trim();

                if (line.startsWith("/**")) {
                    boolean found = false;
                    for (int j = i + 1; j < lines.size(); j++) {


            

Reported by PMD.

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

Line: 45

                          for (int i = 1; i < lines.size(); i++) {
                String line = lines.get(i).trim();

                if (line.startsWith("/**")) {
                    boolean found = false;
                    for (int j = i + 1; j < lines.size(); j++) {

                        String line2 = lines.get(j).trim();
                        if (line2.startsWith("public")) {

            

Reported by PMD.

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

Line: 47

              
                if (line.startsWith("/**")) {
                    boolean found = false;
                    for (int j = i + 1; j < lines.size(); j++) {

                        String line2 = lines.get(j).trim();
                        if (line2.startsWith("public")) {
                            if (line2.endsWith("() {")) {
                                found = true;

            

Reported by PMD.

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

Line: 49

                                  boolean found = false;
                    for (int j = i + 1; j < lines.size(); j++) {

                        String line2 = lines.get(j).trim();
                        if (line2.startsWith("public")) {
                            if (line2.endsWith("() {")) {
                                found = true;
                            }
                            break;

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/disposables/SequentialDisposableTest.java
18 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 31

              
@RunWith(MockitoJUnitRunner.class)
public class SequentialDisposableTest extends RxJavaTest {
    private SequentialDisposable serialDisposable;

    @Before
    public void setUp() {
        serialDisposable = new SequentialDisposable();
    }

            

Reported by PMD.

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

Line: 44

                  }

    @Test
    public void getDisposableShouldReturnset() {
        final Disposable underlying = mock(Disposable.class);
        serialDisposable.update(underlying);
        assertSame(underlying, serialDisposable.get());

        final Disposable another = mock(Disposable.class);

            

Reported by PMD.

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

Line: 62

                      serialDisposable.replace(Disposable.empty());
        serialDisposable.dispose();

        verify(underlying, never()).dispose();
    }

    @Test
    public void unsubscribingTwiceDoesUnsubscribeOnce() {
        Disposable underlying = mock(Disposable.class);

            

Reported by PMD.

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

Line: 71

                      serialDisposable.update(underlying);

        serialDisposable.dispose();
        verify(underlying).dispose();

        serialDisposable.dispose();
        verifyNoMoreInteractions(underlying);
    }


            

Reported by PMD.

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

Line: 83

                      serialDisposable.update(underlying);
        verifyNoInteractions(underlying);
        serialDisposable.update(underlying);
        verify(underlying).dispose();
    }

    @Test
    public void unsubscribingWithSingleUnderlyingUnsubscribes() {
        Disposable underlying = mock(Disposable.class);

            

Reported by PMD.

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

Line: 90

                  public void unsubscribingWithSingleUnderlyingUnsubscribes() {
        Disposable underlying = mock(Disposable.class);
        serialDisposable.update(underlying);
        underlying.dispose();
        verify(underlying).dispose();
    }

    @Test
    public void replacingFirstUnderlyingCausesUnsubscription() {

            

Reported by PMD.

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

Line: 91

                      Disposable underlying = mock(Disposable.class);
        serialDisposable.update(underlying);
        underlying.dispose();
        verify(underlying).dispose();
    }

    @Test
    public void replacingFirstUnderlyingCausesUnsubscription() {
        Disposable first = mock(Disposable.class);

            

Reported by PMD.

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

Line: 100

                      serialDisposable.update(first);
        Disposable second = mock(Disposable.class);
        serialDisposable.update(second);
        verify(first).dispose();
    }

    @Test
    public void whenUnsubscribingSecondUnderlyingUnsubscribed() {
        Disposable first = mock(Disposable.class);

            

Reported by PMD.

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

Line: 110

                      Disposable second = mock(Disposable.class);
        serialDisposable.update(second);
        serialDisposable.dispose();
        verify(second).dispose();
    }

    @Test
    public void settingUnderlyingWhenUnsubscribedCausesImmediateUnsubscription() {
        serialDisposable.dispose();

            

Reported by PMD.

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

Line: 118

                      serialDisposable.dispose();
        Disposable underlying = mock(Disposable.class);
        serialDisposable.update(underlying);
        verify(underlying).dispose();
    }

    @Test
    public void settingUnderlyingWhenUnsubscribedCausesImmediateUnsubscriptionConcurrently()
            throws InterruptedException {

            

Reported by PMD.

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

Line: 28

              public class SingleOnErrorXTest extends RxJavaTest {

    @Test
    public void returnSuccess() {
        Single.just(1)
        .onErrorReturnItem(2)
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 29

              
    @Test
    public void returnSuccess() {
        Single.just(1)
        .onErrorReturnItem(2)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 29

              
    @Test
    public void returnSuccess() {
        Single.just(1)
        .onErrorReturnItem(2)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 29

              
    @Test
    public void returnSuccess() {
        Single.just(1)
        .onErrorReturnItem(2)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 36

                  }

    @Test
    public void resumeThrows() {
        TestObserverEx<Integer> to = Single.<Integer>error(new TestException("Outer"))
        .onErrorReturn(new Function<Throwable, Integer>() {
            @Override
            public Integer apply(Throwable e) throws Exception {
                throw new TestException("Inner");

            

Reported by PMD.

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

Line: 47

                      .to(TestHelper.<Integer>testConsumer())
        .assertFailure(CompositeException.class);

        List<Throwable> errors = TestHelper.compositeList(to.errors().get(0));

        TestHelper.assertError(errors, 0, TestException.class, "Outer");
        TestHelper.assertError(errors, 1, TestException.class, "Inner");
    }


            

Reported by PMD.

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

Line: 54

                  }

    @Test
    public void resumeErrors() {
        Single.error(new TestException("Main"))
        .onErrorResumeWith(Single.error(new TestException("Resume")))
        .to(TestHelper.<Object>testConsumer())
        .assertFailureAndMessage(TestException.class, "Resume");
    }

            

Reported by PMD.

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

Line: 62

                  }

    @Test
    public void resumeDispose() {
        TestHelper.checkDisposed(Single.error(new TestException("Main"))
        .onErrorResumeWith(Single.just(1)));
    }

    @Test

            

Reported by PMD.

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

Line: 68

                  }

    @Test
    public void resumeDoubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeSingle(new Function<Single<Object>, SingleSource<Object>>() {
            @Override
            public SingleSource<Object> apply(Single<Object> s) throws Exception {
                return s.onErrorResumeWith(Single.just(1));
            }

            

Reported by PMD.

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

Line: 78

                  }

    @Test
    public void resumeSuccess() {
        Single.just(1)
        .onErrorResumeWith(Single.just(2))
        .test()
        .assertResult(1);
    }

            

Reported by PMD.