The following issues were found

src/test/java/io/reactivex/rxjava3/tck/AsyncProcessorAsPublisherTckTest.java
3 issues
Avoid using Literals in Conditional Statements
Error

Line: 44

                                      return;
                    }

                    if (System.currentTimeMillis() - start > 200) {
                        return;
                    }
                }

                for (int i = 0; i < elements; i++) {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'start' (lines '36'-'56').
Error

Line: 36

                      Schedulers.io().scheduleDirect(new Runnable() {
            @Override
            public void run() {
                long start = System.currentTimeMillis();
                while (!pp.hasSubscribers()) {
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        return;

            

Reported by PMD.

Found 'DU'-anomaly for variable 'start' (lines '36'-'56').
Error

Line: 36

                      Schedulers.io().scheduleDirect(new Runnable() {
            @Override
            public void run() {
                long start = System.currentTimeMillis();
                while (!pp.hasSubscribers()) {
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        return;

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/tck/GenerateTckTest.java
3 issues
Avoid reassigning parameters such as 's'
Design

Line: 32

                          Flowable.generate(Functions.justSupplier(0L),
            new BiFunction<Long, Emitter<Long>, Long>() {
                @Override
                public Long apply(Long s, Emitter<Long> e) throws Exception {
                    e.onNext(s);
                    if (++s == elements) {
                        e.onComplete();
                    }
                    return s;

            

Reported by PMD.

Avoid assignments in operands
Error

Line: 34

                              @Override
                public Long apply(Long s, Emitter<Long> e) throws Exception {
                    e.onNext(s);
                    if (++s == elements) {
                        e.onComplete();
                    }
                    return s;
                }
            }, Functions.<Long>emptyConsumer())

            

Reported by PMD.

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

Line: 19

              import org.reactivestreams.Publisher;
import org.testng.annotations.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.functions.BiFunction;
import io.reactivex.rxjava3.internal.functions.Functions;

@Test
public class GenerateTckTest extends BaseTck<Long> {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/testsupport/SuppressUndeliverableRule.java
3 issues
Private field 'base' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 32

              public class SuppressUndeliverableRule implements TestRule {

    static final class SuppressUndeliverableRuleStatement extends Statement {
        private Statement base;

        SuppressUndeliverableRuleStatement(Statement base) {
            this.base = base;
        }


            

Reported by PMD.

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

Line: 32

              public class SuppressUndeliverableRule implements TestRule {

    static final class SuppressUndeliverableRuleStatement extends Statement {
        private Statement base;

        SuppressUndeliverableRuleStatement(Statement base) {
            this.base = base;
        }


            

Reported by PMD.

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

Line: 43

                          try {
                RxJavaPlugins.setErrorHandler(throwable -> {
                    if (!(throwable instanceof UndeliverableException)) {
                        throwable.printStackTrace();
                        Thread currentThread = Thread.currentThread();
                        currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, throwable);
                    }
                });
                base.evaluate();

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/tck/BufferBoundaryTckTest.java
3 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 29

                  @Override
    public Publisher<List<Long>> createPublisher(long elements) {
        return
            Flowable.fromIterable(iterate(elements))
            .buffer(Flowable.just(1).concatWith(Flowable.<Integer>never()))
            .onBackpressureLatest()
        ;
    }


            

Reported by PMD.

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

Line: 29

                  @Override
    public Publisher<List<Long>> createPublisher(long elements) {
        return
            Flowable.fromIterable(iterate(elements))
            .buffer(Flowable.just(1).concatWith(Flowable.<Integer>never()))
            .onBackpressureLatest()
        ;
    }


            

Reported by PMD.

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

Line: 30

                  public Publisher<List<Long>> createPublisher(long elements) {
        return
            Flowable.fromIterable(iterate(elements))
            .buffer(Flowable.just(1).concatWith(Flowable.<Integer>never()))
            .onBackpressureLatest()
        ;
    }

    @Override

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/schedulers/BooleanRunnableTest.java
3 issues
In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions
Design

Line: 40

              
            try {
                task.run();
                fail("Should have thrown!");
            } catch (TestException expected) {
                // expected
            }

            TestHelper.assertUndeliverable(errors, 0, TestException.class);

            

Reported by PMD.

Found 'DU'-anomaly for variable 'errors' (lines '32'-'49').
Error

Line: 32

              
    @Test
    public void runnableThrows() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            BooleanRunnable task = new BooleanRunnable(() -> {
                throw new TestException();
            });


            

Reported by PMD.

Found 'DU'-anomaly for variable 'task' (lines '34'-'49').
Error

Line: 34

                  public void runnableThrows() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            BooleanRunnable task = new BooleanRunnable(() -> {
                throw new TestException();
            });

            try {
                task.run();

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/schedulers/ExecutorSchedulerDelayedRunnableTest.java
3 issues
JUnit assertions should include a message
Design

Line: 56

              
        dl.run();

        assertEquals(0, count.get());
    }
}

            

Reported by PMD.

Found 'DU'-anomaly for variable 'dl' (lines '32'-'39').
Error

Line: 32

                  @Test(expected = TestException.class)
    @SuppressUndeliverable
    public void delayedRunnableCrash() {
        DelayedRunnable dl = new DelayedRunnable(new Runnable() {
            @Override
            public void run() {
                throw new TestException();
            }
        });

            

Reported by PMD.

Found 'DU'-anomaly for variable 'dl' (lines '32'-'39').
Error

Line: 32

                  @Test(expected = TestException.class)
    @SuppressUndeliverable
    public void delayedRunnableCrash() {
        DelayedRunnable dl = new DelayedRunnable(new Runnable() {
            @Override
            public void run() {
                throw new TestException();
            }
        });

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorRefCountedTckTest.java
3 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 41

                  @Override
    public Publisher<Integer> createFailedPublisher() {
        MulticastProcessor<Integer> mp = MulticastProcessor.create();
        mp.start();
        mp.onError(new TestException());
        return mp;
    }

    @Override

            

Reported by PMD.

Avoid unused imports such as 'org.reactivestreams'
Design

Line: 18

              
import java.util.concurrent.*;

import org.reactivestreams.*;
import org.reactivestreams.tck.*;
import org.testng.annotations.Test;

import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.processors.MulticastProcessor;

            

Reported by PMD.

Avoid unused imports such as 'org.reactivestreams.tck'
Design

Line: 19

              import java.util.concurrent.*;

import org.reactivestreams.*;
import org.reactivestreams.tck.*;
import org.testng.annotations.Test;

import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.processors.MulticastProcessor;


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorTckTest.java
3 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 41

                  @Override
    public Publisher<Integer> createFailedPublisher() {
        MulticastProcessor<Integer> mp = MulticastProcessor.create();
        mp.start();
        mp.onError(new TestException());
        return mp;
    }

    @Override

            

Reported by PMD.

Avoid unused imports such as 'org.reactivestreams'
Design

Line: 18

              
import java.util.concurrent.*;

import org.reactivestreams.*;
import org.reactivestreams.tck.*;
import org.testng.annotations.Test;

import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.processors.MulticastProcessor;

            

Reported by PMD.

Avoid unused imports such as 'org.reactivestreams.tck'
Design

Line: 19

              import java.util.concurrent.*;

import org.reactivestreams.*;
import org.reactivestreams.tck.*;
import org.testng.annotations.Test;

import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.processors.MulticastProcessor;


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/tck/UnicastProcessorAsPublisherTckTest.java
3 issues
Avoid using Literals in Conditional Statements
Error

Line: 44

                                      return;
                    }

                    if (System.currentTimeMillis() - start > 200) {
                        return;
                    }
                }

                for (int i = 0; i < elements; i++) {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'start' (lines '36'-'56').
Error

Line: 36

                      Schedulers.io().scheduleDirect(new Runnable() {
            @Override
            public void run() {
                long start = System.currentTimeMillis();
                while (!pp.hasSubscribers()) {
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        return;

            

Reported by PMD.

Found 'DU'-anomaly for variable 'start' (lines '36'-'56').
Error

Line: 36

                      Schedulers.io().scheduleDirect(new Runnable() {
            @Override
            public void run() {
                long start = System.currentTimeMillis();
                while (!pp.hasSubscribers()) {
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        return;

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorSizeBoundAsPublisherTckTest.java
3 issues
Avoid using Literals in Conditional Statements
Error

Line: 44

                                      return;
                    }

                    if (System.currentTimeMillis() - start > 200) {
                        return;
                    }
                }

                for (int i = 0; i < elements; i++) {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'start' (lines '36'-'56').
Error

Line: 36

                      Schedulers.io().scheduleDirect(new Runnable() {
            @Override
            public void run() {
                long start = System.currentTimeMillis();
                while (!pp.hasSubscribers()) {
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        return;

            

Reported by PMD.

Found 'DU'-anomaly for variable 'start' (lines '36'-'56').
Error

Line: 36

                      Schedulers.io().scheduleDirect(new Runnable() {
            @Override
            public void run() {
                long start = System.currentTimeMillis();
                while (!pp.hasSubscribers()) {
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        return;

            

Reported by PMD.