The following issues were found

src/test/java/io/reactivex/rxjava3/internal/util/OpenHashSetTest.java
9 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 38

                  }

    @Test
    public void addRemoveCollision() {
        Value v1 = new Value();
        Value v2 = new Value();

        OpenHashSet<Value> set = new OpenHashSet<>();


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 44

              
        OpenHashSet<Value> set = new OpenHashSet<>();

        assertTrue(set.add(v1));

        assertFalse(set.add(v1));

        assertFalse(set.remove(v2));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 46

              
        assertTrue(set.add(v1));

        assertFalse(set.add(v1));

        assertFalse(set.remove(v2));

        assertTrue(set.add(v2));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 48

              
        assertFalse(set.add(v1));

        assertFalse(set.remove(v2));

        assertTrue(set.add(v2));

        assertFalse(set.add(v2));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 50

              
        assertFalse(set.remove(v2));

        assertTrue(set.add(v2));

        assertFalse(set.add(v2));

        assertTrue(set.remove(v2));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 52

              
        assertTrue(set.add(v2));

        assertFalse(set.add(v2));

        assertTrue(set.remove(v2));

        assertFalse(set.remove(v2));
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 54

              
        assertFalse(set.add(v2));

        assertTrue(set.remove(v2));

        assertFalse(set.remove(v2));
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 56

              
        assertTrue(set.remove(v2));

        assertFalse(set.remove(v2));
    }
}

            

Reported by PMD.

Avoid unused imports such as 'org.junit.Assert'
Design

Line: 16

              
package io.reactivex.rxjava3.internal.util;

import static org.junit.Assert.*;

import org.junit.Test;

import io.reactivex.rxjava3.core.RxJavaTest;


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/util/NotificationLiteTest.java
9 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 28

              public class NotificationLiteTest extends RxJavaTest {

    @Test
    public void acceptFullObserver() {
        TestObserverEx<Integer> to = new TestObserverEx<>();

        Disposable d = Disposable.empty();

        assertFalse(NotificationLite.acceptFull(NotificationLite.disposable(d), to));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 33

              
        Disposable d = Disposable.empty();

        assertFalse(NotificationLite.acceptFull(NotificationLite.disposable(d), to));

        to.assertSubscribed();

        to.dispose();


            

Reported by PMD.

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

Line: 39

              
        to.dispose();

        assertTrue(d.isDisposed());
    }

    @Test
    public void errorNotificationCompare() {
        TestException ex = new TestException();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

              
        to.dispose();

        assertTrue(d.isDisposed());
    }

    @Test
    public void errorNotificationCompare() {
        TestException ex = new TestException();

            

Reported by PMD.

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

Line: 43

                  }

    @Test
    public void errorNotificationCompare() {
        TestException ex = new TestException();
        Object n1 = NotificationLite.error(ex);

        assertEquals(ex.hashCode(), n1.hashCode());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 47

                      TestException ex = new TestException();
        Object n1 = NotificationLite.error(ex);

        assertEquals(ex.hashCode(), n1.hashCode());

        assertNotEquals(n1, NotificationLite.complete());
    }
}

            

Reported by PMD.

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

Line: 47

                      TestException ex = new TestException();
        Object n1 = NotificationLite.error(ex);

        assertEquals(ex.hashCode(), n1.hashCode());

        assertNotEquals(n1, NotificationLite.complete());
    }
}

            

Reported by PMD.

Avoid unused imports such as 'org.junit.Assert'
Design

Line: 16

              
package io.reactivex.rxjava3.internal.util;

import static org.junit.Assert.*;

import org.junit.Test;

import io.reactivex.rxjava3.core.RxJavaTest;
import io.reactivex.rxjava3.disposables.*;

            

Reported by PMD.

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

Line: 21

              import org.junit.Test;

import io.reactivex.rxjava3.core.RxJavaTest;
import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.testsupport.TestObserverEx;

public class NotificationLiteTest extends RxJavaTest {


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/validators/PublicFinalMethods.java
9 issues
These nested if statements could be combined
Design

Line: 32

