The following issues were found

src/test/java/io/reactivex/rxjava3/internal/functions/ObjectHelperTest.java
10 issues
JUnit tests should include assert() or fail()
Design

Line: 26

              public class ObjectHelperTest extends RxJavaTest {

    @Test
    public void utilityClass() {
        TestHelper.checkUtilityClass(ObjectHelper.class);
    }

    @Test
    public void verifyPositiveInt() throws Exception {

            

Reported by PMD.

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

Line: 31

                  }

    @Test
    public void verifyPositiveInt() throws Exception {
        assertEquals(1, ObjectHelper.verifyPositive(1, "param"));
    }

    @Test
    public void verifyPositiveLong() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 32

              
    @Test
    public void verifyPositiveInt() throws Exception {
        assertEquals(1, ObjectHelper.verifyPositive(1, "param"));
    }

    @Test
    public void verifyPositiveLong() throws Exception {
        assertEquals(1L, ObjectHelper.verifyPositive(1L, "param"));

            

Reported by PMD.

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

Line: 32

              
    @Test
    public void verifyPositiveInt() throws Exception {
        assertEquals(1, ObjectHelper.verifyPositive(1, "param"));
    }

    @Test
    public void verifyPositiveLong() throws Exception {
        assertEquals(1L, ObjectHelper.verifyPositive(1L, "param"));

            

Reported by PMD.

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

Line: 36

                  }

    @Test
    public void verifyPositiveLong() throws Exception {
        assertEquals(1L, ObjectHelper.verifyPositive(1L, "param"));
    }

    @Test(expected = IllegalArgumentException.class)
    public void verifyPositiveIntFail() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

              
    @Test
    public void verifyPositiveLong() throws Exception {
        assertEquals(1L, ObjectHelper.verifyPositive(1L, "param"));
    }

    @Test(expected = IllegalArgumentException.class)
    public void verifyPositiveIntFail() throws Exception {
        assertEquals(-1, ObjectHelper.verifyPositive(-1, "param"));

            

Reported by PMD.

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

Line: 41

                  }

    @Test(expected = IllegalArgumentException.class)
    public void verifyPositiveIntFail() throws Exception {
        assertEquals(-1, ObjectHelper.verifyPositive(-1, "param"));
    }

    @Test(expected = IllegalArgumentException.class)
    public void verifyPositiveLongFail() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 42

              
    @Test(expected = IllegalArgumentException.class)
    public void verifyPositiveIntFail() throws Exception {
        assertEquals(-1, ObjectHelper.verifyPositive(-1, "param"));
    }

    @Test(expected = IllegalArgumentException.class)
    public void verifyPositiveLongFail() throws Exception {
        assertEquals(-1L, ObjectHelper.verifyPositive(-1L, "param"));

            

Reported by PMD.

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

Line: 46

                  }

    @Test(expected = IllegalArgumentException.class)
    public void verifyPositiveLongFail() throws Exception {
        assertEquals(-1L, ObjectHelper.verifyPositive(-1L, "param"));
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 47

              
    @Test(expected = IllegalArgumentException.class)
    public void verifyPositiveLongFail() throws Exception {
        assertEquals(-1L, ObjectHelper.verifyPositive(-1L, "param"));
    }
}

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelperTest.java
10 issues
JUnit tests should include assert() or fail()
Design

Line: 26

              public class ObservableInternalHelperTest extends RxJavaTest {

    @Test
    public void utilityClass() {
        TestHelper.checkUtilityClass(ObservableInternalHelper.class);
    }

    @Test
    public void enums() {

            

Reported by PMD.

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

Line: 31

                  }

    @Test
    public void enums() {
        assertNotNull(ObservableInternalHelper.MapToInt.values()[0]);
        assertNotNull(ObservableInternalHelper.MapToInt.valueOf("INSTANCE"));

    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 32

              
    @Test
    public void enums() {
        assertNotNull(ObservableInternalHelper.MapToInt.values()[0]);
        assertNotNull(ObservableInternalHelper.MapToInt.valueOf("INSTANCE"));

    }

    @Test

            

Reported by PMD.

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

Line: 32

              
    @Test
    public void enums() {
        assertNotNull(ObservableInternalHelper.MapToInt.values()[0]);
        assertNotNull(ObservableInternalHelper.MapToInt.valueOf("INSTANCE"));

    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 33

                  @Test
    public void enums() {
        assertNotNull(ObservableInternalHelper.MapToInt.values()[0]);
        assertNotNull(ObservableInternalHelper.MapToInt.valueOf("INSTANCE"));

    }

    @Test
    public void mapToInt() throws Exception {

            

Reported by PMD.

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

Line: 33

                  @Test
    public void enums() {
        assertNotNull(ObservableInternalHelper.MapToInt.values()[0]);
        assertNotNull(ObservableInternalHelper.MapToInt.valueOf("INSTANCE"));

    }

    @Test
    public void mapToInt() throws Exception {

            

Reported by PMD.

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

Line: 38

                  }

    @Test
    public void mapToInt() throws Exception {
        assertEquals(0, ObservableInternalHelper.MapToInt.INSTANCE.apply(null));
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

              
    @Test
    public void mapToInt() throws Exception {
        assertEquals(0, ObservableInternalHelper.MapToInt.INSTANCE.apply(null));
    }
}

            

Reported by PMD.

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

Line: 39

              
    @Test
    public void mapToInt() throws Exception {
        assertEquals(0, ObservableInternalHelper.MapToInt.INSTANCE.apply(null));
    }
}

            

Reported by PMD.

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

Line: 16

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

import static org.junit.Assert.*;

import org.junit.Test;

import io.reactivex.rxjava3.core.RxJavaTest;
import io.reactivex.rxjava3.testsupport.TestHelper;

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSafeSubscribeTest.java
10 issues
JUnit tests should include assert() or fail()
Design

Line: 34

              public class CompletableSafeSubscribeTest {

    @Test
    public void normalError() throws Throwable  {
        TestHelper.withErrorTracking(errors -> {
            CompletableObserver consumer = mock(CompletableObserver.class);

            Completable.error(new TestException())
            .safeSubscribe(consumer);

            

Reported by PMD.

Do not add empty strings
Performance

Line: 46

                          order.verify(consumer).onError(any(TestException.class));
            order.verifyNoMoreInteractions();

            assertTrue("" + errors, errors.isEmpty());
        });
    }

    @Test
    public void normalEmpty() throws Throwable  {

            

Reported by PMD.

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

Line: 51

                  }

    @Test
    public void normalEmpty() throws Throwable  {
        TestHelper.withErrorTracking(errors -> {
            CompletableObserver consumer = mock(CompletableObserver.class);

            Completable.complete()
            .safeSubscribe(consumer);

            

Reported by PMD.

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

Line: 66

                  }

    @Test
    public void onSubscribeCrash() throws Throwable {
        TestHelper.withErrorTracking(errors -> {
            CompletableObserver consumer = mock(CompletableObserver.class);
            doThrow(new TestException()).when(consumer).onSubscribe(any());

            Disposable d = Disposable.empty();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 88

                          order.verify(consumer).onSubscribe(any(Disposable.class));
            order.verifyNoMoreInteractions();

            assertTrue(d.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class);
            TestHelper.assertUndeliverable(errors, 1, IOException.class);
        });
    }

            

Reported by PMD.

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

Line: 96

                  }

    @Test
    public void onErrorCrash() throws Throwable  {
        TestHelper.withErrorTracking(errors -> {
            CompletableObserver consumer = mock(CompletableObserver.class);
            doThrow(new TestException()).when(consumer).onError(any());

            new Completable() {

            

Reported by PMD.

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

Line: 125

                  }

    @Test
    public void onCompleteCrash() throws Throwable  {
        TestHelper.withErrorTracking(errors -> {
            CompletableObserver consumer = mock(CompletableObserver.class);
            doThrow(new TestException()).when(consumer).onComplete();

            new Completable() {

            

Reported by PMD.

Avoid unused imports such as 'org.mockito.Mockito'
Design

Line: 18

              
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;

import java.io.IOException;

import org.junit.Test;
import org.mockito.InOrder;

            

Reported by PMD.

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

Line: 26

              import org.mockito.InOrder;

import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class CompletableSafeSubscribeTest {

            

Reported by PMD.

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

Line: 28

              import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class CompletableSafeSubscribeTest {

    @Test

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/subscribers/SerializedSubscriber.java
10 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 37

               * @param <T> the value type
 */
public final class SerializedSubscriber<T> implements FlowableSubscriber<T>, Subscription {
    final Subscriber<? super T> downstream;
    final boolean delayError;

    static final int QUEUE_LINK_SIZE = 4;

    Subscription upstream;

            

Reported by PMD.

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

Line: 38

               */
public final class SerializedSubscriber<T> implements FlowableSubscriber<T>, Subscription {
    final Subscriber<? super T> downstream;
    final boolean delayError;

    static final int QUEUE_LINK_SIZE = 4;

    Subscription upstream;


            

Reported by PMD.

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

Line: 42

              
    static final int QUEUE_LINK_SIZE = 4;

    Subscription upstream;

    boolean emitting;
    AppendOnlyLinkedArrayList<Object> queue;

    volatile boolean done;

            

Reported by PMD.

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

Line: 44

              
    Subscription upstream;

    boolean emitting;
    AppendOnlyLinkedArrayList<Object> queue;

    volatile boolean done;

    /**

            

Reported by PMD.

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

Line: 45

                  Subscription upstream;

    boolean emitting;
    AppendOnlyLinkedArrayList<Object> queue;

    volatile boolean done;

    /**
     * Construct a {@code SerializedSubscriber} by wrapping the given actual {@link Subscriber}.

            

Reported by PMD.

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

Line: 47

                  boolean emitting;
    AppendOnlyLinkedArrayList<Object> queue;

    volatile boolean done;

    /**
     * Construct a {@code SerializedSubscriber} by wrapping the given actual {@link Subscriber}.
     * @param downstream the actual {@code Subscriber}, not null (not verified)
     */

            

Reported by PMD.

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

Line: 184

                                  emitting = false;
                    return;
                }
                queue = null;
            }

            if (q.accept(downstream)) {
                return;
            }

            

Reported by PMD.

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

Line: 187

                              queue = null;
            }

            if (q.accept(downstream)) {
                return;
            }
        }
    }


            

Reported by PMD.

Avoid unused imports such as 'org.reactivestreams'
Design

Line: 16

              
package io.reactivex.rxjava3.subscribers;

import org.reactivestreams.*;

import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.FlowableSubscriber;
import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper;
import io.reactivex.rxjava3.internal.util.*;

            

Reported by PMD.

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

Line: 21

              import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.FlowableSubscriber;
import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper;
import io.reactivex.rxjava3.internal.util.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;

/**
 * Serializes access to the {@link Subscriber#onNext(Object)}, {@link Subscriber#onError(Throwable)} and
 * {@link Subscriber#onComplete()} methods of another {@link Subscriber}.

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTerminateTest.java
10 issues
JUnit assertions should include a message
Design

Line: 43

                      .test()
        .assertResult(1);

        assertTrue(atomicBoolean.get());
    }

    @Test
    public void doOnTerminateError() {
        final AtomicBoolean atomicBoolean = new AtomicBoolean();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 58

                      .test()
        .assertFailure(TestException.class);

        assertTrue(atomicBoolean.get());
    }

    @Test
    public void doOnTerminateSuccessCrash() {
        Single.just(1).doOnTerminate(new Action() {

            

Reported by PMD.

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

Line: 62

                  }

    @Test
    public void doOnTerminateSuccessCrash() {
        Single.just(1).doOnTerminate(new Action() {
            @Override
            public void run() throws Exception {
                throw new TestException();
            }

            

Reported by PMD.

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

Line: 74

                  }

    @Test
    public void doOnTerminateErrorCrash() {
        TestObserverEx<Object> to = Single.error(new TestException("Outer")).doOnTerminate(new Action() {
            @Override
            public void run() {
                throw new TestException("Inner");
            }

            

Reported by PMD.

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

Line: 84

                      .to(TestHelper.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.

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

Line: 23

              
import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.testsupport.*;

public class SingleDoOnTerminateTest extends RxJavaTest {

            

Reported by PMD.

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

Line: 24

              import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.testsupport.*;

public class SingleDoOnTerminateTest extends RxJavaTest {


            

Reported by PMD.

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

Line: 26

              import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.testsupport.*;

public class SingleDoOnTerminateTest extends RxJavaTest {

    @Test
    public void doOnTerminateSuccess() {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'to' (lines '75'-'88').
Error

Line: 75

              
    @Test
    public void doOnTerminateErrorCrash() {
        TestObserverEx<Object> to = Single.error(new TestException("Outer")).doOnTerminate(new Action() {
            @Override
            public void run() {
                throw new TestException("Inner");
            }
        })

            

Reported by PMD.

Found 'DU'-anomaly for variable 'to' (lines '75'-'88').
Error

Line: 75

              
    @Test
    public void doOnTerminateErrorCrash() {
        TestObserverEx<Object> to = Single.error(new TestException("Outer")).doOnTerminate(new Action() {
            @Override
            public void run() {
                throw new TestException("Inner");
            }
        })

            

Reported by PMD.

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

Line: 33

              public class MaybeDoOnEventTest extends RxJavaTest {

    @Test
    public void dispose() {
        TestHelper.checkDisposed(PublishSubject.<Integer>create().singleElement().doOnEvent(new BiConsumer<Integer, Throwable>() {
            @Override
            public void accept(Integer v, Throwable e) throws Exception {
                // irrelevant
            }

            

Reported by PMD.

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

Line: 43

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeMaybe(new Function<Maybe<Integer>, MaybeSource<Integer>>() {
            @Override
            public MaybeSource<Integer> apply(Maybe<Integer> m) throws Exception {
                return m.doOnEvent(new BiConsumer<Integer, Throwable>() {
                    @Override

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 81

                          .to(TestHelper.<Integer>testConsumer())
            .assertFailureAndMessage(TestException.class, "First");

            assertTrue(bs.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class, "Second");
        } finally {
            RxJavaPlugins.reset();
        }

            

Reported by PMD.

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

Line: 81

                          .to(TestHelper.<Integer>testConsumer())
            .assertFailureAndMessage(TestException.class, "First");

            assertTrue(bs.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class, "Second");
        } finally {
            RxJavaPlugins.reset();
        }

            

Reported by PMD.

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

Line: 22

              
import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.subjects.PublishSubject;

            

Reported by PMD.

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

Line: 23

              import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.TestHelper;

            

Reported by PMD.

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

Line: 25

              import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class MaybeDoOnEventTest extends RxJavaTest {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'errors' (lines '59'-'87').
Error

Line: 59

              
    @Test
    public void onSubscribeCrash() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            final Disposable bs = Disposable.empty();

            new Maybe<Integer>() {
                @Override

            

Reported by PMD.

Found 'DU'-anomaly for variable 'errors' (lines '59'-'87').
Error

Line: 59

              
    @Test
    public void onSubscribeCrash() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            final Disposable bs = Disposable.empty();

            new Maybe<Integer>() {
                @Override

            

Reported by PMD.

Found 'DU'-anomaly for variable 'errors' (lines '59'-'87').
Error

Line: 59

              
    @Test
    public void onSubscribeCrash() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            final Disposable bs = Disposable.empty();

            new Maybe<Integer>() {
                @Override

            

Reported by PMD.

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

Line: 29

              import java.util.Objects;

public final class FlowableRetryWhen<T> extends AbstractFlowableWithUpstream<T, T> {
    final Function<? super Flowable<Throwable>, ? extends Publisher<?>> handler;

    public FlowableRetryWhen(Flowable<T> source,
            Function<? super Flowable<Throwable>, ? extends Publisher<?>> handler) {
        super(source);
        this.handler = handler;

            

Reported by PMD.

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

Line: 41

                  public void subscribeActual(Subscriber<? super T> s) {
        SerializedSubscriber<T> z = new SerializedSubscriber<>(s);

        FlowableProcessor<Throwable> processor = UnicastProcessor.<Throwable>create(8).toSerialized();

        Publisher<?> when;

        try {
            when = Objects.requireNonNull(handler.apply(processor), "handler returned a null Publisher");

            

Reported by PMD.

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

Line: 41

                  public void subscribeActual(Subscriber<? super T> s) {
        SerializedSubscriber<T> z = new SerializedSubscriber<>(s);

        FlowableProcessor<Throwable> processor = UnicastProcessor.<Throwable>create(8).toSerialized();

        Publisher<?> when;

        try {
            when = Objects.requireNonNull(handler.apply(processor), "handler returned a null Publisher");

            

Reported by PMD.

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

Line: 47

              
        try {
            when = Objects.requireNonNull(handler.apply(processor), "handler returned a null Publisher");
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            EmptySubscription.error(ex, s);
            return;
        }


            

Reported by PMD.

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

Line: 61

              
        s.onSubscribe(subscriber);

        when.subscribe(receiver);

        receiver.onNext(0);
    }

    static final class RetryWhenSubscriber<T> extends WhenSourceSubscriber<T, Throwable> {

            

Reported by PMD.

Avoid unused imports such as 'org.reactivestreams'
Design

Line: 16

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

import org.reactivestreams.*;

import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.operators.flowable.FlowableRepeatWhen.*;

            

Reported by PMD.

Avoid unused imports such as 'io.reactivex.rxjava3.internal.operators.flowable.FlowableRepeatWhen'
Design

Line: 21

              import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.operators.flowable.FlowableRepeatWhen.*;
import io.reactivex.rxjava3.internal.subscriptions.EmptySubscription;
import io.reactivex.rxjava3.processors.*;
import io.reactivex.rxjava3.subscribers.SerializedSubscriber;

import java.util.Objects;

            

Reported by PMD.

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

Line: 23

              import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.operators.flowable.FlowableRepeatWhen.*;
import io.reactivex.rxjava3.internal.subscriptions.EmptySubscription;
import io.reactivex.rxjava3.processors.*;
import io.reactivex.rxjava3.subscribers.SerializedSubscriber;

import java.util.Objects;

public final class FlowableRetryWhen<T> extends AbstractFlowableWithUpstream<T, T> {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'z' (lines '39'-'64').
Error

Line: 39

              
    @Override
    public void subscribeActual(Subscriber<? super T> s) {
        SerializedSubscriber<T> z = new SerializedSubscriber<>(s);

        FlowableProcessor<Throwable> processor = UnicastProcessor.<Throwable>create(8).toSerialized();

        Publisher<?> when;


            

Reported by PMD.

Found 'DU'-anomaly for variable 'when' (lines '46'-'64').
Error

Line: 46

                      Publisher<?> when;

        try {
            when = Objects.requireNonNull(handler.apply(processor), "handler returned a null Publisher");
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            EmptySubscription.error(ex, s);
            return;
        }

            

Reported by PMD.

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

Line: 25

              
public final class ObservableSampleWithObservable<T> extends AbstractObservableWithUpstream<T, T> {

    final ObservableSource<?> other;

    final boolean emitLast;

    public ObservableSampleWithObservable(ObservableSource<T> source, ObservableSource<?> other, boolean emitLast) {
        super(source);

            

Reported by PMD.

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

Line: 27

              
    final ObservableSource<?> other;

    final boolean emitLast;

    public ObservableSampleWithObservable(ObservableSource<T> source, ObservableSource<?> other, boolean emitLast) {
        super(source);
        this.other = other;
        this.emitLast = emitLast;

            

Reported by PMD.

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

Line: 50

              
        private static final long serialVersionUID = -3517602651313910099L;

        final Observer<? super T> downstream;
        final ObservableSource<?> sampler;

        final AtomicReference<Disposable> other = new AtomicReference<>();

        Disposable upstream;

            

Reported by PMD.

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

Line: 51

                      private static final long serialVersionUID = -3517602651313910099L;

        final Observer<? super T> downstream;
        final ObservableSource<?> sampler;

        final AtomicReference<Disposable> other = new AtomicReference<>();

        Disposable upstream;


            

Reported by PMD.

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

Line: 53

                      final Observer<? super T> downstream;
        final ObservableSource<?> sampler;

        final AtomicReference<Disposable> other = new AtomicReference<>();

        Disposable upstream;

        SampleMainObserver(Observer<? super T> actual, ObservableSource<?> other) {
            this.downstream = actual;

            

Reported by PMD.

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

Line: 55

              
        final AtomicReference<Disposable> other = new AtomicReference<>();

        Disposable upstream;

        SampleMainObserver(Observer<? super T> actual, ObservableSource<?> other) {
            this.downstream = actual;
            this.sampler = other;
        }

            

Reported by PMD.

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

Line: 128

                  }

    static final class SamplerObserver<T> implements Observer<Object> {
        final SampleMainObserver<T> parent;
        SamplerObserver(SampleMainObserver<T> parent) {
            this.parent = parent;

        }


            

Reported by PMD.

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

Line: 178

              
        private static final long serialVersionUID = -3029755663834015785L;

        final AtomicInteger wip;

        volatile boolean done;

        SampleMainEmitLast(Observer<? super T> actual, ObservableSource<?> other) {
            super(actual, other);

            

Reported by PMD.

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

Line: 180

              
        final AtomicInteger wip;

        volatile boolean done;

        SampleMainEmitLast(Observer<? super T> actual, ObservableSource<?> other) {
            super(actual, other);
            this.wip = new AtomicInteger();
        }

            

Reported by PMD.

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

Line: 18

              
import java.util.concurrent.atomic.*;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.internal.disposables.DisposableHelper;
import io.reactivex.rxjava3.observers.SerializedObserver;

public final class ObservableSampleWithObservable<T> extends AbstractObservableWithUpstream<T, T> {

            

Reported by PMD.

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

Line: 33

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

    final Maybe<T> source;

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

    public MaybeMapOptional(Maybe<T> source, Function<? super T, Optional<? extends R>> mapper) {
        this.source = source;

            

Reported by PMD.

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

Line: 35

              
    final Maybe<T> source;

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

    public MaybeMapOptional(Maybe<T> source, Function<? super T, Optional<? extends R>> mapper) {
        this.source = source;
        this.mapper = mapper;
    }

            

Reported by PMD.

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

Line: 49

              
    static final class MapOptionalMaybeObserver<T, R> implements MaybeObserver<T>, Disposable {

        final MaybeObserver<? super R> downstream;

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

        Disposable upstream;


            

Reported by PMD.

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

Line: 51

              
        final MaybeObserver<? super R> downstream;

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

        Disposable upstream;

        MapOptionalMaybeObserver(MaybeObserver<? super R> downstream, Function<? super T, Optional<? extends R>> mapper) {
            this.downstream = downstream;

            

Reported by PMD.

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

Line: 53

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

        Disposable upstream;

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

            

Reported by PMD.

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

Line: 64

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

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

            

Reported by PMD.

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

Line: 87

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


            

Reported by PMD.

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

Line: 93

                              return;
            }

            if (v.isPresent()) {
                downstream.onSuccess(v.get());
            } else {
                downstream.onComplete();
            }
        }

            

Reported by PMD.

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

Line: 18

              
import java.util.*;

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


            

Reported by PMD.

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

Line: 86

                          Optional<? extends R> v;

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

            

Reported by PMD.

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

Line: 34

               */
public final class ObservableFlattenIterable<T, R> extends AbstractObservableWithUpstream<T, R> {

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

    public ObservableFlattenIterable(ObservableSource<T> source,
            Function<? super T, ? extends Iterable<? extends R>> mapper) {
        super(source);
        this.mapper = mapper;

            

Reported by PMD.

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

Line: 48

                  }

    static final class FlattenIterableObserver<T, R> implements Observer<T>, Disposable {
        final Observer<? super R> downstream;

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

        Disposable upstream;


            

Reported by PMD.

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

Line: 50

                  static final class FlattenIterableObserver<T, R> implements Observer<T>, Disposable {
        final Observer<? super R> downstream;

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

        Disposable upstream;

        FlattenIterableObserver(Observer<? super R> actual, Function<? super T, ? extends Iterable<? extends R>> mapper) {
            this.downstream = actual;

            

Reported by PMD.

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

Line: 52

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

        Disposable upstream;

        FlattenIterableObserver(Observer<? super R> actual, Function<? super T, ? extends Iterable<? extends R>> mapper) {
            this.downstream = actual;
            this.mapper = mapper;
        }

            

Reported by PMD.

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

Line: 77

                          Iterator<? extends R> it;

            try {
                it = mapper.apply(value).iterator();
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                upstream.dispose();
                onError(ex);
                return;

            

Reported by PMD.

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

Line: 78

              
            try {
                it = mapper.apply(value).iterator();
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                upstream.dispose();
                onError(ex);
                return;
            }

            

Reported by PMD.

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

Line: 92

              
                try {
                    b = it.hasNext();
                } catch (Throwable ex) {
                    Exceptions.throwIfFatal(ex);
                    upstream.dispose();
                    onError(ex);
                    return;
                }

            

Reported by PMD.

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

Line: 104

              
                    try {
                        v = Objects.requireNonNull(it.next(), "The iterator returned a null value");
                    } catch (Throwable ex) {
                        Exceptions.throwIfFatal(ex);
                        upstream.dispose();
                        onError(ex);
                        return;
                    }

            

Reported by PMD.

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

Line: 19

              import java.util.Iterator;
import java.util.Objects;

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

            

Reported by PMD.

Found 'DU'-anomaly for variable 'it' (lines '77'-'116').
Error

Line: 77

                          Iterator<? extends R> it;

            try {
                it = mapper.apply(value).iterator();
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                upstream.dispose();
                onError(ex);
                return;

            

Reported by PMD.