The following issues were found

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

Line: 36

               */
public final class ObservableConcatMapCompletable<T> extends Completable {

    final Observable<T> source;

    final Function<? super T, ? extends CompletableSource> mapper;

    final ErrorMode errorMode;


            

Reported by PMD.

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

Line: 38

              
    final Observable<T> source;

    final Function<? super T, ? extends CompletableSource> mapper;

    final ErrorMode errorMode;

    final int prefetch;


            

Reported by PMD.

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

Line: 40

              
    final Function<? super T, ? extends CompletableSource> mapper;

    final ErrorMode errorMode;

    final int prefetch;

    public ObservableConcatMapCompletable(Observable<T> source,
            Function<? super T, ? extends CompletableSource> mapper,

            

Reported by PMD.

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

Line: 42

              
    final ErrorMode errorMode;

    final int prefetch;

    public ObservableConcatMapCompletable(Observable<T> source,
            Function<? super T, ? extends CompletableSource> mapper,
            ErrorMode errorMode,
            int prefetch) {

            

Reported by PMD.

The class 'ConcatMapCompletableObserver' has a Standard Cyclomatic Complexity of 3 (Highest = 11).
Design

Line: 61

                      }
    }

    static final class ConcatMapCompletableObserver<T>
    extends ConcatMapXMainObserver<T> {

        private static final long serialVersionUID = 3610901111000061034L;

        final CompletableObserver downstream;

            

Reported by PMD.

The class 'ConcatMapCompletableObserver' has a Modified Cyclomatic Complexity of 3 (Highest = 11).
Design

Line: 61

                      }
    }

    static final class ConcatMapCompletableObserver<T>
    extends ConcatMapXMainObserver<T> {

        private static final long serialVersionUID = 3610901111000061034L;

        final CompletableObserver downstream;

            

Reported by PMD.

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

Line: 66

              
        private static final long serialVersionUID = 3610901111000061034L;

        final CompletableObserver downstream;

        final Function<? super T, ? extends CompletableSource> mapper;

        final ConcatMapInnerObserver inner;


            

Reported by PMD.

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

Line: 68

              
        final CompletableObserver downstream;

        final Function<? super T, ? extends CompletableSource> mapper;

        final ConcatMapInnerObserver inner;

        volatile boolean active;


            

Reported by PMD.

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

Line: 70

              
        final Function<? super T, ? extends CompletableSource> mapper;

        final ConcatMapInnerObserver inner;

        volatile boolean active;

        ConcatMapCompletableObserver(CompletableObserver downstream,
                Function<? super T, ? extends CompletableSource> mapper,

            

Reported by PMD.

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

Line: 72

              
        final ConcatMapInnerObserver inner;

        volatile boolean active;

        ConcatMapCompletableObserver(CompletableObserver downstream,
                Function<? super T, ? extends CompletableSource> mapper,
                ErrorMode errorMode, int prefetch) {
            super(prefetch, errorMode);

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/maybe/MaybeRetryTest.java
30 issues
Avoid throwing raw exception types.
Design

Line: 39

                              numberOfSubscribeCalls.incrementAndGet();

                if (atomicInteger.decrementAndGet() != 0) {
                    throw new RuntimeException();
                }

                throw new IllegalArgumentException();
            }
        })

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 66

                              numberOfSubscribeCalls.incrementAndGet();

                if (atomicInteger.decrementAndGet() != 0) {
                    throw new RuntimeException();
                }

                return true;
            }
        })

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 89

                              numberOfSubscribeCalls.incrementAndGet();

                if (atomicInteger.decrementAndGet() != 0) {
                    throw new RuntimeException();
                }

                return true;
            }
        })

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 112

                              numberOfSubscribeCalls.incrementAndGet();

                if (atomicInteger.decrementAndGet() != 0) {
                    throw new RuntimeException();
                }

                return true;
            }
        })

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 53

                          .test()
            .assertFailure(IllegalArgumentException.class);

        assertEquals(3, numberOfSubscribeCalls.get());
    }

    @Test
    public void retryTimesPredicateWithMatchingRetryAmount() {
        final AtomicInteger atomicInteger = new AtomicInteger(3);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 76

                          .test()
            .assertResult(true);

        assertEquals(3, numberOfSubscribeCalls.get());
    }

    @Test
    public void retryTimesPredicateWithNotMatchingRetryAmount() {
        final AtomicInteger atomicInteger = new AtomicInteger(3);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 99

                          .test()
            .assertFailure(RuntimeException.class);

        assertEquals(2, numberOfSubscribeCalls.get());
    }

    @Test
    public void retryTimesPredicateWithZeroRetries() {
        final AtomicInteger atomicInteger = new AtomicInteger(2);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 122

                          .test()
            .assertFailure(RuntimeException.class);

        assertEquals(1, numberOfSubscribeCalls.get());
    }

    @Test
    public void untilTrueJust() {
        Maybe.just(1)

            

Reported by PMD.

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

Line: 126

                  }

    @Test
    public void untilTrueJust() {
        Maybe.just(1)
        .retryUntil(() -> true)
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 127

              
    @Test
    public void untilTrueJust() {
        Maybe.just(1)
        .retryUntil(() -> true)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/plugins/RxJavaPlugins.java
30 issues
Avoid reassigning parameters such as 'error'
Design

Line: 365

                   * @see #setErrorHandler(Consumer)
     * @see <a href="https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling">Error handling Wiki</a>
     */
    public static void onError(@NonNull Throwable error) {
        Consumer<? super Throwable> f = errorHandler;

        if (error == null) {
            error = ExceptionHelper.createNullPointerException("onError called with a null Throwable.");
        } else {

            

Reported by PMD.

Avoid reassigning parameters such as 'error'
Design

Line: 365

                   * @see #setErrorHandler(Consumer)
     * @see <a href="https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling">Error handling Wiki</a>
     */
    public static void onError(@NonNull Throwable error) {
        Consumer<? super Throwable> f = errorHandler;

        if (error == null) {
            error = ExceptionHelper.createNullPointerException("onError called with a null Throwable.");
        } else {

            

Reported by PMD.

High amount of different objects as members denotes a high coupling
Design

Line: 14

               * the License for the specific language governing permissions and limitations under the License.
 */

package io.reactivex.rxjava3.plugins;

import java.lang.Thread.UncaughtExceptionHandler;
import java.util.Objects;
import java.util.concurrent.*;


            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 14

               * the License for the specific language governing permissions and limitations under the License.
 */

package io.reactivex.rxjava3.plugins;

import java.lang.Thread.UncaughtExceptionHandler;
import java.util.Objects;
import java.util.concurrent.*;


            

Reported by PMD.

Avoid really long classes.
Design

Line: 35

              /**
 * Utility class to inject handlers to certain standard RxJava operations.
 */
public final class RxJavaPlugins {
    @Nullable
    static volatile Consumer<? super Throwable> errorHandler;

    @Nullable
    static volatile Function<? super Runnable, ? extends Runnable> onScheduleHandler;

            

Reported by PMD.

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

Line: 35

              /**
 * Utility class to inject handlers to certain standard RxJava operations.
 */
public final class RxJavaPlugins {
    @Nullable
    static volatile Consumer<? super Throwable> errorHandler;

    @Nullable
    static volatile Function<? super Runnable, ? extends Runnable> onScheduleHandler;

            

Reported by PMD.

Too many fields
Design

Line: 35

              /**
 * Utility class to inject handlers to certain standard RxJava operations.
 */
public final class RxJavaPlugins {
    @Nullable
    static volatile Consumer<? super Throwable> errorHandler;

    @Nullable
    static volatile Function<? super Runnable, ? extends Runnable> onScheduleHandler;

            

Reported by PMD.

Possible God Class (WMC=188, ATFD=15, TCC=11.515%)
Design

Line: 35

              /**
 * Utility class to inject handlers to certain standard RxJava operations.
 */
public final class RxJavaPlugins {
    @Nullable
    static volatile Consumer<? super Throwable> errorHandler;

    @Nullable
    static volatile Function<? super Runnable, ? extends Runnable> onScheduleHandler;

            

Reported by PMD.

The class 'RxJavaPlugins' has a total cyclomatic complexity of 188 (highest 7).
Design

Line: 35

              /**
 * Utility class to inject handlers to certain standard RxJava operations.
 */
public final class RxJavaPlugins {
    @Nullable
    static volatile Consumer<? super Throwable> errorHandler;

    @Nullable
    static volatile Function<? super Runnable, ? extends Runnable> onScheduleHandler;

            

Reported by PMD.

The String literal 'rawtypes' appears 48 times in this file; the first occurrence is on line 66
Error

Line: 66

                  @Nullable
    static volatile Function<? super Scheduler, ? extends Scheduler> onNewThreadHandler;

    @SuppressWarnings("rawtypes")
    @Nullable
    static volatile Function<? super Flowable, ? extends Flowable> onFlowableAssembly;

    @SuppressWarnings("rawtypes")
    @Nullable

            

Reported by PMD.

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

Line: 26

              import io.reactivex.rxjava3.plugins.RxJavaPlugins;

public final class FlowableAmb<T> extends Flowable<T> {
    final Publisher<? extends T>[] sources;
    final Iterable<? extends Publisher<? extends T>> sourcesIterable;

    public FlowableAmb(Publisher<? extends T>[] sources, Iterable<? extends Publisher<? extends T>> sourcesIterable) {
        this.sources = sources;
        this.sourcesIterable = sourcesIterable;

            

Reported by PMD.

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

Line: 27

              
public final class FlowableAmb<T> extends Flowable<T> {
    final Publisher<? extends T>[] sources;
    final Iterable<? extends Publisher<? extends T>> sourcesIterable;

    public FlowableAmb(Publisher<? extends T>[] sources, Iterable<? extends Publisher<? extends T>> sourcesIterable) {
        this.sources = sources;
        this.sourcesIterable = sourcesIterable;
    }

            

Reported by PMD.

The user-supplied array 'sources' is stored directly.
Design

Line: 29

                  final Publisher<? extends T>[] sources;
    final Iterable<? extends Publisher<? extends T>> sourcesIterable;

    public FlowableAmb(Publisher<? extends T>[] sources, Iterable<? extends Publisher<? extends T>> sourcesIterable) {
        this.sources = sources;
        this.sourcesIterable = sourcesIterable;
    }

    @Override

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 44

                          try {
                for (Publisher<? extends T> p : sourcesIterable) {
                    if (p == null) {
                        EmptySubscription.error(new NullPointerException("One of the sources is null"), s);
                        return;
                    }
                    if (count == sources.length) {
                        Publisher<? extends T>[] b = new Publisher[count + (count >> 2)];
                        System.arraycopy(sources, 0, b, 0, count);

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 48

                                      return;
                    }
                    if (count == sources.length) {
                        Publisher<? extends T>[] b = new Publisher[count + (count >> 2)];
                        System.arraycopy(sources, 0, b, 0, count);
                        sources = b;
                    }
                    sources[count++] = p;
                }

            

Reported by PMD.

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

Line: 54

                                  }
                    sources[count++] = p;
                }
            } catch (Throwable e) {
                Exceptions.throwIfFatal(e);
                EmptySubscription.error(e, s);
                return;
            }
        } else {

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 67

                          EmptySubscription.complete(s);
            return;
        } else
        if (count == 1) {
            sources[0].subscribe(s);
            return;
        }

        AmbCoordinator<T> ac = new AmbCoordinator<>(s, count);

            

Reported by PMD.

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

Line: 77

                  }

    static final class AmbCoordinator<T> implements Subscription {
        final Subscriber<? super T> downstream;
        final AmbInnerSubscriber<T>[] subscribers;

        final AtomicInteger winner = new AtomicInteger();

        @SuppressWarnings("unchecked")

            

Reported by PMD.

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

Line: 78

              
    static final class AmbCoordinator<T> implements Subscription {
        final Subscriber<? super T> downstream;
        final AmbInnerSubscriber<T>[] subscribers;

        final AtomicInteger winner = new AtomicInteger();

        @SuppressWarnings("unchecked")
        AmbCoordinator(Subscriber<? super T> actual, int count) {

            

Reported by PMD.

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

Line: 80

                      final Subscriber<? super T> downstream;
        final AmbInnerSubscriber<T>[] subscribers;

        final AtomicInteger winner = new AtomicInteger();

        @SuppressWarnings("unchecked")
        AmbCoordinator(Subscriber<? super T> actual, int count) {
            this.downstream = actual;
            this.subscribers = new AmbInnerSubscriber[count];

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOnTest.java
30 issues
A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 33

              public class SingleUnsubscribeOnTest extends RxJavaTest {

    @Test
    public void normal() throws Exception {
        PublishProcessor<Integer> pp = PublishProcessor.create();

        final String[] name = { null };

        final CountDownLatch cdl = new CountDownLatch(1);

            

Reported by PMD.

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

Line: 33

              public class SingleUnsubscribeOnTest extends RxJavaTest {

    @Test
    public void normal() throws Exception {
        PublishProcessor<Integer> pp = PublishProcessor.create();

        final String[] name = { null };

        final CountDownLatch cdl = new CountDownLatch(1);

            

Reported by PMD.

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

Line: 43

                      pp.doOnCancel(new Action() {
            @Override
            public void run() throws Exception {
                name[0] = Thread.currentThread().getName();
                cdl.countDown();
            }
        })
        .single(-99)
        .unsubscribeOn(Schedulers.single())

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 52

                      .test(true)
        ;

        assertTrue(cdl.await(5, TimeUnit.SECONDS));

        int times = 10;

        while (times-- > 0 && pp.hasSubscribers()) {
            Thread.sleep(100);

            

Reported by PMD.

Avoid assignments in operands
Error

Line: 56

              
        int times = 10;

        while (times-- > 0 && pp.hasSubscribers()) {
            Thread.sleep(100);
        }

        assertFalse(pp.hasSubscribers());


            

Reported by PMD.

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

Line: 56

              
        int times = 10;

        while (times-- > 0 && pp.hasSubscribers()) {
            Thread.sleep(100);
        }

        assertFalse(pp.hasSubscribers());


            

Reported by PMD.

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

Line: 60

                          Thread.sleep(100);
        }

        assertFalse(pp.hasSubscribers());

        assertNotEquals(Thread.currentThread().getName(), name[0]);
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 60

                          Thread.sleep(100);
        }

        assertFalse(pp.hasSubscribers());

        assertNotEquals(Thread.currentThread().getName(), name[0]);
    }

    @Test

            

Reported by PMD.

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

Line: 62

              
        assertFalse(pp.hasSubscribers());

        assertNotEquals(Thread.currentThread().getName(), name[0]);
    }

    @Test
    public void just() {
        Single.just(1)

            

Reported by PMD.

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

Line: 66

                  }

    @Test
    public void just() {
        Single.just(1)
        .unsubscribeOn(Schedulers.single())
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/subscribers/DisposableSubscriberTest.java
30 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 32

              
    static final class TestDisposableSubscriber<T> extends DisposableSubscriber<T> {

        int start;

        final List<T> values = new ArrayList<>();

        final List<Throwable> errors = new ArrayList<>();


            

Reported by PMD.

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

Line: 34

              
        int start;

        final List<T> values = new ArrayList<>();

        final List<Throwable> errors = new ArrayList<>();

        int completions;


            

Reported by PMD.

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

Line: 36

              
        final List<T> values = new ArrayList<>();

        final List<Throwable> errors = new ArrayList<>();

        int completions;

        @Override
        protected void onStart() {

            

Reported by PMD.

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

Line: 38

              
        final List<Throwable> errors = new ArrayList<>();

        int completions;

        @Override
        protected void onStart() {
            request(1);


            

Reported by PMD.

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

Line: 64

                  }

    @Test
    public void normal() {
        TestDisposableSubscriber<Integer> tc = new TestDisposableSubscriber<>();

        assertFalse(tc.isDisposed());
        assertEquals(0, tc.start);
        assertTrue(tc.values.isEmpty());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 67

                  public void normal() {
        TestDisposableSubscriber<Integer> tc = new TestDisposableSubscriber<>();

        assertFalse(tc.isDisposed());
        assertEquals(0, tc.start);
        assertTrue(tc.values.isEmpty());
        assertTrue(tc.errors.isEmpty());

        Flowable.just(1).subscribe(tc);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 68

                      TestDisposableSubscriber<Integer> tc = new TestDisposableSubscriber<>();

        assertFalse(tc.isDisposed());
        assertEquals(0, tc.start);
        assertTrue(tc.values.isEmpty());
        assertTrue(tc.errors.isEmpty());

        Flowable.just(1).subscribe(tc);


            

Reported by PMD.

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

Line: 69

              
        assertFalse(tc.isDisposed());
        assertEquals(0, tc.start);
        assertTrue(tc.values.isEmpty());
        assertTrue(tc.errors.isEmpty());

        Flowable.just(1).subscribe(tc);

        assertFalse(tc.isDisposed());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 69

              
        assertFalse(tc.isDisposed());
        assertEquals(0, tc.start);
        assertTrue(tc.values.isEmpty());
        assertTrue(tc.errors.isEmpty());

        Flowable.just(1).subscribe(tc);

        assertFalse(tc.isDisposed());

            

Reported by PMD.

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

Line: 70

                      assertFalse(tc.isDisposed());
        assertEquals(0, tc.start);
        assertTrue(tc.values.isEmpty());
        assertTrue(tc.errors.isEmpty());

        Flowable.just(1).subscribe(tc);

        assertFalse(tc.isDisposed());
        assertEquals(1, tc.start);

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableToIteratorTest.java
30 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 35

              public class BlockingObservableToIteratorTest extends RxJavaTest {

    @Test
    public void toIterator() {
        Observable<String> obs = Observable.just("one", "two", "three");

        Iterator<String> it = obs.blockingIterable().iterator();

        assertTrue(it.hasNext());

            

Reported by PMD.

The String literal 'one' appears 4 times in this file; the first occurrence is on line 36
Error

Line: 36

              
    @Test
    public void toIterator() {
        Observable<String> obs = Observable.just("one", "two", "three");

        Iterator<String> it = obs.blockingIterable().iterator();

        assertTrue(it.hasNext());
        assertEquals("one", it.next());

            

Reported by PMD.

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

Line: 38

                  public void toIterator() {
        Observable<String> obs = Observable.just("one", "two", "three");

        Iterator<String> it = obs.blockingIterable().iterator();

        assertTrue(it.hasNext());
        assertEquals("one", it.next());

        assertTrue(it.hasNext());

            

Reported by PMD.

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

Line: 38

                  public void toIterator() {
        Observable<String> obs = Observable.just("one", "two", "three");

        Iterator<String> it = obs.blockingIterable().iterator();

        assertTrue(it.hasNext());
        assertEquals("one", it.next());

        assertTrue(it.hasNext());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

              
        Iterator<String> it = obs.blockingIterable().iterator();

        assertTrue(it.hasNext());
        assertEquals("one", it.next());

        assertTrue(it.hasNext());
        assertEquals("two", it.next());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 41

                      Iterator<String> it = obs.blockingIterable().iterator();

        assertTrue(it.hasNext());
        assertEquals("one", it.next());

        assertTrue(it.hasNext());
        assertEquals("two", it.next());

        assertTrue(it.hasNext());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 43

                      assertTrue(it.hasNext());
        assertEquals("one", it.next());

        assertTrue(it.hasNext());
        assertEquals("two", it.next());

        assertTrue(it.hasNext());
        assertEquals("three", it.next());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 44

                      assertEquals("one", it.next());

        assertTrue(it.hasNext());
        assertEquals("two", it.next());

        assertTrue(it.hasNext());
        assertEquals("three", it.next());

        assertFalse(it.hasNext());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 46

                      assertTrue(it.hasNext());
        assertEquals("two", it.next());

        assertTrue(it.hasNext());
        assertEquals("three", it.next());

        assertFalse(it.hasNext());

    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 47

                      assertEquals("two", it.next());

        assertTrue(it.hasNext());
        assertEquals("three", it.next());

        assertFalse(it.hasNext());

    }


            

Reported by PMD.

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

Line: 32

              import io.reactivex.rxjava3.plugins.RxJavaPlugins;

public final class FlowableTimeout<T, U, V> extends AbstractFlowableWithUpstream<T, T> {
    final Publisher<U> firstTimeoutIndicator;
    final Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator;
    final Publisher<? extends T> other;

    public FlowableTimeout(
            Flowable<T> source,

            

Reported by PMD.

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

Line: 33

              
public final class FlowableTimeout<T, U, V> extends AbstractFlowableWithUpstream<T, T> {
    final Publisher<U> firstTimeoutIndicator;
    final Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator;
    final Publisher<? extends T> other;

    public FlowableTimeout(
            Flowable<T> source,
            Publisher<U> firstTimeoutIndicator,

            

Reported by PMD.

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

Line: 34

              public final class FlowableTimeout<T, U, V> extends AbstractFlowableWithUpstream<T, T> {
    final Publisher<U> firstTimeoutIndicator;
    final Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator;
    final Publisher<? extends T> other;

    public FlowableTimeout(
            Flowable<T> source,
            Publisher<U> firstTimeoutIndicator,
            Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator,

            

Reported by PMD.

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

Line: 71

              
        private static final long serialVersionUID = 3764492702657003550L;

        final Subscriber<? super T> downstream;

        final Function<? super T, ? extends Publisher<?>> itemTimeoutIndicator;

        final SequentialDisposable task;


            

Reported by PMD.

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

Line: 73

              
        final Subscriber<? super T> downstream;

        final Function<? super T, ? extends Publisher<?>> itemTimeoutIndicator;

        final SequentialDisposable task;

        final AtomicReference<Subscription> upstream;


            

Reported by PMD.

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

Line: 75

              
        final Function<? super T, ? extends Publisher<?>> itemTimeoutIndicator;

        final SequentialDisposable task;

        final AtomicReference<Subscription> upstream;

        final AtomicLong requested;


            

Reported by PMD.

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

Line: 77

              
        final SequentialDisposable task;

        final AtomicReference<Subscription> upstream;

        final AtomicLong requested;

        TimeoutSubscriber(Subscriber<? super T> actual, Function<? super T, ? extends Publisher<?>> itemTimeoutIndicator) {
            this.downstream = actual;

            

Reported by PMD.

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

Line: 79

              
        final AtomicReference<Subscription> upstream;

        final AtomicLong requested;

        TimeoutSubscriber(Subscriber<? super T> actual, Function<? super T, ? extends Publisher<?>> itemTimeoutIndicator) {
            this.downstream = actual;
            this.itemTimeoutIndicator = itemTimeoutIndicator;
            this.task = new SequentialDisposable();

            

Reported by PMD.

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

Line: 114

                              itemTimeoutPublisher = Objects.requireNonNull(
                        itemTimeoutIndicator.apply(t),
                        "The itemTimeoutIndicator returned a null Publisher.");
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                upstream.get().cancel();
                getAndSet(Long.MAX_VALUE);
                downstream.onError(ex);
                return;

            

Reported by PMD.

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

Line: 116

                                      "The itemTimeoutIndicator returned a null Publisher.");
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                upstream.get().cancel();
                getAndSet(Long.MAX_VALUE);
                downstream.onError(ex);
                return;
            }


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromFutureTest.java
30 issues
JUnit tests should include assert() or fail()
Design

Line: 31

              public class MaybeFromFutureTest extends RxJavaTest {

    @Test
    public void cancelImmediately() {
        FutureTask<Integer> ft = new FutureTask<>(Functions.justCallable(1));

        Maybe.fromFuture(ft).test(true)
        .assertEmpty();
    }

            

Reported by PMD.

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

Line: 34

                  public void cancelImmediately() {
        FutureTask<Integer> ft = new FutureTask<>(Functions.justCallable(1));

        Maybe.fromFuture(ft).test(true)
        .assertEmpty();
    }

    @Test
    public void timeout() {

            

Reported by PMD.

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

Line: 34

                  public void cancelImmediately() {
        FutureTask<Integer> ft = new FutureTask<>(Functions.justCallable(1));

        Maybe.fromFuture(ft).test(true)
        .assertEmpty();
    }

    @Test
    public void timeout() {

            

Reported by PMD.

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

Line: 39

                  }

    @Test
    public void timeout() {
        FutureTask<Integer> ft = new FutureTask<>(Functions.justCallable(1));

        Maybe.fromFuture(ft, 1, TimeUnit.MILLISECONDS).test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertFailure(TimeoutException.class);

            

Reported by PMD.

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

Line: 42

                  public void timeout() {
        FutureTask<Integer> ft = new FutureTask<>(Functions.justCallable(1));

        Maybe.fromFuture(ft, 1, TimeUnit.MILLISECONDS).test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertFailure(TimeoutException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 42

                  public void timeout() {
        FutureTask<Integer> ft = new FutureTask<>(Functions.justCallable(1));

        Maybe.fromFuture(ft, 1, TimeUnit.MILLISECONDS).test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertFailure(TimeoutException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 42

                  public void timeout() {
        FutureTask<Integer> ft = new FutureTask<>(Functions.justCallable(1));

        Maybe.fromFuture(ft, 1, TimeUnit.MILLISECONDS).test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertFailure(TimeoutException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 48

                  }

    @Test
    public void timedWait() {
        FutureTask<Integer> ft = new FutureTask<>(Functions.justCallable(1));
        ft.run();

        Maybe.fromFuture(ft, 1, TimeUnit.MILLISECONDS).test()
        .awaitDone(5, TimeUnit.SECONDS)

            

Reported by PMD.

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

Line: 52

                      FutureTask<Integer> ft = new FutureTask<>(Functions.justCallable(1));
        ft.run();

        Maybe.fromFuture(ft, 1, TimeUnit.MILLISECONDS).test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 52

                      FutureTask<Integer> ft = new FutureTask<>(Functions.justCallable(1));
        ft.run();

        Maybe.fromFuture(ft, 1, TimeUnit.MILLISECONDS).test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromActionTest.java
30 issues
JUnit assertions should include a message
Design

Line: 46

                          .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());
    }

    @Test
    public void fromActionTwice() {
        final AtomicInteger atomicInteger = new AtomicInteger();

            

Reported by PMD.

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

Line: 50

                  }

    @Test
    public void fromActionTwice() {
        final AtomicInteger atomicInteger = new AtomicInteger();

        Action run = new Action() {
            @Override
            public void run() throws Exception {

            

Reported by PMD.

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

Line: 60

                          }
        };

        Maybe.fromAction(run)
            .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());


            

Reported by PMD.

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

Line: 60

                          }
        };

        Maybe.fromAction(run)
            .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 64

                          .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());

        Maybe.fromAction(run)
            .test()
            .assertResult();


            

Reported by PMD.

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

Line: 66

              
        assertEquals(1, atomicInteger.get());

        Maybe.fromAction(run)
            .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

            

Reported by PMD.

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

Line: 66

              
        assertEquals(1, atomicInteger.get());

        Maybe.fromAction(run)
            .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 70

                          .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

    @Test
    public void fromActionInvokesLazy() {
        final AtomicInteger atomicInteger = new AtomicInteger();

            

Reported by PMD.

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

Line: 74

                  }

    @Test
    public void fromActionInvokesLazy() {
        final AtomicInteger atomicInteger = new AtomicInteger();

        Maybe<Object> maybe = Maybe.fromAction(new Action() {
            @Override
            public void run() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 84

                          }
        });

        assertEquals(0, atomicInteger.get());

        maybe
            .test()
            .assertResult();


            

Reported by PMD.