                  static void scan(Class<?> clazz) {
        for (Method m : clazz.getMethods()) {
            if (m.getDeclaringClass() == clazz) {
                if ((m.getModifiers() & Modifier.STATIC) == 0) {
                    if ((m.getModifiers() & (Modifier.PUBLIC | Modifier.FINAL)) == Modifier.PUBLIC) {
                        fail("Not final: " + m);
                    }
                }
            }

            

Reported by PMD.

These nested if statements could be combined
Design

Line: 33

                      for (Method m : clazz.getMethods()) {
            if (m.getDeclaringClass() == clazz) {
                if ((m.getModifiers() & Modifier.STATIC) == 0) {
                    if ((m.getModifiers() & (Modifier.PUBLIC | Modifier.FINAL)) == Modifier.PUBLIC) {
                        fail("Not final: " + m);
                    }
                }
            }
        }

            

Reported by PMD.

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

Line: 33

                      for (Method m : clazz.getMethods()) {
            if (m.getDeclaringClass() == clazz) {
                if ((m.getModifiers() & Modifier.STATIC) == 0) {
                    if ((m.getModifiers() & (Modifier.PUBLIC | Modifier.FINAL)) == Modifier.PUBLIC) {
                        fail("Not final: " + m);
                    }
                }
            }
        }

            

Reported by PMD.

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

Line: 42

                  }

    @Test
    public void flowable() {
        scan(Flowable.class);
    }

    @Test
    public void observable() {

            

Reported by PMD.

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

Line: 47

                  }

    @Test
    public void observable() {
        scan(Observable.class);
    }

    @Test
    public void single() {

            

Reported by PMD.

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

Line: 52

                  }

    @Test
    public void single() {
        scan(Single.class);
    }

    @Test
    public void completable() {

            

Reported by PMD.

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

Line: 57

                  }

    @Test
    public void completable() {
        scan(Completable.class);
    }

    @Test
    public void maybe() {

            

Reported by PMD.

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

Line: 62

                  }

    @Test
    public void maybe() {
        scan(Maybe.class);
    }
}

            

Reported by PMD.

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

Line: 22

              
import org.junit.Test;

import io.reactivex.rxjava3.core.*;

/**
 * Verifies that instance methods of the base reactive classes are all declared final.
 */
public class PublicFinalMethods {

            

Reported by PMD.

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

Line: 25

               * of method invocations on iterator(), hasNext() and next().
 */
public final class CrashingIterable implements Iterable<Integer> {
    int crashOnIterator;

    final int crashOnHasNext;

    final int crashOnNext;


            

Reported by PMD.

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

Line: 27

              public final class CrashingIterable implements Iterable<Integer> {
    int crashOnIterator;

    final int crashOnHasNext;

    final int crashOnNext;

    public CrashingIterable(int crashOnIterator, int crashOnHasNext, int crashOnNext) {
        this.crashOnIterator = crashOnIterator;

            

Reported by PMD.

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

Line: 29

              
    final int crashOnHasNext;

    final int crashOnNext;

    public CrashingIterable(int crashOnIterator, int crashOnHasNext, int crashOnNext) {
        this.crashOnIterator = crashOnIterator;
        this.crashOnHasNext = crashOnHasNext;
        this.crashOnNext = crashOnNext;

            

Reported by PMD.

Avoid assignments in operands
Error

Line: 39

              
    @Override
    public Iterator<Integer> iterator() {
        if (--crashOnIterator <= 0) {
            throw new TestException("iterator()");
        }
        return new CrashingIterator(crashOnHasNext, crashOnNext);
    }


            

Reported by PMD.

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

Line: 46

                  }

    static final class CrashingIterator implements Iterator<Integer> {
        int crashOnHasNext;

        int crashOnNext;

        int count;


            

Reported by PMD.

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

Line: 48

                  static final class CrashingIterator implements Iterator<Integer> {
        int crashOnHasNext;

        int crashOnNext;

        int count;

        CrashingIterator(int crashOnHasNext, int crashOnNext) {
            this.crashOnHasNext = crashOnHasNext;

            

Reported by PMD.

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

Line: 50

              
        int crashOnNext;

        int count;

        CrashingIterator(int crashOnHasNext, int crashOnNext) {
            this.crashOnHasNext = crashOnHasNext;
            this.crashOnNext = crashOnNext;
        }

            

Reported by PMD.

Avoid assignments in operands
Error

Line: 59

              
        @Override
        public boolean hasNext() {
            if (--crashOnHasNext <= 0) {
                throw new TestException("hasNext()");
            }
            return true;
        }


            

Reported by PMD.

Avoid assignments in operands
Error

Line: 67

              
        @Override
        public Integer next() {
            if (--crashOnNext <= 0) {
                throw new TestException("next()");
            }
            return count++;
        }


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/schedulers/IoScheduledReleaseTest.java
9 issues
JUnit tests should include assert() or fail()
Design

Line: 28

              
    /* This test will be stuck in a deadlock if IoScheduler.USE_SCHEDULED_RELEASE is not set */
    @Test
    public void scheduledRelease() {
        boolean savedScheduledRelease = IoScheduler.USE_SCHEDULED_RELEASE;
        IoScheduler.USE_SCHEDULED_RELEASE = true;
        try {
            Flowable.just("item")
                    .observeOn(Schedulers.io())

            

Reported by PMD.

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

Line: 32

                      boolean savedScheduledRelease = IoScheduler.USE_SCHEDULED_RELEASE;
        IoScheduler.USE_SCHEDULED_RELEASE = true;
        try {
            Flowable.just("item")
                    .observeOn(Schedulers.io())
                    .firstOrError()
                    .map(item -> {
                        for (int i = 0; i < 50; i++) {
                            Completable.complete()

            

Reported by PMD.

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

Line: 32

                      boolean savedScheduledRelease = IoScheduler.USE_SCHEDULED_RELEASE;
        IoScheduler.USE_SCHEDULED_RELEASE = true;
        try {
            Flowable.just("item")
                    .observeOn(Schedulers.io())
                    .firstOrError()
                    .map(item -> {
                        for (int i = 0; i < 50; i++) {
                            Completable.complete()

            

Reported by PMD.

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

Line: 32

                      boolean savedScheduledRelease = IoScheduler.USE_SCHEDULED_RELEASE;
        IoScheduler.USE_SCHEDULED_RELEASE = true;
        try {
            Flowable.just("item")
                    .observeOn(Schedulers.io())
                    .firstOrError()
                    .map(item -> {
                        for (int i = 0; i < 50; i++) {
                            Completable.complete()

            

Reported by PMD.

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

Line: 32

                      boolean savedScheduledRelease = IoScheduler.USE_SCHEDULED_RELEASE;
        IoScheduler.USE_SCHEDULED_RELEASE = true;
        try {
            Flowable.just("item")
                    .observeOn(Schedulers.io())
                    .firstOrError()
                    .map(item -> {
                        for (int i = 0; i < 50; i++) {
                            Completable.complete()

            

Reported by PMD.

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

Line: 32

                      boolean savedScheduledRelease = IoScheduler.USE_SCHEDULED_RELEASE;
        IoScheduler.USE_SCHEDULED_RELEASE = true;
        try {
            Flowable.just("item")
                    .observeOn(Schedulers.io())
                    .firstOrError()
                    .map(item -> {
                        for (int i = 0; i < 50; i++) {
                            Completable.complete()

            

Reported by PMD.

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

Line: 32

                      boolean savedScheduledRelease = IoScheduler.USE_SCHEDULED_RELEASE;
        IoScheduler.USE_SCHEDULED_RELEASE = true;
        try {
            Flowable.just("item")
                    .observeOn(Schedulers.io())
                    .firstOrError()
                    .map(item -> {
                        for (int i = 0; i < 50; i++) {
                            Completable.complete()

            

Reported by PMD.

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

Line: 32

                      boolean savedScheduledRelease = IoScheduler.USE_SCHEDULED_RELEASE;
        IoScheduler.USE_SCHEDULED_RELEASE = true;
        try {
            Flowable.just("item")
                    .observeOn(Schedulers.io())
                    .firstOrError()
                    .map(item -> {
                        for (int i = 0; i < 50; i++) {
                            Completable.complete()

            

Reported by PMD.

Found 'DU'-anomaly for variable 'savedScheduledRelease' (lines '29'-'50').
Error

Line: 29

                  /* This test will be stuck in a deadlock if IoScheduler.USE_SCHEDULED_RELEASE is not set */
    @Test
    public void scheduledRelease() {
        boolean savedScheduledRelease = IoScheduler.USE_SCHEDULED_RELEASE;
        IoScheduler.USE_SCHEDULED_RELEASE = true;
        try {
            Flowable.just("item")
                    .observeOn(Schedulers.io())
                    .firstOrError()

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancelTest.java
9 issues
A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 28

              public class DisposeOnCancelTest extends RxJavaTest {

    @Test
    public void basicCoverage() throws Exception {
        Disposable d = Disposable.empty();

        DisposeOnCancel doc = new DisposeOnCancel(d);

        assertFalse(doc.cancel(true));

            

Reported by PMD.

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

Line: 28

              public class DisposeOnCancelTest extends RxJavaTest {

    @Test
    public void basicCoverage() throws Exception {
        Disposable d = Disposable.empty();

        DisposeOnCancel doc = new DisposeOnCancel(d);

        assertFalse(doc.cancel(true));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 33

              
        DisposeOnCancel doc = new DisposeOnCancel(d);

        assertFalse(doc.cancel(true));

        assertFalse(doc.isCancelled());

        assertFalse(doc.isDone());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 35

              
        assertFalse(doc.cancel(true));

        assertFalse(doc.isCancelled());

        assertFalse(doc.isDone());

        assertNull(doc.get());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

              
        assertFalse(doc.isCancelled());

        assertFalse(doc.isDone());

        assertNull(doc.get());

        assertNull(doc.get(1, TimeUnit.SECONDS));
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

              
        assertFalse(doc.isDone());

        assertNull(doc.get());

        assertNull(doc.get(1, TimeUnit.SECONDS));
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 41

              
        assertNull(doc.get());

        assertNull(doc.get(1, TimeUnit.SECONDS));
    }
}

            

Reported by PMD.

Avoid unused imports such as 'org.junit.Assert'
Design

Line: 16

              
package io.reactivex.rxjava3.internal.schedulers;

import static org.junit.Assert.*;

import java.util.concurrent.TimeUnit;

import org.junit.Test;


            

Reported by PMD.

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

Line: 23

              import org.junit.Test;

import io.reactivex.rxjava3.core.RxJavaTest;
import io.reactivex.rxjava3.disposables.*;

public class DisposeOnCancelTest extends RxJavaTest {

    @Test
    public void basicCoverage() throws Exception {

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnEvent.java
8 issues
Avoid reassigning parameters such as 'e'
Design

Line: 56

                      }

        @Override
        public void onError(Throwable e) {
            try {
                onEvent.accept(e);
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                e = new CompositeException(e, ex);

            

Reported by PMD.

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

Line: 22

              import io.reactivex.rxjava3.functions.Consumer;

public final class CompletableDoOnEvent extends Completable {
    final CompletableSource source;
    final Consumer<? super Throwable> onEvent;

    public CompletableDoOnEvent(final CompletableSource source, final Consumer<? super Throwable> onEvent) {
        this.source = source;
        this.onEvent = onEvent;

            

Reported by PMD.

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

Line: 23

              
public final class CompletableDoOnEvent extends Completable {
    final CompletableSource source;
    final Consumer<? super Throwable> onEvent;

    public CompletableDoOnEvent(final CompletableSource source, final Consumer<? super Throwable> onEvent) {
        this.source = source;
        this.onEvent = onEvent;
    }

            

Reported by PMD.

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

Line: 36

                  }

    final class DoOnEvent implements CompletableObserver {
        private final CompletableObserver observer;

        DoOnEvent(CompletableObserver observer) {
            this.observer = observer;
        }


            

Reported by PMD.

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

Line: 46

                      public void onComplete() {
            try {
                onEvent.accept(null);
            } catch (Throwable e) {
                Exceptions.throwIfFatal(e);
                observer.onError(e);
                return;
            }


            

Reported by PMD.

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

Line: 59

                      public void onError(Throwable e) {
            try {
                onEvent.accept(e);
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                e = new CompositeException(e, ex);
            }

            observer.onError(e);

            

Reported by PMD.

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

Line: 16

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

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Consumer;

public final class CompletableDoOnEvent extends Completable {

            

Reported by PMD.

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

Line: 18

              
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Consumer;

public final class CompletableDoOnEvent extends Completable {
    final CompletableSource source;
    final Consumer<? super Throwable> onEvent;

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/util/MergerBiFunction.java
8 issues
The class 'MergerBiFunction' has a Standard Cyclomatic Complexity of 6 (Highest = 11).
Design

Line: 24

               * A BiFunction that merges two Lists into a new list.
 * @param <T> the value type
 */
public final class MergerBiFunction<T> implements BiFunction<List<T>, List<T>, List<T>> {

    final Comparator<? super T> comparator;

    public MergerBiFunction(Comparator<? super T> comparator) {
        this.comparator = comparator;

            

Reported by PMD.

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

Line: 24

               * A BiFunction that merges two Lists into a new list.
 * @param <T> the value type
 */
public final class MergerBiFunction<T> implements BiFunction<List<T>, List<T>, List<T>> {

    final Comparator<? super T> comparator;

    public MergerBiFunction(Comparator<? super T> comparator) {
        this.comparator = comparator;

            

Reported by PMD.

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

Line: 26

               */
public final class MergerBiFunction<T> implements BiFunction<List<T>, List<T>, List<T>> {

    final Comparator<? super T> comparator;

    public MergerBiFunction(Comparator<? super T> comparator) {
        this.comparator = comparator;
    }


            

Reported by PMD.

The method 'apply' has a Modified Cyclomatic Complexity of 11.
Design

Line: 33

                  }

    @Override
    public List<T> apply(List<T> a, List<T> b) {
        int n = a.size() + b.size();
        if (n == 0) {
            return new ArrayList<>();
        }
        List<T> both = new ArrayList<>(n);

            

Reported by PMD.

The method 'apply' has a Standard Cyclomatic Complexity of 11.
Design

Line: 33

                  }

    @Override
    public List<T> apply(List<T> a, List<T> b) {
        int n = a.size() + b.size();
        if (n == 0) {
            return new ArrayList<>();
        }
        List<T> both = new ArrayList<>(n);

            

Reported by PMD.

The method 'apply(List, List)' has a cyclomatic complexity of 12.
Design

Line: 33

                  }

    @Override
    public List<T> apply(List<T> a, List<T> b) {
        int n = a.size() + b.size();
        if (n == 0) {
            return new ArrayList<>();
        }
        List<T> both = new ArrayList<>(n);

            

Reported by PMD.

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

Line: 49

                      while (s1 != null && s2 != null) {
            if (comparator.compare(s1, s2) < 0) { // s1 comes before s2
                both.add(s1);
                s1 = at.hasNext() ? at.next() : null;
            } else {
                both.add(s2);
                s2 = bt.hasNext() ? bt.next() : null;
            }
        }

            

Reported by PMD.

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

Line: 52

                              s1 = at.hasNext() ? at.next() : null;
            } else {
                both.add(s2);
                s2 = bt.hasNext() ? bt.next() : null;
            }
        }

        if (s1 != null) {
            both.add(s1);

            

Reported by PMD.

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

Line: 30

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

    final Function<? super Throwable, ? extends T> itemSupplier;

    public MaybeOnErrorReturn(MaybeSource<T> source,
            Function<? super Throwable, ? extends T> itemSupplier) {
        super(source);
        this.itemSupplier = itemSupplier;

            

Reported by PMD.

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

Line: 45

              
    static final class OnErrorReturnMaybeObserver<T> implements MaybeObserver<T>, Disposable {

        final MaybeObserver<? super T> downstream;

        final Function<? super Throwable, ? extends T> itemSupplier;

        Disposable upstream;


            

Reported by PMD.

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

Line: 47

              
        final MaybeObserver<? super T> downstream;

        final Function<? super Throwable, ? extends T> itemSupplier;

        Disposable upstream;

        OnErrorReturnMaybeObserver(MaybeObserver<? super T> actual,
                Function<? super Throwable, ? extends T> valueSupplier) {

            

Reported by PMD.

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

Line: 49

              
        final Function<? super Throwable, ? extends T> itemSupplier;

        Disposable upstream;

        OnErrorReturnMaybeObserver(MaybeObserver<? super T> actual,
                Function<? super Throwable, ? extends T> valueSupplier) {
            this.downstream = actual;
            this.itemSupplier = valueSupplier;

            

Reported by PMD.

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

Line: 87

              
            try {
                v = Objects.requireNonNull(itemSupplier.apply(e), "The itemSupplier returned a null value");
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                downstream.onError(new CompositeException(e, ex));
                return;
            }


            

Reported by PMD.

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

Line: 16

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

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


            

Reported by PMD.

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

Line: 18

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

import java.util.Objects;


            

Reported by PMD.

Found 'DU'-anomaly for variable 'v' (lines '86'-'94').
Error

Line: 86

                          T v;

            try {
                v = Objects.requireNonNull(itemSupplier.apply(e), "The itemSupplier returned a null value");
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                downstream.onError(new CompositeException(e, ex));
                return;
            }

            

Reported by PMD.

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

Line: 31

               */
public final class SingleDoAfterTerminate<T> extends Single<T> {

    final SingleSource<T> source;

    final Action onAfterTerminate;

    public SingleDoAfterTerminate(SingleSource<T> source, Action onAfterTerminate) {
        this.source = source;

            

Reported by PMD.

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

Line: 33

              
    final SingleSource<T> source;

    final Action onAfterTerminate;

    public SingleDoAfterTerminate(SingleSource<T> source, Action onAfterTerminate) {
        this.source = source;
        this.onAfterTerminate = onAfterTerminate;
    }

            

Reported by PMD.

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

Line: 47

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

        final SingleObserver<? super T> downstream;

        final Action onAfterTerminate;

        Disposable upstream;


            

Reported by PMD.

Field onAfterTerminate has the same name as a method
Error

Line: 49

              
        final SingleObserver<? super T> downstream;

        final Action onAfterTerminate;

        Disposable upstream;

        DoAfterTerminateObserver(SingleObserver<? super T> actual, Action onAfterTerminate) {
            this.downstream = actual;

            

Reported by PMD.

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

Line: 49

              
        final SingleObserver<? super T> downstream;

        final Action onAfterTerminate;

        Disposable upstream;

        DoAfterTerminateObserver(SingleObserver<? super T> actual, Action onAfterTerminate) {
            this.downstream = actual;

            

Reported by PMD.

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

Line: 51

              
        final Action onAfterTerminate;

        Disposable upstream;

        DoAfterTerminateObserver(SingleObserver<? super T> actual, Action onAfterTerminate) {
            this.downstream = actual;
            this.onAfterTerminate = onAfterTerminate;
        }

            

Reported by PMD.

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

Line: 94

                      private void onAfterTerminate() {
            try {
                onAfterTerminate.run();
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                RxJavaPlugins.onError(ex);
            }
        }
    }

            

Reported by PMD.

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

Line: 16

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

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.internal.disposables.DisposableHelper;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;

            

Reported by PMD.