diff --git a/build.gradle b/build.gradle
index 06e27ddded3..6aedbf1d045 100644
--- a/build.gradle
+++ b/build.gradle
@@ -297,7 +297,7 @@ if (project.hasProperty("releaseMode")) {
}
mavenPublishing {
// or when publishing to https://central.sonatype.com/
- publishToMavenCentral(true, DeploymentValidation.PUBLISHED)
+ publishToMavenCentral(true, com.vanniktech.maven.publish.DeploymentValidation.PUBLISHED)
// signAllPublications()
}
diff --git a/src/main/java/io/reactivex/rxjava4/disposables/Disposable.java b/src/main/java/io/reactivex/rxjava4/disposables/Disposable.java
index eaedde68adc..e4cca1726a2 100644
--- a/src/main/java/io/reactivex/rxjava4/disposables/Disposable.java
+++ b/src/main/java/io/reactivex/rxjava4/disposables/Disposable.java
@@ -25,7 +25,7 @@
/**
* Represents a disposable resource.
*/
-public interface Disposable extends AutoCloseable {
+public interface Disposable {
/**
* Dispose the resource, the operation should be idempotent.
*/
@@ -37,14 +37,6 @@ public interface Disposable extends AutoCloseable {
*/
boolean isDisposed();
- /**
- * Dispose the resource, the operation should be idempotent.
- * @since 4.0.0
- */
- default void close() {
- dispose();
- }
-
/**
* Construct a {@code Disposable} by wrapping a {@link Runnable} that is
* executed exactly once when the {@code Disposable} is disposed.
@@ -75,9 +67,9 @@ static Disposable fromAction(@NonNull Action action) {
/**
* Construct a {@code Disposable} by wrapping a {@link Future} that is
- * cancelled exactly once when the {@code Disposable} is disposed.
+ * canceled exactly once when the {@code Disposable} is disposed.
*
- * The {@code Future} is cancelled with {@code mayInterruptIfRunning == true}.
+ * The {@code Future} is canceled with {@code mayInterruptIfRunning == true}.
* @param future the {@code Future} to wrap
* @return the new {@code Disposable} instance
* @throws NullPointerException if {@code future} is {@code null}
@@ -92,7 +84,7 @@ static Disposable fromFuture(@NonNull Future> future) {
/**
* Construct a {@code Disposable} by wrapping a {@link Future} that is
- * cancelled exactly once when the {@code Disposable} is disposed.
+ * canceled exactly once when the {@code Disposable} is disposed.
* @param future the {@code Future} to wrap
* @param allowInterrupt if true, the future cancel happens via {@code Future.cancel(true)}
* @return the new {@code Disposable} instance
@@ -107,7 +99,7 @@ static Disposable fromFuture(@NonNull Future> future, boolean allowInterrupt)
/**
* Construct a {@code Disposable} by wrapping a {@link Subscription} that is
- * cancelled exactly once when the {@code Disposable} is disposed.
+ * canceled exactly once when the {@code Disposable} is disposed.
* @param subscription the {@code Runnable} to wrap
* @return the new {@code Disposable} instance
* @throws NullPointerException if {@code subscription} is {@code null}
@@ -147,6 +139,17 @@ static AutoCloseable toAutoCloseable(@NonNull Disposable disposable) {
return disposable::dispose;
}
+ /**
+ * Wraps this {@code Disposable} into an {@link AutoCloseable} instance
+ * that can be used with try-with-resources constructs.
+ * @return the new {@code AutoCloseable} instance
+ * @since 4.0.0
+ */
+ @NonNull
+ default AutoCloseable asAutoCloseable() {
+ return this::dispose;
+ }
+
/**
* Returns a new, non-disposed {@code Disposable} instance.
* @return a new, non-disposed {@code Disposable} instance
diff --git a/src/main/java/io/reactivex/rxjava4/disposables/DisposableContainer.java b/src/main/java/io/reactivex/rxjava4/disposables/DisposableContainer.java
index 84bb3e9c46e..87cb04e948c 100644
--- a/src/main/java/io/reactivex/rxjava4/disposables/DisposableContainer.java
+++ b/src/main/java/io/reactivex/rxjava4/disposables/DisposableContainer.java
@@ -95,13 +95,13 @@ default Disposable subscribe(Disposable d) {
* cases where the dispose signal has no side effects to work with.
* @since 4.0.0
*/
- static DisposableContainer NEVER = new NeverDisposableContainer();
+ DisposableContainer NEVER = new NeverDisposableContainer();
/**
* Implementation of a never disposable container.
* @since 4.0.0
*/
- static record NeverDisposableContainer() implements DisposableContainer {
+ record NeverDisposableContainer() implements DisposableContainer {
@Override
public void dispose() {
diff --git a/src/main/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableRefCount.java b/src/main/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableRefCount.java
index 47eaa538f8f..f47c6970eb2 100644
--- a/src/main/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableRefCount.java
+++ b/src/main/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableRefCount.java
@@ -92,7 +92,6 @@ protected void subscribeActual(Subscriber super T> s) {
}
}
- @SuppressWarnings("resource")
void cancel(RefConnection rc) {
SequentialDisposable sd;
synchronized (this) {
diff --git a/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableAmb.java b/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableAmb.java
index e378e9d7cfe..7d19e69379e 100644
--- a/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableAmb.java
+++ b/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableAmb.java
@@ -69,7 +69,6 @@ public void subscribeActual(Observer super T> observer) {
return;
}
- @SuppressWarnings("resource")
AmbCoordinator ac = new AmbCoordinator<>(observer, count);
ac.subscribe(sources);
}
diff --git a/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableCombineLatest.java b/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableCombineLatest.java
index ca84ede00ec..ce42c9f1f0f 100644
--- a/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableCombineLatest.java
+++ b/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableCombineLatest.java
@@ -73,7 +73,6 @@ public void subscribeActual(Observer super R> observer) {
return;
}
- @SuppressWarnings("resource")
LatestCoordinator lc = new LatestCoordinator<>(observer, combiner, count, bufferSize, delayError);
lc.subscribe(sources);
}
diff --git a/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableRefCount.java b/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableRefCount.java
index 65ae40929b9..9aad2986e2b 100644
--- a/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableRefCount.java
+++ b/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableRefCount.java
@@ -89,7 +89,6 @@ protected void subscribeActual(Observer super T> observer) {
}
}
- @SuppressWarnings("resource")
void cancel(RefConnection rc) {
SequentialDisposable sd;
synchronized (this) {
diff --git a/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableZip.java b/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableZip.java
index df35e551792..321b82d1559 100644
--- a/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableZip.java
+++ b/src/main/java/io/reactivex/rxjava4/internal/operators/observable/ObservableZip.java
@@ -69,7 +69,6 @@ public void subscribeActual(Observer super R> observer) {
return;
}
- @SuppressWarnings("resource")
ZipCoordinator zc = new ZipCoordinator<>(observer, zipper, count, delayError);
zc.subscribe(sources, bufferSize);
}
diff --git a/src/main/java/io/reactivex/rxjava4/internal/schedulers/DeferredExecutorScheduler.java b/src/main/java/io/reactivex/rxjava4/internal/schedulers/DeferredExecutorScheduler.java
index 42ae58a82e5..cc2e88311b8 100644
--- a/src/main/java/io/reactivex/rxjava4/internal/schedulers/DeferredExecutorScheduler.java
+++ b/src/main/java/io/reactivex/rxjava4/internal/schedulers/DeferredExecutorScheduler.java
@@ -105,7 +105,6 @@ public Disposable schedule(@NonNull Runnable run) {
task = interruptibleTask;
disposable = interruptibleTask;
} else {
- @SuppressWarnings("resource")
BooleanRunnable runnableTask = new BooleanRunnable(decoratedRun);
task = runnableTask;
diff --git a/src/main/java/io/reactivex/rxjava4/internal/schedulers/ExecutorScheduler.java b/src/main/java/io/reactivex/rxjava4/internal/schedulers/ExecutorScheduler.java
index cdc2a716e92..1b59d58a6e5 100644
--- a/src/main/java/io/reactivex/rxjava4/internal/schedulers/ExecutorScheduler.java
+++ b/src/main/java/io/reactivex/rxjava4/internal/schedulers/ExecutorScheduler.java
@@ -167,7 +167,6 @@ public Disposable schedule(@NonNull Runnable run) {
task = interruptibleTask;
disposable = interruptibleTask;
} else {
- @SuppressWarnings("resource")
BooleanRunnable runnableTask = new BooleanRunnable(decoratedRun);
task = runnableTask;
diff --git a/src/main/java/io/reactivex/rxjava4/internal/util/AwaitCoordinatorStatic.java b/src/main/java/io/reactivex/rxjava4/internal/util/AwaitCoordinatorStatic.java
index cdff8f0c773..2d5a303b8eb 100644
--- a/src/main/java/io/reactivex/rxjava4/internal/util/AwaitCoordinatorStatic.java
+++ b/src/main/java/io/reactivex/rxjava4/internal/util/AwaitCoordinatorStatic.java
@@ -53,9 +53,8 @@ static T await(@NonNull CompletionStage stage, @Nullable DisposableContai
return f.join();
}
var d = Disposable.fromFuture(f, true);
- try (var _ = canceller.subscribe(d)) {
- return f.join();
- }
+ canceller.subscribe(d);
+ return f.join();
}
/**
diff --git a/src/main/java/io/reactivex/rxjava4/internal/virtual/FlowableVirtualCreateExecutor.java b/src/main/java/io/reactivex/rxjava4/internal/virtual/FlowableVirtualCreateExecutor.java
index 25372c1650d..3bf4e01f2fc 100644
--- a/src/main/java/io/reactivex/rxjava4/internal/virtual/FlowableVirtualCreateExecutor.java
+++ b/src/main/java/io/reactivex/rxjava4/internal/virtual/FlowableVirtualCreateExecutor.java
@@ -117,7 +117,7 @@ public Void call() {
var w = worker;
worker = null;
if (w != null) {
- w.close();
+ w.dispose();
}
}
return null;
diff --git a/src/main/java/io/reactivex/rxjava4/internal/virtual/FlowableVirtualTransformExecutor.java b/src/main/java/io/reactivex/rxjava4/internal/virtual/FlowableVirtualTransformExecutor.java
index ce45519f67d..680cd8e22ee 100644
--- a/src/main/java/io/reactivex/rxjava4/internal/virtual/FlowableVirtualTransformExecutor.java
+++ b/src/main/java/io/reactivex/rxjava4/internal/virtual/FlowableVirtualTransformExecutor.java
@@ -177,7 +177,7 @@ public void cancel() {
var w = worker;
worker = null;
if (w != null) {
- w.close();
+ w.dispose();
}
} finally {
producerReady.resume();
diff --git a/src/test/java/io/reactivex/rxjava4/completable/CompletableTest.java b/src/test/java/io/reactivex/rxjava4/completable/CompletableTest.java
index f64ed6064ed..b164bc5a28c 100644
--- a/src/test/java/io/reactivex/rxjava4/completable/CompletableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/completable/CompletableTest.java
@@ -962,7 +962,6 @@ public void onError(Throwable e) {
public void timerCancel() throws InterruptedException {
Completable c = Completable.timer(250, TimeUnit.MILLISECONDS);
- @SuppressWarnings("resource")
final SequentialDisposable sd = new SequentialDisposable();
final AtomicInteger calls = new AtomicInteger();
diff --git a/src/test/java/io/reactivex/rxjava4/core/DisposeTaskTest.java b/src/test/java/io/reactivex/rxjava4/core/DisposeTaskTest.java
index 6cfae35631c..efdea61a1b3 100644
--- a/src/test/java/io/reactivex/rxjava4/core/DisposeTaskTest.java
+++ b/src/test/java/io/reactivex/rxjava4/core/DisposeTaskTest.java
@@ -31,7 +31,6 @@ public void runnableThrows() throws Throwable {
Scheduler.Worker worker = Schedulers.single().createWorker();
- @SuppressWarnings("resource")
DisposeTask task = new DisposeTask(() -> {
throw new TestException();
}, worker);
diff --git a/src/test/java/io/reactivex/rxjava4/core/PeriodicDirectTaskTest.java b/src/test/java/io/reactivex/rxjava4/core/PeriodicDirectTaskTest.java
index 3f7c32ff5f4..c7244baf9be 100644
--- a/src/test/java/io/reactivex/rxjava4/core/PeriodicDirectTaskTest.java
+++ b/src/test/java/io/reactivex/rxjava4/core/PeriodicDirectTaskTest.java
@@ -34,7 +34,6 @@ public void runnableThrows() {
try {
Scheduler.Worker worker = Schedulers.single().createWorker();
- @SuppressWarnings("resource")
PeriodicDirectTask task = new PeriodicDirectTask(() -> {
throw new TestException();
}, worker);
diff --git a/src/test/java/io/reactivex/rxjava4/disposables/CompositeDisposableTest.java b/src/test/java/io/reactivex/rxjava4/disposables/CompositeDisposableTest.java
index 6421800773f..217ea5dc545 100644
--- a/src/test/java/io/reactivex/rxjava4/disposables/CompositeDisposableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/disposables/CompositeDisposableTest.java
@@ -20,15 +20,13 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
-import org.junit.Test;
-
import io.reactivex.rxjava4.core.RxJavaTest;
import io.reactivex.rxjava4.exceptions.CompositeException;
import io.reactivex.rxjava4.testsupport.TestHelper;
+import org.junit.Test;
public class CompositeDisposableTest extends RxJavaTest {
- @SuppressWarnings("resource")
@Test
public void success() {
final AtomicInteger counter = new AtomicInteger();
@@ -42,7 +40,6 @@ public void success() {
assertEquals(2, counter.get());
}
- @SuppressWarnings("resource")
@Test
public void shouldUnsubscribeAll() throws InterruptedException {
final AtomicInteger counter = new AtomicInteger();
@@ -79,7 +76,6 @@ public void shouldUnsubscribeAll() throws InterruptedException {
@Test
public void exception() {
final AtomicInteger counter = new AtomicInteger();
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
cd.add(Disposable.fromRunnable(() -> {
throw new RuntimeException("failed on first one");
@@ -102,7 +98,6 @@ public void exception() {
@Test
public void compositeException() {
final AtomicInteger counter = new AtomicInteger();
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
cd.add(Disposable.fromRunnable(() -> {
throw new RuntimeException("failed on first one");
@@ -131,7 +126,6 @@ public void removeUnsubscribes() {
Disposable d1 = Disposable.empty();
Disposable d2 = Disposable.empty();
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
cd.add(d1);
cd.add(d2);
@@ -147,7 +141,6 @@ public void clear() {
Disposable d1 = Disposable.empty();
Disposable d2 = Disposable.empty();
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
cd.add(d1);
cd.add(d2);
@@ -173,7 +166,6 @@ public void clear() {
@Test
public void unsubscribeIdempotence() {
final AtomicInteger counter = new AtomicInteger();
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
cd.add(Disposable.fromRunnable(counter::incrementAndGet));
@@ -189,7 +181,6 @@ public void unsubscribeIdempotence() {
public void unsubscribeIdempotenceConcurrently()
throws InterruptedException {
final AtomicInteger counter = new AtomicInteger();
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
final int count = 10;
@@ -221,7 +212,6 @@ public void unsubscribeIdempotenceConcurrently()
@Test
public void tryRemoveIfNotIn() {
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
CompositeDisposable cd1 = new CompositeDisposable();
@@ -236,12 +226,10 @@ public void tryRemoveIfNotIn() {
@Test(expected = NullPointerException.class)
public void addingNullDisposableIllegal() {
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
cd.add(null);
}
- @SuppressWarnings("resource")
@Test
public void initializeVarargs() {
Disposable d1 = Disposable.empty();
@@ -271,7 +259,6 @@ public void initializeVarargs() {
assertEquals(0, cd.size());
}
- @SuppressWarnings("resource")
@Test
public void initializeIterable() {
Disposable d1 = Disposable.empty();
@@ -303,7 +290,6 @@ public void initializeIterable() {
assertEquals(0, cd.size());
}
- @SuppressWarnings("resource")
@Test
public void addAll() {
CompositeDisposable cd = new CompositeDisposable();
@@ -348,7 +334,6 @@ public void addAll() {
@Test
public void addAfterDisposed() {
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
cd.dispose();
@@ -371,7 +356,6 @@ public void addAfterDisposed() {
@Test
public void delete() {
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
Disposable d1 = Disposable.empty();
@@ -392,7 +376,6 @@ public void delete() {
@Test
public void disposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
Runnable run = cd::dispose;
@@ -404,7 +387,6 @@ public void disposeRace() {
@Test
public void addRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
Runnable run = () -> cd.add(Disposable.empty());
@@ -416,7 +398,6 @@ public void addRace() {
@Test
public void addAllRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
Runnable run = () -> cd.addAll(Disposable.empty());
@@ -428,7 +409,6 @@ public void addAllRace() {
@Test
public void removeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -444,7 +424,6 @@ public void removeRace() {
@Test
public void deleteRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -460,7 +439,6 @@ public void deleteRace() {
@Test
public void clearRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -476,7 +454,6 @@ public void clearRace() {
@Test
public void addDisposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
Runnable run = cd::dispose;
@@ -490,7 +467,6 @@ public void addDisposeRace() {
@Test
public void addAllDisposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
Runnable run = cd::dispose;
@@ -504,7 +480,6 @@ public void addAllDisposeRace() {
@Test
public void removeDisposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -522,7 +497,6 @@ public void removeDisposeRace() {
@Test
public void deleteDisposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -540,7 +514,6 @@ public void deleteDisposeRace() {
@Test
public void clearDisposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -558,7 +531,6 @@ public void clearDisposeRace() {
@Test
public void sizeDisposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable cd = new CompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -575,7 +547,6 @@ public void sizeDisposeRace() {
@Test
public void disposeThrowsIAE() {
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
cd.add(Disposable.fromAction(() -> {
@@ -598,7 +569,6 @@ public void disposeThrowsIAE() {
@Test
public void disposeThrowsError() {
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
cd.add(Disposable.fromAction(() -> {
@@ -621,7 +591,6 @@ public void disposeThrowsError() {
@Test
public void disposeThrowsCheckedException() {
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
cd.add(Disposable.fromAction(() -> {
@@ -652,7 +621,6 @@ static void throwSneaky() throws E {
@Test
public void disposeThrowsCheckedExceptionSneaky() {
- @SuppressWarnings("resource")
CompositeDisposable cd = new CompositeDisposable();
cd.add(new Disposable() /* NFI */ {
@@ -684,4 +652,46 @@ public boolean isDisposed() {
assertTrue(d1.isDisposed());
}
+
+ @Test
+ public void register() {
+ var cd = new CompositeDisposable();
+
+ var d = Disposable.empty();
+
+ var e = cd.register(d);
+
+ assertFalse("d is disposed", d.isDisposed());
+ assertFalse("e is disposed", e.isDisposed());
+ assertFalse("cd is disposed", cd.isDisposed());
+
+ e.dispose();
+
+ assertTrue("d is not is disposed", d.isDisposed());
+ assertTrue("e not is disposed", e.isDisposed());
+ assertFalse("cd is disposed", cd.isDisposed());
+
+ assertEquals(0, cd.size());
+ }
+
+ @Test
+ public void subscribe() {
+ var cd = new CompositeDisposable();
+
+ var d = Disposable.empty();
+
+ var e = cd.subscribe(d);
+
+ assertFalse("d is disposed", d.isDisposed());
+ assertFalse("e is disposed", e.isDisposed());
+ assertFalse("cd is disposed", cd.isDisposed());
+
+ e.dispose();
+
+ assertFalse("d is disposed", d.isDisposed());
+ assertTrue("e not is disposed", e.isDisposed());
+ assertFalse("cd is disposed", cd.isDisposed());
+
+ assertEquals(0, cd.size());
+ }
}
diff --git a/src/test/java/io/reactivex/rxjava4/disposables/DisposableTest.java b/src/test/java/io/reactivex/rxjava4/disposables/DisposableTest.java
index 36b37baca20..dac6faf33d9 100644
--- a/src/test/java/io/reactivex/rxjava4/disposables/DisposableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/disposables/DisposableTest.java
@@ -237,4 +237,15 @@ public void toAutoCloseable() throws Exception {
assertTrue(d.isDisposed());
assertEquals(1, counter.get());
}
+
+ @Test
+ public void autoCloseable() throws Throwable {
+ var d = Disposable.empty();
+
+ try (var a = d.asAutoCloseable()) {
+ assertNotNull(a);
+ }
+
+ assertTrue("d is not disposed", d.isDisposed());
+ }
}
diff --git a/src/test/java/io/reactivex/rxjava4/disposables/FutureDisposableTest.java b/src/test/java/io/reactivex/rxjava4/disposables/FutureDisposableTest.java
index f087d659edd..50da24c817a 100644
--- a/src/test/java/io/reactivex/rxjava4/disposables/FutureDisposableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/disposables/FutureDisposableTest.java
@@ -61,7 +61,6 @@ public void interruptible() {
@Test
public void normalDone() {
FutureTask ft = new FutureTask<>(Functions.EMPTY_RUNNABLE, null);
- @SuppressWarnings("resource")
FutureDisposable d = new FutureDisposable(ft, false);
assertFalse(d.isDisposed());
diff --git a/src/test/java/io/reactivex/rxjava4/disposables/SerialDisposableTests.java b/src/test/java/io/reactivex/rxjava4/disposables/SerialDisposableTests.java
index e2cd0225824..b74cd8d0b69 100644
--- a/src/test/java/io/reactivex/rxjava4/disposables/SerialDisposableTests.java
+++ b/src/test/java/io/reactivex/rxjava4/disposables/SerialDisposableTests.java
@@ -201,7 +201,6 @@ public void concurrentSetDisposableShouldNotInterleave()
@Test
public void disposeState() {
Disposable empty = Disposable.empty();
- @SuppressWarnings("resource")
SerialDisposable d = new SerialDisposable(empty);
assertFalse(d.isDisposed());
diff --git a/src/test/java/io/reactivex/rxjava4/flowable/FlowableSubscriberTest.java b/src/test/java/io/reactivex/rxjava4/flowable/FlowableSubscriberTest.java
index 02936fc2516..6ee3d223ae4 100644
--- a/src/test/java/io/reactivex/rxjava4/flowable/FlowableSubscriberTest.java
+++ b/src/test/java/io/reactivex/rxjava4/flowable/FlowableSubscriberTest.java
@@ -499,7 +499,6 @@ public void forEachWhile() {
@Test
public void doubleSubscribe() {
- @SuppressWarnings("resource")
ForEachWhileSubscriber s = new ForEachWhileSubscriber<>(_ -> true,
Functions.emptyConsumer(), Functions.EMPTY_ACTION);
@@ -526,7 +525,6 @@ public void suppressAfterCompleteEvents() {
final TestSubscriber ts = new TestSubscriber<>();
ts.onSubscribe(new BooleanSubscription());
- @SuppressWarnings("resource")
ForEachWhileSubscriber s = new ForEachWhileSubscriber<>(v -> {
ts.onNext(v);
return true;
@@ -550,7 +548,6 @@ public void onNextCrashes() {
final TestSubscriber ts = new TestSubscriber<>();
ts.onSubscribe(new BooleanSubscription());
- @SuppressWarnings("resource")
ForEachWhileSubscriber s = new ForEachWhileSubscriber<>(_ -> {
throw new TestException();
}, ts::onError, ts::onComplete);
@@ -566,7 +563,6 @@ public void onNextCrashes() {
@Test
public void onErrorThrows() {
- @SuppressWarnings("resource")
ForEachWhileSubscriber s = new ForEachWhileSubscriber<>(_ -> true,
_ -> {
throw new TestException("Inner");
@@ -592,7 +588,6 @@ public void onErrorThrows() {
@Test
public void onCompleteThrows() {
- @SuppressWarnings("resource")
ForEachWhileSubscriber s = new ForEachWhileSubscriber<>(_ -> true,
_ -> { }, () -> {
throw new TestException("Inner");
diff --git a/src/test/java/io/reactivex/rxjava4/internal/disposables/ArrayCompositeDisposableTest.java b/src/test/java/io/reactivex/rxjava4/internal/disposables/ArrayCompositeDisposableTest.java
index 253739af95f..af98cefd42e 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/disposables/ArrayCompositeDisposableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/disposables/ArrayCompositeDisposableTest.java
@@ -23,7 +23,6 @@
public class ArrayCompositeDisposableTest extends RxJavaTest {
- @SuppressWarnings("resource")
@Test
public void normal() {
ArrayCompositeDisposable acd = new ArrayCompositeDisposable(2);
@@ -69,7 +68,6 @@ public void normal() {
assertTrue(d6.isDisposed());
}
- @SuppressWarnings("resource")
@Test
public void disposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
@@ -81,7 +79,6 @@ public void disposeRace() {
}
}
- @SuppressWarnings("resource")
@Test
public void replaceRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
@@ -93,7 +90,6 @@ public void replaceRace() {
}
}
- @SuppressWarnings("resource")
@Test
public void setRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
diff --git a/src/test/java/io/reactivex/rxjava4/internal/disposables/CancellableDisposableTest.java b/src/test/java/io/reactivex/rxjava4/internal/disposables/CancellableDisposableTest.java
index 19559b9720d..2824cabc002 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/disposables/CancellableDisposableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/disposables/CancellableDisposableTest.java
@@ -34,7 +34,6 @@ public void normal() {
Cancellable c = count::getAndIncrement;
- @SuppressWarnings("resource")
CancellableDisposable cd = new CancellableDisposable(c);
assertFalse(cd.isDisposed());
@@ -56,7 +55,6 @@ public void cancelThrows() {
throw new TestException();
};
- @SuppressWarnings("resource")
CancellableDisposable cd = new CancellableDisposable(c);
assertFalse(cd.isDisposed());
@@ -83,7 +81,6 @@ public void disposeRace() {
Cancellable c = count::getAndIncrement;
- @SuppressWarnings("resource")
final CancellableDisposable cd = new CancellableDisposable(c);
Runnable r = cd::dispose;
diff --git a/src/test/java/io/reactivex/rxjava4/internal/disposables/ListCompositeDisposableTest.java b/src/test/java/io/reactivex/rxjava4/internal/disposables/ListCompositeDisposableTest.java
index 34b958cba84..2addf1c93f9 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/disposables/ListCompositeDisposableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/disposables/ListCompositeDisposableTest.java
@@ -31,7 +31,6 @@ public void constructorAndAddVarargs() {
Disposable d1 = Disposable.empty();
Disposable d2 = Disposable.empty();
- @SuppressWarnings("resource")
ListCompositeDisposable lcd = new ListCompositeDisposable(d1, d2);
lcd.clear();
@@ -58,7 +57,6 @@ public void constructorIterable() {
Disposable d1 = Disposable.empty();
Disposable d2 = Disposable.empty();
- @SuppressWarnings("resource")
ListCompositeDisposable lcd = new ListCompositeDisposable(Arrays.asList(d1, d2));
lcd.clear();
@@ -83,7 +81,6 @@ public void constructorIterable() {
@Test
public void empty() {
- @SuppressWarnings("resource")
ListCompositeDisposable lcd = new ListCompositeDisposable();
assertFalse(lcd.isDisposed());
@@ -103,7 +100,6 @@ public void empty() {
@Test
public void afterDispose() {
- @SuppressWarnings("resource")
ListCompositeDisposable lcd = new ListCompositeDisposable();
lcd.dispose();
@@ -116,7 +112,6 @@ public void afterDispose() {
assertTrue(d.isDisposed());
}
- @SuppressWarnings("resource")
@Test
public void disposeThrows() {
Disposable d = new Disposable() /* NFI */ {
@@ -154,7 +149,6 @@ public boolean isDisposed() {
}
}
- @SuppressWarnings("resource")
@Test
public void remove() {
ListCompositeDisposable lcd = new ListCompositeDisposable();
@@ -186,7 +180,6 @@ public void remove() {
@Test
public void disposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final ListCompositeDisposable cd = new ListCompositeDisposable();
Runnable run = cd::dispose;
@@ -198,7 +191,6 @@ public void disposeRace() {
@Test
public void addRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final ListCompositeDisposable cd = new ListCompositeDisposable();
Runnable run = () -> cd.add(Disposable.empty());
@@ -210,7 +202,6 @@ public void addRace() {
@Test
public void addAllRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final ListCompositeDisposable cd = new ListCompositeDisposable();
Runnable run = () -> cd.addAll(Disposable.empty());
@@ -222,7 +213,6 @@ public void addAllRace() {
@Test
public void removeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final ListCompositeDisposable cd = new ListCompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -238,7 +228,6 @@ public void removeRace() {
@Test
public void deleteRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final ListCompositeDisposable cd = new ListCompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -254,7 +243,6 @@ public void deleteRace() {
@Test
public void clearRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final ListCompositeDisposable cd = new ListCompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -270,7 +258,6 @@ public void clearRace() {
@Test
public void addDisposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final ListCompositeDisposable cd = new ListCompositeDisposable();
Runnable run = cd::dispose;
@@ -284,7 +271,6 @@ public void addDisposeRace() {
@Test
public void addAllDisposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final ListCompositeDisposable cd = new ListCompositeDisposable();
Runnable run = cd::dispose;
@@ -298,7 +284,6 @@ public void addAllDisposeRace() {
@Test
public void removeDisposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final ListCompositeDisposable cd = new ListCompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -316,7 +301,6 @@ public void removeDisposeRace() {
@Test
public void deleteDisposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final ListCompositeDisposable cd = new ListCompositeDisposable();
final Disposable d1 = Disposable.empty();
@@ -334,7 +318,6 @@ public void deleteDisposeRace() {
@Test
public void clearDisposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final ListCompositeDisposable cd = new ListCompositeDisposable();
final Disposable d1 = Disposable.empty();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/fuseable/CancellableQueueFuseableTest.java b/src/test/java/io/reactivex/rxjava4/internal/fuseable/CancellableQueueFuseableTest.java
index 5fc680951bb..d53b406b4a7 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/fuseable/CancellableQueueFuseableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/fuseable/CancellableQueueFuseableTest.java
@@ -27,7 +27,6 @@ public void offer() {
@Test
public void pollClear() throws Throwable {
- @SuppressWarnings("resource")
CancellableQueueFuseable qs = new CancellableQueueFuseable<>();
assertNull(qs.poll());
@@ -38,7 +37,6 @@ public void pollClear() throws Throwable {
@Test
public void cancel() {
- @SuppressWarnings("resource")
CancellableQueueFuseable qs = new CancellableQueueFuseable<>();
assertFalse(qs.isDisposed());
@@ -54,7 +52,6 @@ public void cancel() {
@Test
public void dispose() {
- @SuppressWarnings("resource")
CancellableQueueFuseable qs = new CancellableQueueFuseable<>();
assertFalse(qs.isDisposed());
@@ -70,7 +67,6 @@ public void dispose() {
@Test
public void cancel2() {
- @SuppressWarnings("resource")
AbstractEmptyQueueFuseable qs = new AbstractEmptyQueueFuseable() /* NFI */ { };
assertFalse(qs.isDisposed());
@@ -80,7 +76,6 @@ public void cancel2() {
@Test
public void dispose2() {
- @SuppressWarnings("resource")
AbstractEmptyQueueFuseable qs = new AbstractEmptyQueueFuseable() /* NFI */ { };
assertFalse(qs.isDisposed());
diff --git a/src/test/java/io/reactivex/rxjava4/internal/observers/BasicFuseableObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/observers/BasicFuseableObserverTest.java
index 4ddc6c7c391..e6fe4f1792d 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/observers/BasicFuseableObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/observers/BasicFuseableObserverTest.java
@@ -26,7 +26,8 @@ public class BasicFuseableObserverTest extends RxJavaTest {
@Test(expected = UnsupportedOperationException.class)
public void offer() {
TestObserverEx to = new TestObserverEx<>();
- try (var o = new BasicFuseableObserver(to) /* NFI */ {
+
+ var o = new BasicFuseableObserver(to) /* NFI */ {
@Nullable
@Override
public Integer poll() throws Exception {
@@ -46,19 +47,16 @@ public void onNext(Integer value) {
protected boolean beforeDownstream() {
return false;
}
- }) {
-
- o.onSubscribe(Disposable.disposed());
+ };
+ o.onSubscribe(Disposable.disposed());
- to.assertNotSubscribed();
+ to.assertNotSubscribed();
- o.offer(1);
- }
+ o.offer(1);
}
@Test(expected = UnsupportedOperationException.class)
public void offer2() {
- @SuppressWarnings("resource")
BasicFuseableObserver o = new BasicFuseableObserver(new TestObserver<>()) {
@Nullable
@Override
diff --git a/src/test/java/io/reactivex/rxjava4/internal/observers/BlockingFirstObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/observers/BlockingFirstObserverTest.java
index 9d8cda2a854..d74463c9ced 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/observers/BlockingFirstObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/observers/BlockingFirstObserverTest.java
@@ -23,7 +23,6 @@
public class BlockingFirstObserverTest extends RxJavaTest {
- @SuppressWarnings("resource")
@Test
public void firstValueOnly() {
BlockingFirstObserver bf = new BlockingFirstObserver<>();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/observers/BlockingObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/observers/BlockingObserverTest.java
index cb0177d85ee..cb0eb0df467 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/observers/BlockingObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/observers/BlockingObserverTest.java
@@ -23,7 +23,6 @@
public class BlockingObserverTest extends RxJavaTest {
- @SuppressWarnings("resource")
@Test
public void dispose() {
Queue q = new ArrayDeque<>();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/observers/CallbackCompletableObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/observers/CallbackCompletableObserverTest.java
index 28948a8b7ab..2d67997c833 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/observers/CallbackCompletableObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/observers/CallbackCompletableObserverTest.java
@@ -24,7 +24,6 @@ public final class CallbackCompletableObserverTest extends RxJavaTest {
@Test
public void emptyActionShouldReportNoCustomOnError() {
- @SuppressWarnings("resource")
CallbackCompletableObserver o = new CallbackCompletableObserver(Functions.ON_ERROR_MISSING, Functions.EMPTY_ACTION);
assertFalse(o.hasCustomOnError());
@@ -32,7 +31,6 @@ public void emptyActionShouldReportNoCustomOnError() {
@Test
public void customOnErrorShouldReportCustomOnError() {
- @SuppressWarnings("resource")
CallbackCompletableObserver o = new CallbackCompletableObserver(Functions.emptyConsumer(),
Functions.EMPTY_ACTION);
diff --git a/src/test/java/io/reactivex/rxjava4/internal/observers/ConsumerSingleObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/observers/ConsumerSingleObserverTest.java
index 9b830b4f9be..718312f8ded 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/observers/ConsumerSingleObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/observers/ConsumerSingleObserverTest.java
@@ -24,7 +24,6 @@ public final class ConsumerSingleObserverTest extends RxJavaTest {
@Test
public void onErrorMissingShouldReportNoCustomOnError() {
- @SuppressWarnings("resource")
ConsumerSingleObserver o = new ConsumerSingleObserver<>(Functions.emptyConsumer(),
Functions.ON_ERROR_MISSING);
@@ -33,7 +32,6 @@ public void onErrorMissingShouldReportNoCustomOnError() {
@Test
public void customOnErrorShouldReportCustomOnError() {
- @SuppressWarnings("resource")
ConsumerSingleObserver o = new ConsumerSingleObserver<>(Functions.emptyConsumer(),
Functions.emptyConsumer());
diff --git a/src/test/java/io/reactivex/rxjava4/internal/observers/DeferredScalarObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/observers/DeferredScalarObserverTest.java
index 73a60c7ba59..c995517108b 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/observers/DeferredScalarObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/observers/DeferredScalarObserverTest.java
@@ -55,7 +55,6 @@ public void normal() {
try {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
TakeFirst source = new TakeFirst(to);
source.onSubscribe(Disposable.empty());
@@ -79,7 +78,6 @@ public void normal() {
public void error() {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
TakeFirst source = new TakeFirst(to);
source.onSubscribe(Disposable.empty());
@@ -92,7 +90,6 @@ public void error() {
public void complete() {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
TakeFirst source = new TakeFirst(to);
source.onSubscribe(Disposable.empty());
@@ -105,7 +102,6 @@ public void complete() {
public void dispose() {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
TakeFirst source = new TakeFirst(to);
Disposable d = Disposable.empty();
@@ -127,7 +123,6 @@ public void fused() {
try {
TestObserverEx to = new TestObserverEx<>(QueueFuseable.ANY);
- @SuppressWarnings("resource")
TakeFirst source = new TakeFirst(to);
Disposable d = Disposable.empty();
@@ -158,7 +153,6 @@ public void fusedReject() {
try {
TestObserverEx to = new TestObserverEx<>(QueueFuseable.SYNC);
- @SuppressWarnings("resource")
TakeFirst source = new TakeFirst(to);
Disposable d = Disposable.empty();
@@ -205,7 +199,6 @@ public void nonfusedTerminateMore() {
try {
TestObserverEx to = new TestObserverEx<>(QueueFuseable.NONE);
- @SuppressWarnings("resource")
TakeLast source = new TakeLast(to);
Disposable d = Disposable.empty();
@@ -231,7 +224,6 @@ public void nonfusedError() {
try {
TestObserverEx to = new TestObserverEx<>(QueueFuseable.NONE);
- @SuppressWarnings("resource")
TakeLast source = new TakeLast(to);
Disposable d = Disposable.empty();
@@ -257,7 +249,6 @@ public void fusedTerminateMore() {
try {
TestObserverEx to = new TestObserverEx<>(QueueFuseable.ANY);
- @SuppressWarnings("resource")
TakeLast source = new TakeLast(to);
Disposable d = Disposable.empty();
@@ -283,7 +274,6 @@ public void fusedError() {
try {
TestObserverEx to = new TestObserverEx<>(QueueFuseable.ANY);
- @SuppressWarnings("resource")
TakeLast source = new TakeLast(to);
Disposable d = Disposable.empty();
@@ -307,7 +297,6 @@ public void fusedError() {
public void disposed() {
TestObserverEx to = new TestObserverEx<>(QueueFuseable.NONE);
- @SuppressWarnings("resource")
TakeLast source = new TakeLast(to);
Disposable d = Disposable.empty();
@@ -326,7 +315,6 @@ public void disposed() {
public void disposedAfterOnNext() {
final TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
TakeLast source = new TakeLast(new Observer() /* NFI */ {
Disposable upstream;
@@ -364,7 +352,6 @@ public void onComplete() {
public void fusedEmpty() {
TestObserverEx to = new TestObserverEx<>(QueueFuseable.ANY);
- @SuppressWarnings("resource")
TakeLast source = new TakeLast(to);
Disposable d = Disposable.empty();
@@ -380,7 +367,6 @@ public void fusedEmpty() {
public void nonfusedEmpty() {
TestObserverEx to = new TestObserverEx<>(QueueFuseable.NONE);
- @SuppressWarnings("resource")
TakeLast source = new TakeLast(to);
Disposable d = Disposable.empty();
@@ -396,7 +382,6 @@ public void nonfusedEmpty() {
public void customFusion() {
final TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
TakeLast source = new TakeLast(new Observer() /* NFI */ {
QueueDisposable d;
@@ -447,7 +432,6 @@ public void onComplete() {
public void customFusionClear() {
final TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
TakeLast source = new TakeLast(new Observer() /* NFI */ {
QueueDisposable d;
@@ -496,7 +480,6 @@ public void offerThrow() {
public void customFusionDontConsume() {
final TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
TakeFirst source = new TakeFirst(new Observer() /* NFI */ {
QueueDisposable d;
diff --git a/src/test/java/io/reactivex/rxjava4/internal/observers/DisposableLambdaObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/observers/DisposableLambdaObserverTest.java
index 3d6e6c48fab..047acb9b02e 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/observers/DisposableLambdaObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/observers/DisposableLambdaObserverTest.java
@@ -40,7 +40,6 @@ public void doubleOnSubscribe() {
public void disposeCrash() {
List errors = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
DisposableLambdaObserver o = new DisposableLambdaObserver<>(
new TestObserver<>(), Functions.emptyConsumer(),
() -> {
diff --git a/src/test/java/io/reactivex/rxjava4/internal/observers/EmptyCompletableObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/observers/EmptyCompletableObserverTest.java
index 457570389ba..bd8d8769cab 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/observers/EmptyCompletableObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/observers/EmptyCompletableObserverTest.java
@@ -23,7 +23,6 @@ public final class EmptyCompletableObserverTest extends RxJavaTest {
@Test
public void defaultShouldReportNoCustomOnError() {
- @SuppressWarnings("resource")
EmptyCompletableObserver o = new EmptyCompletableObserver();
assertFalse(o.hasCustomOnError());
diff --git a/src/test/java/io/reactivex/rxjava4/internal/observers/FutureMultiObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/observers/FutureMultiObserverTest.java
index 9ad15961331..0d04e1560f0 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/observers/FutureMultiObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/observers/FutureMultiObserverTest.java
@@ -23,7 +23,6 @@ public class FutureMultiObserverTest extends RxJavaTest {
@Test
public void cancelBeforeOnSubscribe() {
- @SuppressWarnings("resource")
FutureMultiObserver f = new FutureMultiObserver<>();
assertTrue(f.cancel(true));
@@ -37,7 +36,6 @@ public void cancelBeforeOnSubscribe() {
@Test
public void onCompleteJustAfterDispose() {
- @SuppressWarnings("resource")
FutureMultiObserver f = new FutureMultiObserver<>();
Disposable d = Disposable.empty();
f.onSubscribe(d);
diff --git a/src/test/java/io/reactivex/rxjava4/internal/observers/FutureObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/observers/FutureObserverTest.java
index 77010ed6a40..0c333559a7b 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/observers/FutureObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/observers/FutureObserverTest.java
@@ -155,7 +155,6 @@ public void onSubscribe() throws Exception {
@Test
public void cancelRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final FutureObserver fo = new FutureObserver<>();
Runnable r = () -> fo.cancel(false);
@@ -179,7 +178,6 @@ public void onErrorCancelRace() {
RxJavaPlugins.setErrorHandler(Functions.emptyConsumer());
try {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final FutureObserver fo = new FutureObserver<>();
final TestException ex = new TestException();
@@ -200,7 +198,6 @@ public void onCompleteCancelRace() {
RxJavaPlugins.setErrorHandler(Functions.emptyConsumer());
try {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final FutureObserver fo = new FutureObserver<>();
if (i % 3 == 0) {
@@ -354,7 +351,6 @@ public void getTimedOut() throws Exception {
@Test
public void cancelOnSubscribeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final FutureObserver fo = new FutureObserver<>();
Runnable r = () -> fo.cancel(false);
diff --git a/src/test/java/io/reactivex/rxjava4/internal/observers/LambdaObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/observers/LambdaObserverTest.java
index 0cfd26a7cf6..177397b5d6d 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/observers/LambdaObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/observers/LambdaObserverTest.java
@@ -240,7 +240,6 @@ public void onSubscribeThrowsCancelsUpstream() {
@Test
public void onErrorMissingShouldReportNoCustomOnError() {
- @SuppressWarnings("resource")
LambdaObserver o = new LambdaObserver<>(Functions.emptyConsumer(),
Functions.ON_ERROR_MISSING,
Functions.EMPTY_ACTION,
@@ -251,7 +250,6 @@ public void onErrorMissingShouldReportNoCustomOnError() {
@Test
public void customOnErrorShouldReportCustomOnError() {
- @SuppressWarnings("resource")
LambdaObserver o = new LambdaObserver<>(Functions.emptyConsumer(),
Functions.emptyConsumer(),
Functions.EMPTY_ACTION,
@@ -266,7 +264,6 @@ public void disposedObserverShouldReportErrorOnGlobalErrorHandler() {
try {
final List observerErrors = Collections.synchronizedList(new ArrayList<>());
- @SuppressWarnings("resource")
LambdaObserver o = new LambdaObserver<>(Functions.emptyConsumer(),
observerErrors::add,
Functions.EMPTY_ACTION,
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/BlockingFlowableNextTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/BlockingFlowableNextTest.java
index 9449a1fc927..7808f36b47a 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/BlockingFlowableNextTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/BlockingFlowableNextTest.java
@@ -225,8 +225,7 @@ public void nextWithCallingHasNextMultipleTimes() {
public void noBufferingOrBlockingOfSequence() throws Throwable {
int repeat = 0;
for (;;) {
- @SuppressWarnings("resource")
- final SerialDisposable task = new SerialDisposable();
+ var task = new SerialDisposable();
try {
final CountDownLatch finished = new CountDownLatch(1);
final int COUNT = 30;
@@ -337,7 +336,6 @@ public void interrupt() {
@Test
public void nextObserverError() {
- @SuppressWarnings("resource")
NextSubscriber no = new NextSubscriber<>();
List errors = TestHelper.trackPluginErrors();
@@ -352,7 +350,6 @@ public void nextObserverError() {
@Test
public void nextObserverOnNext() throws Exception {
- @SuppressWarnings("resource")
NextSubscriber no = new NextSubscriber<>();
no.setWaiting();
@@ -366,7 +363,6 @@ public void nextObserverOnNext() throws Exception {
@Test
public void nextObserverOnCompleteOnNext() throws Exception {
- @SuppressWarnings("resource")
NextSubscriber no = new NextSubscriber<>();
no.setWaiting();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/BlockingFlowableToIteratorTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/BlockingFlowableToIteratorTest.java
index f8b94bf64d1..ce381862c56 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/BlockingFlowableToIteratorTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/BlockingFlowableToIteratorTest.java
@@ -108,14 +108,12 @@ public void remove() {
@Test(expected = UnsupportedOperationException.class)
public void remove() {
- @SuppressWarnings("resource")
BlockingFlowableIterator it = new BlockingFlowableIterator<>(128);
it.remove();
}
@Test
public void dispose() {
- @SuppressWarnings("resource")
BlockingFlowableIterator it = new BlockingFlowableIterator<>(128);
assertFalse(it.isDisposed());
@@ -127,7 +125,6 @@ public void dispose() {
@Test
public void interruptWait() {
- @SuppressWarnings("resource")
BlockingFlowableIterator it = new BlockingFlowableIterator<>(128);
try {
@@ -141,7 +138,6 @@ public void interruptWait() {
@Test(expected = NoSuchElementException.class)
public void emptyThrowsNoSuch() {
- @SuppressWarnings("resource")
BlockingFlowableIterator it = new BlockingFlowableIterator<>(128);
it.onComplete();
it.next();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableAmbTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableAmbTest.java
index 5304f1b98d2..04b18a640e7 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableAmbTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableAmbTest.java
@@ -52,7 +52,6 @@ public void setUp() {
private Flowable createFlowable(final String[] values,
final long interval, final Throwable e) {
return Flowable.unsafeCreate(subscriber -> {
- @SuppressWarnings("resource")
final CompositeDisposable parentSubscription = new CompositeDisposable();
subscriber.onSubscribe(new Subscription() /* NFI */ {
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableBufferTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableBufferTest.java
index c3b0146648f..6bd040ac14b 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableBufferTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableBufferTest.java
@@ -2039,7 +2039,6 @@ public void timedInternalState() {
TestSubscriber> ts = new TestSubscriber<>();
- @SuppressWarnings("resource")
BufferExactUnboundedSubscriber> sub = new BufferExactUnboundedSubscriber<>(
ts, Functions.justSupplier(new ArrayList()), 1, TimeUnit.SECONDS, sch);
@@ -2123,7 +2122,6 @@ public void timedSizeBufferAlreadyCleared() {
TestSubscriber> ts = new TestSubscriber<>();
- @SuppressWarnings("resource")
BufferExactBoundedSubscriber> sub =
new BufferExactBoundedSubscriber<>(
ts, Functions.justSupplier(new ArrayList()),
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableDebounceTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableDebounceTest.java
index c77c77f1d80..07f148a47c3 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableDebounceTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableDebounceTest.java
@@ -349,7 +349,6 @@ public void dispose() {
TestHelper.checkDisposed(PublishProcessor.create().debounce(Functions.justFunction(Flowable.never())));
- @SuppressWarnings("resource")
Disposable d = new FlowableDebounceTimed.DebounceEmitter<>(1, 1, null);
assertFalse(d.isDisposed());
@@ -517,7 +516,6 @@ public void timedLateEmit() {
sub.onSubscribe(new BooleanSubscription());
- @SuppressWarnings("resource")
DebounceEmitter de = new DebounceEmitter<>(1, 50, sub);
de.emit();
de.emit();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableDelayTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableDelayTest.java
index bbcb4b66b16..0c77b6942be 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableDelayTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableDelayTest.java
@@ -890,7 +890,6 @@ public void itemDelayReturnsNull() {
public void cancelShouldPreventRandomSubsequentEmissions() {
for (int attempt = 1; attempt < 100; attempt ++) {
- @SuppressWarnings("resource")
SequentialDisposable disposable = new SequentialDisposable();
ConcurrentLinkedQueue sink = new ConcurrentLinkedQueue<>();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableFlatMapTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableFlatMapTest.java
index 8bdd583f077..8183c49aae1 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableFlatMapTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableFlatMapTest.java
@@ -893,7 +893,6 @@ public void innerErrorsMainCancelled() {
@Test
public void innerIsDisposed() {
- @SuppressWarnings("resource")
FlowableFlatMap.InnerSubscriber inner = new FlowableFlatMap.InnerSubscriber<>(null, 10, 0L);
assertFalse(inner.isDisposed());
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableGroupJoinTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableGroupJoinTest.java
index 35a8c480f04..9cbeb2862b6 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableGroupJoinTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableGroupJoinTest.java
@@ -512,7 +512,6 @@ public void rightEmission() {
public void leftRightState() {
JoinSupport js = mock(JoinSupport.class);
- @SuppressWarnings("resource")
LeftRightSubscriber o = new LeftRightSubscriber(js, false);
assertFalse(o.isDisposed());
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableRefCountTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableRefCountTest.java
index 8d1b74e7e6f..8db3a654fc0 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableRefCountTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableRefCountTest.java
@@ -1090,7 +1090,6 @@ public boolean isDisposed() {
}
}
- @SuppressWarnings("resource")
@Test
public void doubleOnX() {
List errors = TestHelper.trackPluginErrors();
@@ -1107,7 +1106,6 @@ public void doubleOnX() {
}
}
- @SuppressWarnings("resource")
@Test
public void doubleOnXCount() {
List errors = TestHelper.trackPluginErrors();
@@ -1124,7 +1122,6 @@ public void doubleOnXCount() {
}
}
- @SuppressWarnings("resource")
@Test
public void doubleOnXTime() {
List errors = TestHelper.trackPluginErrors();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java
index 646bdbdee73..ef4cd9fd97e 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java
@@ -767,7 +767,6 @@ protected void subscribeActual(Subscriber super Integer> s) {
@Test
public void timeoutConsumerIsDisposed() {
- @SuppressWarnings("resource")
TimeoutConsumer consumer = new TimeoutConsumer(0, null);
assertFalse(consumer.isDisposed());
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/maybe/MaybeCallbackObserverTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/maybe/MaybeCallbackObserverTest.java
index 9bc06c75b2e..4a15f6c67c3 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/maybe/MaybeCallbackObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/maybe/MaybeCallbackObserverTest.java
@@ -31,7 +31,6 @@ public class MaybeCallbackObserverTest extends RxJavaTest {
@Test
public void dispose() {
- @SuppressWarnings("resource")
MaybeCallbackObserver mo = new MaybeCallbackObserver<>(Functions.emptyConsumer(), Functions.emptyConsumer(), Functions.EMPTY_ACTION);
Disposable d = Disposable.empty();
@@ -51,7 +50,6 @@ public void dispose() {
public void onSuccessCrashes() {
List errors = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
MaybeCallbackObserver mo = new MaybeCallbackObserver<>(
_ -> {
throw new TestException();
@@ -73,7 +71,6 @@ public void onSuccessCrashes() {
public void onErrorCrashes() {
List errors = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
MaybeCallbackObserver mo = new MaybeCallbackObserver<>(
Functions.emptyConsumer(),
(Consumer) _ -> {
@@ -100,7 +97,6 @@ public void onErrorCrashes() {
public void onCompleteCrashes() {
List errors = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
MaybeCallbackObserver mo = new MaybeCallbackObserver<>(
Functions.emptyConsumer(),
Functions.emptyConsumer(),
@@ -120,7 +116,6 @@ public void onCompleteCrashes() {
@Test
public void onErrorMissingShouldReportNoCustomOnError() {
- @SuppressWarnings("resource")
MaybeCallbackObserver o = new MaybeCallbackObserver<>(Functions.emptyConsumer(),
Functions.ON_ERROR_MISSING,
Functions.EMPTY_ACTION);
@@ -130,7 +125,6 @@ public void onErrorMissingShouldReportNoCustomOnError() {
@Test
public void customOnErrorShouldReportCustomOnError() {
- @SuppressWarnings("resource")
MaybeCallbackObserver o = new MaybeCallbackObserver<>(Functions.emptyConsumer(),
Functions.emptyConsumer(),
Functions.EMPTY_ACTION);
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/mixed/ObservableConcatMapMaybeTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/mixed/ObservableConcatMapMaybeTest.java
index 7efb213c969..efe27154ec7 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/mixed/ObservableConcatMapMaybeTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/mixed/ObservableConcatMapMaybeTest.java
@@ -310,7 +310,6 @@ public void scalarEmptySource() {
@Test
public void cancelNoConcurrentClean() {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
ConcatMapMaybeMainObserver operator =
new ConcatMapMaybeMainObserver<>(
to, Functions.justFunction(Maybe.never()), 16, ErrorMode.IMMEDIATE);
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/mixed/ObservableConcatMapSingleTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/mixed/ObservableConcatMapSingleTest.java
index cb845bac3ca..a7617c31fef 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/mixed/ObservableConcatMapSingleTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/mixed/ObservableConcatMapSingleTest.java
@@ -264,7 +264,6 @@ public void scalarEmptySource() {
@Test
public void cancelNoConcurrentClean() {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
ConcatMapSingleMainObserver operator =
new ConcatMapSingleMainObserver<>(
to, Functions.justFunction(Single.never()), 16, ErrorMode.IMMEDIATE);
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/BlockingObservableNextTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/BlockingObservableNextTest.java
index 7ed482a86bc..d545e555805 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/BlockingObservableNextTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/BlockingObservableNextTest.java
@@ -229,8 +229,7 @@ public void nextWithCallingHasNextMultipleTimes() {
public void noBufferingOrBlockingOfSequence() throws Throwable {
int repeat = 0;
for (;;) {
- @SuppressWarnings("resource")
- final SerialDisposable task = new SerialDisposable();
+ var task = new SerialDisposable();
try {
final CountDownLatch finished = new CountDownLatch(1);
final int COUNT = 30;
@@ -341,7 +340,6 @@ public void remove() {
@Test
public void nextObserverError() {
- @SuppressWarnings("resource")
NextObserver no = new NextObserver<>();
List errors = TestHelper.trackPluginErrors();
@@ -356,7 +354,6 @@ public void nextObserverError() {
@Test
public void nextObserverOnNext() throws Exception {
- @SuppressWarnings("resource")
NextObserver no = new NextObserver<>();
no.setWaiting();
@@ -370,7 +367,6 @@ public void nextObserverOnNext() throws Exception {
@Test
public void nextObserverOnCompleteOnNext() throws Exception {
- @SuppressWarnings("resource")
NextObserver no = new NextObserver<>();
no.setWaiting();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/BlockingObservableToIteratorTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/BlockingObservableToIteratorTest.java
index 93316f35ed0..eb818e9907e 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/BlockingObservableToIteratorTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/BlockingObservableToIteratorTest.java
@@ -68,7 +68,6 @@ public void toIteratorWithException() {
@Test
public void dispose() {
- @SuppressWarnings("resource")
BlockingObservableIterator it = new BlockingObservableIterator<>(128);
assertFalse(it.isDisposed());
@@ -80,7 +79,6 @@ public void dispose() {
@Test
public void interruptWait() {
- @SuppressWarnings("resource")
BlockingObservableIterator it = new BlockingObservableIterator<>(128);
try {
@@ -94,7 +92,6 @@ public void interruptWait() {
@Test(expected = NoSuchElementException.class)
public void emptyThrowsNoSuch() {
- @SuppressWarnings("resource")
BlockingObservableIterator it = new BlockingObservableIterator<>(128);
it.onComplete();
it.next();
@@ -102,7 +99,6 @@ public void emptyThrowsNoSuch() {
@Test(expected = UnsupportedOperationException.class)
public void remove() {
- @SuppressWarnings("resource")
BlockingObservableIterator it = new BlockingObservableIterator<>(128);
it.remove();
}
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableBlockingTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableBlockingTest.java
index 3ffe632d1c3..2ac97eab5da 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableBlockingTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableBlockingTest.java
@@ -256,7 +256,6 @@ public void onCompleteDelayed() {
@Test
public void blockingCancelUpfront() {
- @SuppressWarnings("resource")
BlockingFirstObserver o = new BlockingFirstObserver<>();
assertFalse(o.isDisposed());
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableBufferTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableBufferTest.java
index 2ac26fcfb4e..cac9d6821af 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableBufferTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableBufferTest.java
@@ -1479,7 +1479,6 @@ public void timedInternalState() {
TestObserver> to = new TestObserver<>();
- @SuppressWarnings("resource")
BufferExactUnboundedObserver> sub = new BufferExactUnboundedObserver<>(
to, Functions.justSupplier(new ArrayList()), 1, TimeUnit.SECONDS, sch);
@@ -1518,7 +1517,6 @@ public void timedSkipInternalState() {
TestObserver> to = new TestObserver<>();
- @SuppressWarnings("resource")
BufferSkipBoundedObserver> sub = new BufferSkipBoundedObserver<>(
to, Functions.justSupplier(new ArrayList()), 1, 1, TimeUnit.SECONDS, sch.createWorker());
@@ -1538,7 +1536,6 @@ public void timedSkipCancelWhenSecondBuffer() {
final TestObserver> to = new TestObserver<>();
- @SuppressWarnings("resource")
BufferSkipBoundedObserver> sub = new BufferSkipBoundedObserver<>(
to, new Supplier>() /* NFI */ {
int calls;
@@ -1565,7 +1562,6 @@ public void timedSizeBufferAlreadyCleared() {
TestObserver> to = new TestObserver<>();
- @SuppressWarnings("resource")
BufferExactBoundedObserver> sub =
new BufferExactBoundedObserver<>(
to, Functions.justSupplier(new ArrayList()),
@@ -1603,7 +1599,6 @@ public void bufferExactDoubleOnSubscribe() {
public void bufferExactState() {
TestObserver> to = new TestObserver<>();
- @SuppressWarnings("resource")
BufferExactObserver> sub = new BufferExactObserver<>(
to, 1, Functions.justSupplier(new ArrayList())
);
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableDebounceTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableDebounceTest.java
index 5258d8503ba..d2ff57fcb38 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableDebounceTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableDebounceTest.java
@@ -334,7 +334,6 @@ public void dispose() {
TestHelper.checkDisposed(PublishSubject.create().debounce(Functions.justFunction(Observable.never())));
- @SuppressWarnings("resource")
Disposable d = new ObservableDebounceTimed.DebounceEmitter<>(1, 1, null);
assertFalse(d.isDisposed());
@@ -474,7 +473,6 @@ public void timedLateEmit() {
sub.onSubscribe(Disposable.empty());
- @SuppressWarnings("resource")
DebounceEmitter de = new DebounceEmitter<>(1, 50, sub);
de.run();
de.run();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableDelayTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableDelayTest.java
index 629e10970f7..7e8f7a4a127 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableDelayTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableDelayTest.java
@@ -857,7 +857,6 @@ public void itemDelayReturnsNull() {
public void cancelShouldPreventRandomSubsequentEmissions() {
for (int attempt = 1; attempt < 100; attempt ++) {
- @SuppressWarnings("resource")
SequentialDisposable disposable = new SequentialDisposable();
ConcurrentLinkedQueue sink = new ConcurrentLinkedQueue<>();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableFlatMapTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableFlatMapTest.java
index 039225a8fe8..be76f429638 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableFlatMapTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableFlatMapTest.java
@@ -749,7 +749,6 @@ public void fusedSourceCrashResumeWithNextSource() {
final UnicastSubject fusedSource = UnicastSubject.create();
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
ObservableFlatMap.MergeObserver merger =
new ObservableFlatMap.MergeObserver<>(to, (Function>) t -> {
if (t == 0) {
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableGroupJoinTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableGroupJoinTest.java
index 75910b684e3..215870bb597 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableGroupJoinTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableGroupJoinTest.java
@@ -505,7 +505,6 @@ public void rightEmission() {
public void leftRightState() {
JoinSupport js = mock(JoinSupport.class);
- @SuppressWarnings("resource")
LeftRightObserver o = new LeftRightObserver(js, false);
assertFalse(o.isDisposed());
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableMapNotificationTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableMapNotificationTest.java
index d78d59396dc..22f5690e7c7 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableMapNotificationTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableMapNotificationTest.java
@@ -46,7 +46,6 @@ public void dispose() {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void subscribeActual(Observer super Integer> observer) {
- @SuppressWarnings("resource")
MapNotificationObserver mn = new MapNotificationObserver(
observer,
Functions.justFunction(Observable.just(1)),
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableRefCountTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableRefCountTest.java
index 1c3f46a6857..d66bc29dcca 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableRefCountTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableRefCountTest.java
@@ -1034,7 +1034,6 @@ public boolean isDisposed() {
}
}
- @SuppressWarnings("resource")
@Test
public void doubleOnX() {
List errors = TestHelper.trackPluginErrors();
@@ -1051,7 +1050,6 @@ public void doubleOnX() {
}
}
- @SuppressWarnings("resource")
@Test
public void doubleOnXCount() {
List errors = TestHelper.trackPluginErrors();
@@ -1068,7 +1066,6 @@ public void doubleOnXCount() {
}
}
- @SuppressWarnings("resource")
@Test
public void doubleOnXTime() {
List errors = TestHelper.trackPluginErrors();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableResourceWrapperTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableResourceWrapperTest.java
index 36f7c472d13..ca441d555ef 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableResourceWrapperTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableResourceWrapperTest.java
@@ -28,7 +28,6 @@ public class ObservableResourceWrapperTest extends RxJavaTest {
@Test
public void disposed() {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
ObserverResourceWrapper orw = new ObserverResourceWrapper<>(to);
Disposable d = Disposable.empty();
@@ -53,7 +52,6 @@ public void doubleOnSubscribe() {
@Test
public void onErrorDisposes() {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
ObserverResourceWrapper orw = new ObserverResourceWrapper<>(to);
Disposable d = Disposable.empty();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableSwitchTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableSwitchTest.java
index 1f02496bc16..28fba9af03f 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableSwitchTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableSwitchTest.java
@@ -1189,7 +1189,6 @@ public void cancellationShouldTriggerInnerCancellationRace() throws Throwable {
Observable createObservable(AtomicInteger inner) {
return Observable.unsafeCreate(s -> {
- @SuppressWarnings("resource")
SerializedObserver it = new SerializedObserver<>(s);
it.onSubscribe(Disposable.empty());
Schedulers.cached().scheduleDirect(() -> {
diff --git a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableTimerTest.java b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableTimerTest.java
index 6730b3055de..8b6d1bb5f18 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableTimerTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableTimerTest.java
@@ -346,7 +346,6 @@ public void timerInterruptible() throws Exception {
public void cancelledAndRun() {
TestObserver to = new TestObserver<>();
to.onSubscribe(Disposable.empty());
- @SuppressWarnings("resource")
TimerObserver tm = new TimerObserver(to);
tm.dispose();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/schedulers/AbstractDirectTaskTest.java b/src/test/java/io/reactivex/rxjava4/internal/schedulers/AbstractDirectTaskTest.java
index b4ba90a367d..8e0e08b479d 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/schedulers/AbstractDirectTaskTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/schedulers/AbstractDirectTaskTest.java
@@ -28,7 +28,6 @@ public class AbstractDirectTaskTest extends RxJavaTest {
@Test
public void cancelSetFuture() {
- @SuppressWarnings("resource")
AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) /* NFI */ {
@Serial
private static final long serialVersionUID = 208585707945686116L;
@@ -61,7 +60,6 @@ public boolean cancel(boolean mayInterruptIfRunning) {
@Test
public void cancelSetFutureCurrentThread() {
- @SuppressWarnings("resource")
var task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) /* NFI */ {
@Serial
private static final long serialVersionUID = 208585707945686116L;
@@ -96,7 +94,6 @@ public boolean cancel(boolean mayInterruptIfRunning) {
@Test
public void setFutureCancel() {
- @SuppressWarnings("resource")
var task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) /* NFI */ {
@Serial
private static final long serialVersionUID = 208585707945686116L;
@@ -126,7 +123,6 @@ public boolean cancel(boolean mayInterruptIfRunning) {
@Test
public void setFutureCancelSameThread() {
- @SuppressWarnings("resource")
AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) /* NFI */ {
@Serial
private static final long serialVersionUID = 208585707945686116L;
@@ -157,7 +153,6 @@ public boolean cancel(boolean mayInterruptIfRunning) {
@Test
public void finished() {
- @SuppressWarnings("resource")
AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) /* NFI */ {
@Serial
private static final long serialVersionUID = 208585707945686116L;
@@ -188,7 +183,6 @@ public boolean cancel(boolean mayInterruptIfRunning) {
@Test
public void finishedCancel() {
- @SuppressWarnings("resource")
AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) /* NFI */ {
@Serial
private static final long serialVersionUID = 208585707945686116L;
@@ -224,7 +218,6 @@ public boolean cancel(boolean mayInterruptIfRunning) {
@Test
public void disposeSetFutureRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) /* NFI */ {
@Serial
private static final long serialVersionUID = 208585707945686116L;
@@ -258,7 +251,6 @@ static class TestDirectTask extends AbstractDirectTask {
@Test
public void toStringStates() {
- @SuppressWarnings("resource")
TestDirectTask task = new TestDirectTask();
assertEquals("TestDirectTask[Waiting]", task.toString());
diff --git a/src/test/java/io/reactivex/rxjava4/internal/schedulers/BooleanRunnableTest.java b/src/test/java/io/reactivex/rxjava4/internal/schedulers/BooleanRunnableTest.java
index 39cd2ec8ffd..f1c6191522d 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/schedulers/BooleanRunnableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/schedulers/BooleanRunnableTest.java
@@ -31,7 +31,6 @@ public class BooleanRunnableTest extends RxJavaTest {
public void runnableThrows() {
List errors = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
BooleanRunnable task = new BooleanRunnable(() -> {
throw new TestException();
});
diff --git a/src/test/java/io/reactivex/rxjava4/internal/schedulers/ExecutorSchedulerDelayedRunnableTest.java b/src/test/java/io/reactivex/rxjava4/internal/schedulers/ExecutorSchedulerDelayedRunnableTest.java
index 1f8e6a0e51e..44a9681d758 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/schedulers/ExecutorSchedulerDelayedRunnableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/schedulers/ExecutorSchedulerDelayedRunnableTest.java
@@ -29,7 +29,6 @@ public class ExecutorSchedulerDelayedRunnableTest extends RxJavaTest {
@Test(expected = TestException.class)
@SuppressUndeliverable
public void delayedRunnableCrash() {
- @SuppressWarnings("resource")
DelayedRunnable dl = new DelayedRunnable(() -> {
throw new TestException();
});
@@ -39,7 +38,6 @@ public void delayedRunnableCrash() {
@Test
public void dispose() {
final AtomicInteger count = new AtomicInteger();
- @SuppressWarnings("resource")
DelayedRunnable dl = new DelayedRunnable(count::incrementAndGet);
dl.dispose();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/schedulers/InstantPeriodicTaskTest.java b/src/test/java/io/reactivex/rxjava4/internal/schedulers/InstantPeriodicTaskTest.java
index 929ded46c3d..4b3f9d867be 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/schedulers/InstantPeriodicTaskTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/schedulers/InstantPeriodicTaskTest.java
@@ -34,7 +34,6 @@ public void taskCrash() throws Exception {
List errors = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
InstantPeriodicTask task = new InstantPeriodicTask(() -> {
throw new TestException();
}, exec);
@@ -58,7 +57,6 @@ public void dispose() throws Exception {
ExecutorService exec = Executors.newSingleThreadExecutor();
try {
- @SuppressWarnings("resource")
InstantPeriodicTask task = new InstantPeriodicTask(() -> {
throw new TestException();
}, exec);
@@ -83,7 +81,6 @@ public void dispose2() throws Exception {
ExecutorService exec = Executors.newSingleThreadExecutor();
try {
- @SuppressWarnings("resource")
InstantPeriodicTask task = new InstantPeriodicTask(() -> {
throw new TestException();
}, exec);
@@ -111,7 +108,6 @@ public void dispose2CurrentThread() throws Exception {
ExecutorService exec = Executors.newSingleThreadExecutor();
try {
- @SuppressWarnings("resource")
InstantPeriodicTask task = new InstantPeriodicTask(() -> {
throw new TestException();
}, exec);
@@ -141,7 +137,6 @@ public void dispose3() throws Exception {
ExecutorService exec = Executors.newSingleThreadExecutor();
try {
- @SuppressWarnings("resource")
InstantPeriodicTask task = new InstantPeriodicTask(() -> {
throw new TestException();
}, exec);
@@ -168,7 +163,6 @@ public void disposeOnCurrentThread() throws Exception {
ExecutorService exec = Executors.newSingleThreadExecutor();
try {
- @SuppressWarnings("resource")
InstantPeriodicTask task = new InstantPeriodicTask(() -> {
throw new TestException();
}, exec);
@@ -197,7 +191,6 @@ public void firstCancelRace() throws Exception {
ExecutorService exec = Executors.newSingleThreadExecutor();
try {
for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) {
- @SuppressWarnings("resource")
final InstantPeriodicTask task = new InstantPeriodicTask(() -> {
throw new TestException();
}, exec);
@@ -222,7 +215,6 @@ public void restCancelRace() throws Exception {
ExecutorService exec = Executors.newSingleThreadExecutor();
try {
for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) {
- @SuppressWarnings("resource")
final InstantPeriodicTask task = new InstantPeriodicTask(() -> {
throw new TestException();
}, exec);
diff --git a/src/test/java/io/reactivex/rxjava4/internal/schedulers/InterruptibleRunnableTest.java b/src/test/java/io/reactivex/rxjava4/internal/schedulers/InterruptibleRunnableTest.java
index b8129ad6d8d..fce7ee9e338 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/schedulers/InterruptibleRunnableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/schedulers/InterruptibleRunnableTest.java
@@ -31,7 +31,6 @@ public class InterruptibleRunnableTest extends RxJavaTest {
public void runnableThrows() {
List errors = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
InterruptibleRunnable task = new InterruptibleRunnable(() -> {
throw new TestException();
}, null);
diff --git a/src/test/java/io/reactivex/rxjava4/internal/schedulers/ParallelSchedulerTest.java b/src/test/java/io/reactivex/rxjava4/internal/schedulers/ParallelSchedulerTest.java
index 99958ea0496..666ef2c3b7d 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/schedulers/ParallelSchedulerTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/schedulers/ParallelSchedulerTest.java
@@ -349,14 +349,13 @@ public void setFutureRace2() {
try {
for (int i = 0; i < 1000; i++) {
final CompositeDisposable cd = new CompositeDisposable();
- try (final TrackedAction tt = new TrackedAction(this, cd)) {
- final FutureTask ft = new FutureTask<>(Functions.EMPTY_RUNNABLE, null);
+ var tt = new TrackedAction(this, cd);
+ final FutureTask ft = new FutureTask<>(Functions.EMPTY_RUNNABLE, null);
- Runnable r1 = () -> tt.setFuture(ft);
+ Runnable r1 = () -> tt.setFuture(ft);
- Runnable r2 = () -> tt.future.set(TrackedAction.FINISHED);
- TestHelper.race(r1, r2, Schedulers.single());
- }
+ Runnable r2 = () -> tt.future.set(TrackedAction.FINISHED);
+ TestHelper.race(r1, r2, Schedulers.single());
}
} finally {
s.shutdown();
@@ -369,14 +368,14 @@ public void setFutureRace3() {
try {
for (int i = 0; i < 1000; i++) {
final CompositeDisposable cd = new CompositeDisposable();
- try (final TrackedAction tt = new TrackedAction(this, cd)) {
- final FutureTask ft = new FutureTask<>(Functions.EMPTY_RUNNABLE, null);
- Runnable r1 = () -> tt.setFuture(ft);
+ var tt = new TrackedAction(this, cd);
+ final FutureTask ft = new FutureTask<>(Functions.EMPTY_RUNNABLE, null);
+
+ Runnable r1 = () -> tt.setFuture(ft);
- Runnable r2 = () -> tt.future.set(TrackedAction.DISPOSED);
- TestHelper.race(r1, r2, Schedulers.single());
- }
+ Runnable r2 = () -> tt.future.set(TrackedAction.DISPOSED);
+ TestHelper.race(r1, r2, Schedulers.single());
}
} finally {
s.shutdown();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/schedulers/ScheduledDirectPeriodicTaskTest.java b/src/test/java/io/reactivex/rxjava4/internal/schedulers/ScheduledDirectPeriodicTaskTest.java
index 1f2243c285a..754a2664cdf 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/schedulers/ScheduledDirectPeriodicTaskTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/schedulers/ScheduledDirectPeriodicTaskTest.java
@@ -30,7 +30,6 @@ public class ScheduledDirectPeriodicTaskTest extends RxJavaTest {
public void runnableThrows() {
List errors = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
ScheduledDirectPeriodicTask task = new ScheduledDirectPeriodicTask(() -> {
throw new TestException();
}, true);
diff --git a/src/test/java/io/reactivex/rxjava4/internal/schedulers/ScheduledRunnableTest.java b/src/test/java/io/reactivex/rxjava4/internal/schedulers/ScheduledRunnableTest.java
index afe5f354e18..4a71677b085 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/schedulers/ScheduledRunnableTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/schedulers/ScheduledRunnableTest.java
@@ -182,7 +182,6 @@ public void crashReported() {
@Test
public void withoutParentDisposed() {
- @SuppressWarnings("resource")
ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, null);
run.dispose();
run.call();
@@ -190,7 +189,6 @@ public void withoutParentDisposed() {
@Test
public void withParentDisposed() {
- @SuppressWarnings("resource")
ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, new CompositeDisposable());
run.dispose();
run.call();
@@ -198,7 +196,6 @@ public void withParentDisposed() {
@Test
public void withFutureDisposed() {
- @SuppressWarnings("resource")
ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, null);
run.setFuture(new FutureTask(Functions.EMPTY_RUNNABLE, null));
run.dispose();
@@ -207,7 +204,6 @@ public void withFutureDisposed() {
@Test
public void withFutureDisposed2() {
- @SuppressWarnings("resource")
ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, null);
run.dispose();
run.setFuture(new FutureTask(Functions.EMPTY_RUNNABLE, null));
@@ -216,7 +212,6 @@ public void withFutureDisposed2() {
@Test
public void withFutureDisposed3() {
- @SuppressWarnings("resource")
ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, null);
run.dispose();
run.set(2, Thread.currentThread());
@@ -288,7 +283,6 @@ public void syncWorkerCancelRace() {
@Test
public void disposeAfterRun() {
- @SuppressWarnings("resource")
final ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, null);
run.run();
@@ -300,7 +294,6 @@ public void disposeAfterRun() {
@Test
public void syncDisposeIdempotent() {
- @SuppressWarnings("resource")
final ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, null);
run.set(ScheduledRunnable.THREAD_INDEX, Thread.currentThread());
@@ -314,7 +307,6 @@ public void syncDisposeIdempotent() {
@Test
public void asyncDisposeIdempotent() {
- @SuppressWarnings("resource")
final ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, null);
run.dispose();
@@ -327,7 +319,6 @@ public void asyncDisposeIdempotent() {
@Test
public void noParentIsDisposed() {
- @SuppressWarnings("resource")
ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, null);
assertFalse(run.isDisposed());
run.run();
@@ -348,7 +339,6 @@ public void withParentIsDisposed() {
assertFalse(set.remove(run));
}
- @SuppressWarnings("resource")
@Test
public void toStringStates() {
CompositeDisposable set = new CompositeDisposable();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/schedulers/SchedulerMultiWorkerSupportTest.java b/src/test/java/io/reactivex/rxjava4/internal/schedulers/SchedulerMultiWorkerSupportTest.java
index 45ad2084749..6dfc9963fb1 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/schedulers/SchedulerMultiWorkerSupportTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/schedulers/SchedulerMultiWorkerSupportTest.java
@@ -58,7 +58,6 @@ public void getShutdownWorkers() {
public void distinctThreads() throws Exception {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
- @SuppressWarnings("resource")
final CompositeDisposable composite = new CompositeDisposable();
try {
diff --git a/src/test/java/io/reactivex/rxjava4/internal/schedulers/SharedSchedulerTest.java b/src/test/java/io/reactivex/rxjava4/internal/schedulers/SharedSchedulerTest.java
index 41193ed2f3d..698de8865e0 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/schedulers/SharedSchedulerTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/schedulers/SharedSchedulerTest.java
@@ -218,36 +218,33 @@ public void futureDisposeRace() throws Exception {
@Test
public void disposeSetFutureRace() {
for (int i = 0; i < 1000; i++) {
- try (final SharedAction sa = new SharedAction(this, new CompositeDisposable())) {
+ var sa = new SharedAction(this, new CompositeDisposable());
+ final Disposable d = Disposable.empty();
- final Disposable d = Disposable.empty();
+ Runnable r1 = () -> sa.setFuture(d);
- Runnable r1 = () -> sa.setFuture(d);
+ Runnable r2 = sa::dispose;
- Runnable r2 = sa::dispose;
+ TestHelper.race(r1, r2, Schedulers.single());
- TestHelper.race(r1, r2, Schedulers.single());
-
- assertTrue("Future not disposed", d.isDisposed());
- }
+ assertTrue("Future not disposed", d.isDisposed());
}
}
@Test
public void runSetFutureRace() {
for (int i = 0; i < 1000; i++) {
- try (final SharedAction sa = new SharedAction(this, new CompositeDisposable())) {
- final Disposable d = Disposable.empty();
+ var sa = new SharedAction(this, new CompositeDisposable());
+ final Disposable d = Disposable.empty();
- Runnable r1 = () -> sa.setFuture(d);
+ Runnable r1 = () -> sa.setFuture(d);
- Runnable r2 = sa::run;
+ Runnable r2 = sa::run;
- TestHelper.race(r1, r2, Schedulers.single());
+ TestHelper.race(r1, r2, Schedulers.single());
- assertFalse("Future disposed", d.isDisposed());
- assertEquals(i + 1, calls);
- }
+ assertFalse("Future disposed", d.isDisposed());
+ assertEquals(i + 1, calls);
}
}
}
diff --git a/src/test/java/io/reactivex/rxjava4/internal/subscribers/BoundedSubscriberTest.java b/src/test/java/io/reactivex/rxjava4/internal/subscribers/BoundedSubscriberTest.java
index 87066f1166b..735dac27a66 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/subscribers/BoundedSubscriberTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/subscribers/BoundedSubscriberTest.java
@@ -215,7 +215,6 @@ public void badSourceEmitAfterDone() {
@Test
public void onErrorMissingShouldReportNoCustomOnError() {
- @SuppressWarnings("resource")
BoundedSubscriber subscriber = new BoundedSubscriber<>(Functions.emptyConsumer(),
Functions.ON_ERROR_MISSING,
Functions.EMPTY_ACTION,
@@ -226,7 +225,6 @@ public void onErrorMissingShouldReportNoCustomOnError() {
@Test
public void customOnErrorShouldReportCustomOnError() {
- @SuppressWarnings("resource")
BoundedSubscriber subscriber = new BoundedSubscriber<>(Functions.emptyConsumer(),
Functions.emptyConsumer(),
Functions.EMPTY_ACTION,
@@ -237,7 +235,6 @@ public void customOnErrorShouldReportCustomOnError() {
@Test
public void cancel() {
- @SuppressWarnings("resource")
BoundedSubscriber subscriber = new BoundedSubscriber<>(Functions.emptyConsumer(),
Functions.emptyConsumer(),
Functions.EMPTY_ACTION,
@@ -253,7 +250,6 @@ public void cancel() {
@Test
public void dispose() {
- @SuppressWarnings("resource")
BoundedSubscriber subscriber = new BoundedSubscriber<>(Functions.emptyConsumer(),
Functions.emptyConsumer(),
Functions.EMPTY_ACTION,
diff --git a/src/test/java/io/reactivex/rxjava4/internal/subscribers/LambdaSubscriberTest.java b/src/test/java/io/reactivex/rxjava4/internal/subscribers/LambdaSubscriberTest.java
index 6829bf1bf96..932113be5ba 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/subscribers/LambdaSubscriberTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/subscribers/LambdaSubscriberTest.java
@@ -213,7 +213,6 @@ public void onSubscribeThrowsCancelsUpstream() {
@Test
public void onErrorMissingShouldReportNoCustomOnError() {
- @SuppressWarnings("resource")
LambdaSubscriber subscriber = new LambdaSubscriber<>(Functions.emptyConsumer(),
Functions.ON_ERROR_MISSING,
Functions.EMPTY_ACTION,
@@ -224,7 +223,6 @@ public void onErrorMissingShouldReportNoCustomOnError() {
@Test
public void customOnErrorShouldReportCustomOnError() {
- @SuppressWarnings("resource")
LambdaSubscriber subscriber = new LambdaSubscriber<>(Functions.emptyConsumer(),
Functions.emptyConsumer(),
Functions.EMPTY_ACTION,
diff --git a/src/test/java/io/reactivex/rxjava4/internal/subscriptions/ArrayCompositeSubscriptionTest.java b/src/test/java/io/reactivex/rxjava4/internal/subscriptions/ArrayCompositeSubscriptionTest.java
index a06319d3ce4..5432080b079 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/subscriptions/ArrayCompositeSubscriptionTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/subscriptions/ArrayCompositeSubscriptionTest.java
@@ -22,7 +22,6 @@
public class ArrayCompositeSubscriptionTest extends RxJavaTest {
- @SuppressWarnings("resource")
@Test
public void set() {
ArrayCompositeSubscription ac = new ArrayCompositeSubscription(1);
@@ -58,7 +57,6 @@ public void set() {
assertFalse(ac.setResource(0, null));
}
- @SuppressWarnings("resource")
@Test
public void replace() {
ArrayCompositeSubscription ac = new ArrayCompositeSubscription(1);
@@ -94,7 +92,6 @@ public void replace() {
ac.replaceResource(0, null);
}
- @SuppressWarnings("resource")
@Test
public void disposeRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
@@ -106,7 +103,6 @@ public void disposeRace() {
}
}
- @SuppressWarnings("resource")
@Test
public void setReplaceRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
diff --git a/src/test/java/io/reactivex/rxjava4/internal/subscriptions/AsyncSubscriptionTest.java b/src/test/java/io/reactivex/rxjava4/internal/subscriptions/AsyncSubscriptionTest.java
index f6b23527a5c..558139b5bc1 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/subscriptions/AsyncSubscriptionTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/subscriptions/AsyncSubscriptionTest.java
@@ -25,7 +25,6 @@
public class AsyncSubscriptionTest extends RxJavaTest {
- @SuppressWarnings("resource")
@Test
public void noResource() {
AsyncSubscription as = new AsyncSubscription();
@@ -42,7 +41,6 @@ public void noResource() {
verify(s).cancel();
}
- @SuppressWarnings("resource")
@Test
public void requestBeforeSet() {
AsyncSubscription as = new AsyncSubscription();
@@ -59,7 +57,6 @@ public void requestBeforeSet() {
verify(s).cancel();
}
- @SuppressWarnings("resource")
@Test
public void cancelBeforeSet() {
AsyncSubscription as = new AsyncSubscription();
@@ -75,7 +72,6 @@ public void cancelBeforeSet() {
verify(s).cancel();
}
- @SuppressWarnings("resource")
@Test
public void singleSet() {
AsyncSubscription as = new AsyncSubscription();
@@ -93,7 +89,6 @@ public void singleSet() {
verify(s1).cancel();
}
- @SuppressWarnings("resource")
@Test
public void initialResource() {
Disposable r = mock(Disposable.class);
@@ -104,7 +99,6 @@ public void initialResource() {
verify(r).dispose();
}
- @SuppressWarnings("resource")
@Test
public void setResource() {
AsyncSubscription as = new AsyncSubscription();
@@ -118,7 +112,6 @@ public void setResource() {
verify(r).dispose();
}
- @SuppressWarnings("resource")
@Test
public void replaceResource() {
AsyncSubscription as = new AsyncSubscription();
@@ -132,7 +125,6 @@ public void replaceResource() {
verify(r).dispose();
}
- @SuppressWarnings("resource")
@Test
public void setResource2() {
AsyncSubscription as = new AsyncSubscription();
@@ -151,7 +143,6 @@ public void setResource2() {
verify(r2).dispose();
}
- @SuppressWarnings("resource")
@Test
public void replaceResource2() {
AsyncSubscription as = new AsyncSubscription();
@@ -170,7 +161,6 @@ public void replaceResource2() {
verify(r2).dispose();
}
- @SuppressWarnings("resource")
@Test
public void setResourceAfterCancel() {
AsyncSubscription as = new AsyncSubscription();
@@ -184,7 +174,6 @@ public void setResourceAfterCancel() {
verify(r).dispose();
}
- @SuppressWarnings("resource")
@Test
public void replaceResourceAfterCancel() {
AsyncSubscription as = new AsyncSubscription();
@@ -197,7 +186,6 @@ public void replaceResourceAfterCancel() {
verify(r).dispose();
}
- @SuppressWarnings("resource")
@Test
public void cancelOnce() {
Disposable r = mock(Disposable.class);
@@ -215,7 +203,6 @@ public void cancelOnce() {
verify(r).dispose();
}
- @SuppressWarnings("resource")
@Test
public void disposed() {
AsyncSubscription as = new AsyncSubscription();
diff --git a/src/test/java/io/reactivex/rxjava4/internal/util/EndConsumerHelperTest.java b/src/test/java/io/reactivex/rxjava4/internal/util/EndConsumerHelperTest.java
index ac6913ab346..f1a49ded141 100644
--- a/src/test/java/io/reactivex/rxjava4/internal/util/EndConsumerHelperTest.java
+++ b/src/test/java/io/reactivex/rxjava4/internal/util/EndConsumerHelperTest.java
@@ -125,7 +125,6 @@ public void checkDoubleDefaultSubscriberNonAnonymous() {
@Test
public void checkDoubleDisposableSubscriber() {
- @SuppressWarnings("resource")
Subscriber consumer = new DisposableSubscriber() /* NFI */ {
@Override
public void onNext(Integer t) {
@@ -161,7 +160,6 @@ public void onComplete() {
@Test
public void checkDoubleResourceSubscriber() {
- @SuppressWarnings("resource")
Subscriber consumer = new ResourceSubscriber() /* NFI */ {
@Override
public void onNext(Integer t) {
@@ -232,7 +230,6 @@ public void onComplete() {
@Test
public void checkDoubleDisposableObserver() {
- @SuppressWarnings("resource")
Observer consumer = new DisposableObserver() /* NFI */ {
@Override
public void onNext(Integer t) {
@@ -268,7 +265,6 @@ public void onComplete() {
@Test
public void checkDoubleResourceObserver() {
- @SuppressWarnings("resource")
Observer consumer = new ResourceObserver() /* NFI */ {
@Override
public void onNext(Integer t) {
@@ -304,7 +300,6 @@ public void onComplete() {
@Test
public void checkDoubleDisposableSingleObserver() {
- @SuppressWarnings("resource")
SingleObserver consumer = new DisposableSingleObserver() /* NFI */ {
@Override
public void onSuccess(Integer t) {
@@ -336,7 +331,6 @@ public void onError(Throwable t) {
@Test
public void checkDoubleResourceSingleObserver() {
- @SuppressWarnings("resource")
SingleObserver consumer = new ResourceSingleObserver() /* NFI */ {
@Override
public void onSuccess(Integer t) {
@@ -368,7 +362,6 @@ public void onError(Throwable t) {
@Test
public void checkDoubleDisposableMaybeObserver() {
- @SuppressWarnings("resource")
MaybeObserver consumer = new DisposableMaybeObserver() /* NFI */ {
@Override
public void onSuccess(Integer t) {
@@ -404,7 +397,6 @@ public void onComplete() {
@Test
public void checkDoubleResourceMaybeObserver() {
- @SuppressWarnings("resource")
MaybeObserver consumer = new ResourceMaybeObserver() /* NFI */ {
@Override
public void onSuccess(Integer t) {
@@ -440,7 +432,6 @@ public void onComplete() {
@Test
public void checkDoubleDisposableCompletableObserver() {
- @SuppressWarnings("resource")
CompletableObserver consumer = new DisposableCompletableObserver() /* NFI */ {
@Override
public void onError(Throwable t) {
@@ -472,7 +463,6 @@ public void onComplete() {
@Test
public void checkDoubleResourceCompletableObserver() {
- @SuppressWarnings("resource")
CompletableObserver consumer = new ResourceCompletableObserver() /* NFI */ {
@Override
public void onError(Throwable t) {
diff --git a/src/test/java/io/reactivex/rxjava4/observers/DisposableCompletableObserverTest.java b/src/test/java/io/reactivex/rxjava4/observers/DisposableCompletableObserverTest.java
index 0f27376844f..3ffc762f6d9 100644
--- a/src/test/java/io/reactivex/rxjava4/observers/DisposableCompletableObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/observers/DisposableCompletableObserverTest.java
@@ -77,7 +77,6 @@ public void startOnce() {
List error = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
TestCompletable tc = new TestCompletable();
tc.onSubscribe(Disposable.empty());
@@ -98,7 +97,6 @@ public void startOnce() {
@Test
public void dispose() {
- @SuppressWarnings("resource")
TestCompletable tc = new TestCompletable();
tc.dispose();
diff --git a/src/test/java/io/reactivex/rxjava4/observers/DisposableMaybeObserverTest.java b/src/test/java/io/reactivex/rxjava4/observers/DisposableMaybeObserverTest.java
index 20cf8c211c0..087b0f6973b 100644
--- a/src/test/java/io/reactivex/rxjava4/observers/DisposableMaybeObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/observers/DisposableMaybeObserverTest.java
@@ -85,7 +85,6 @@ public void startOnce() {
List error = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
TestMaybe tc = new TestMaybe<>();
tc.onSubscribe(Disposable.empty());
@@ -106,7 +105,6 @@ public void startOnce() {
@Test
public void dispose() {
- @SuppressWarnings("resource")
TestMaybe tc = new TestMaybe<>();
tc.dispose();
diff --git a/src/test/java/io/reactivex/rxjava4/observers/DisposableObserverTest.java b/src/test/java/io/reactivex/rxjava4/observers/DisposableObserverTest.java
index f7f822e7272..dd579c05b2c 100644
--- a/src/test/java/io/reactivex/rxjava4/observers/DisposableObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/observers/DisposableObserverTest.java
@@ -84,7 +84,6 @@ public void startOnce() {
List error = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
TestDisposableObserver tc = new TestDisposableObserver<>();
tc.onSubscribe(Disposable.empty());
@@ -105,7 +104,6 @@ public void startOnce() {
@Test
public void dispose() {
- @SuppressWarnings("resource")
TestDisposableObserver tc = new TestDisposableObserver<>();
assertFalse(tc.isDisposed());
diff --git a/src/test/java/io/reactivex/rxjava4/observers/DisposableSingleObserverTest.java b/src/test/java/io/reactivex/rxjava4/observers/DisposableSingleObserverTest.java
index 4b049130c6a..a4cbcc9a9d7 100644
--- a/src/test/java/io/reactivex/rxjava4/observers/DisposableSingleObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/observers/DisposableSingleObserverTest.java
@@ -77,7 +77,6 @@ public void startOnce() {
List error = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
TestSingle tc = new TestSingle<>();
tc.onSubscribe(Disposable.empty());
@@ -98,7 +97,6 @@ public void startOnce() {
@Test
public void dispose() {
- @SuppressWarnings("resource")
TestSingle tc = new TestSingle<>();
tc.dispose();
diff --git a/src/test/java/io/reactivex/rxjava4/observers/ResourceCompletableObserverTest.java b/src/test/java/io/reactivex/rxjava4/observers/ResourceCompletableObserverTest.java
index 68783afcb9d..f5d5e77d107 100644
--- a/src/test/java/io/reactivex/rxjava4/observers/ResourceCompletableObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/observers/ResourceCompletableObserverTest.java
@@ -58,14 +58,12 @@ public void onError(Throwable e) {
@Test(expected = NullPointerException.class)
public void nullResource() {
- @SuppressWarnings("resource")
TestResourceCompletableObserver rco = new TestResourceCompletableObserver();
rco.add(null);
}
@Test
public void addResources() {
- @SuppressWarnings("resource")
TestResourceCompletableObserver rco = new TestResourceCompletableObserver();
assertFalse(rco.isDisposed());
@@ -91,7 +89,6 @@ public void addResources() {
@Test
public void onCompleteCleansUp() {
- @SuppressWarnings("resource")
TestResourceCompletableObserver rco = new TestResourceCompletableObserver();
assertFalse(rco.isDisposed());
@@ -111,7 +108,6 @@ public void onCompleteCleansUp() {
@Test
public void onErrorCleansUp() {
- @SuppressWarnings("resource")
TestResourceCompletableObserver rco = new TestResourceCompletableObserver();
assertFalse(rco.isDisposed());
@@ -169,7 +165,6 @@ public void startOnce() {
List error = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
TestResourceCompletableObserver rco = new TestResourceCompletableObserver();
rco.onSubscribe(Disposable.empty());
@@ -190,7 +185,6 @@ public void startOnce() {
@Test
public void dispose() {
- @SuppressWarnings("resource")
TestResourceCompletableObserver rco = new TestResourceCompletableObserver();
rco.dispose();
diff --git a/src/test/java/io/reactivex/rxjava4/observers/ResourceMaybeObserverTest.java b/src/test/java/io/reactivex/rxjava4/observers/ResourceMaybeObserverTest.java
index f539ffd738e..8e3e88a7aad 100644
--- a/src/test/java/io/reactivex/rxjava4/observers/ResourceMaybeObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/observers/ResourceMaybeObserverTest.java
@@ -67,14 +67,12 @@ public void onError(Throwable e) {
@Test(expected = NullPointerException.class)
public void nullResource() {
- @SuppressWarnings("resource")
TestResourceMaybeObserver rmo = new TestResourceMaybeObserver<>();
rmo.add(null);
}
@Test
public void addResources() {
- @SuppressWarnings("resource")
TestResourceMaybeObserver rmo = new TestResourceMaybeObserver<>();
assertFalse(rmo.isDisposed());
@@ -100,7 +98,6 @@ public void addResources() {
@Test
public void onCompleteCleansUp() {
- @SuppressWarnings("resource")
TestResourceMaybeObserver rmo = new TestResourceMaybeObserver<>();
assertFalse(rmo.isDisposed());
@@ -120,7 +117,6 @@ public void onCompleteCleansUp() {
@Test
public void onSuccessCleansUp() {
- @SuppressWarnings("resource")
TestResourceMaybeObserver rmo = new TestResourceMaybeObserver<>();
assertFalse(rmo.isDisposed());
@@ -140,7 +136,6 @@ public void onSuccessCleansUp() {
@Test
public void onErrorCleansUp() {
- @SuppressWarnings("resource")
TestResourceMaybeObserver rmo = new TestResourceMaybeObserver<>();
assertFalse(rmo.isDisposed());
@@ -220,7 +215,6 @@ public void startOnce() {
List error = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
TestResourceMaybeObserver rmo = new TestResourceMaybeObserver<>();
rmo.onSubscribe(Disposable.empty());
@@ -241,7 +235,6 @@ public void startOnce() {
@Test
public void dispose() {
- @SuppressWarnings("resource")
TestResourceMaybeObserver rmo = new TestResourceMaybeObserver<>();
rmo.dispose();
diff --git a/src/test/java/io/reactivex/rxjava4/observers/ResourceObserverTest.java b/src/test/java/io/reactivex/rxjava4/observers/ResourceObserverTest.java
index 02a42a6505b..ac96518e7b9 100644
--- a/src/test/java/io/reactivex/rxjava4/observers/ResourceObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/observers/ResourceObserverTest.java
@@ -67,14 +67,12 @@ public void onComplete() {
@Test(expected = NullPointerException.class)
public void nullResource() {
- @SuppressWarnings("resource")
TestResourceObserver ro = new TestResourceObserver<>();
ro.add(null);
}
@Test
public void addResources() {
- @SuppressWarnings("resource")
TestResourceObserver ro = new TestResourceObserver<>();
assertFalse(ro.isDisposed());
@@ -100,7 +98,6 @@ public void addResources() {
@Test
public void onCompleteCleansUp() {
- @SuppressWarnings("resource")
TestResourceObserver ro = new TestResourceObserver<>();
assertFalse(ro.isDisposed());
@@ -120,7 +117,6 @@ public void onCompleteCleansUp() {
@Test
public void onErrorCleansUp() {
- @SuppressWarnings("resource")
TestResourceObserver ro = new TestResourceObserver<>();
assertFalse(ro.isDisposed());
@@ -180,7 +176,6 @@ public void startOnce() {
List error = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
TestResourceObserver tc = new TestResourceObserver<>();
tc.onSubscribe(Disposable.empty());
@@ -201,7 +196,6 @@ public void startOnce() {
@Test
public void dispose() {
- @SuppressWarnings("resource")
TestResourceObserver tc = new TestResourceObserver<>();
tc.dispose();
diff --git a/src/test/java/io/reactivex/rxjava4/observers/ResourceSingleObserverTest.java b/src/test/java/io/reactivex/rxjava4/observers/ResourceSingleObserverTest.java
index 925087dbb13..ff4bfc0969d 100644
--- a/src/test/java/io/reactivex/rxjava4/observers/ResourceSingleObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/observers/ResourceSingleObserverTest.java
@@ -58,14 +58,12 @@ public void onError(Throwable e) {
@Test(expected = NullPointerException.class)
public void nullResource() {
- @SuppressWarnings("resource")
TestResourceSingleObserver rso = new TestResourceSingleObserver<>();
rso.add(null);
}
@Test
public void addResources() {
- @SuppressWarnings("resource")
TestResourceSingleObserver rso = new TestResourceSingleObserver<>();
assertFalse(rso.isDisposed());
@@ -91,7 +89,6 @@ public void addResources() {
@Test
public void onSuccessCleansUp() {
- @SuppressWarnings("resource")
TestResourceSingleObserver rso = new TestResourceSingleObserver<>();
assertFalse(rso.isDisposed());
@@ -111,7 +108,6 @@ public void onSuccessCleansUp() {
@Test
public void onErrorCleansUp() {
- @SuppressWarnings("resource")
TestResourceSingleObserver rso = new TestResourceSingleObserver<>();
assertFalse(rso.isDisposed());
@@ -171,7 +167,6 @@ public void startOnce() {
List error = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
TestResourceSingleObserver rso = new TestResourceSingleObserver<>();
rso.onSubscribe(Disposable.empty());
@@ -192,7 +187,6 @@ public void startOnce() {
@Test
public void dispose() {
- @SuppressWarnings("resource")
TestResourceSingleObserver rso = new TestResourceSingleObserver<>();
rso.dispose();
diff --git a/src/test/java/io/reactivex/rxjava4/observers/SafeObserverTest.java b/src/test/java/io/reactivex/rxjava4/observers/SafeObserverTest.java
index 42c77df6cbb..7af351d8458 100644
--- a/src/test/java/io/reactivex/rxjava4/observers/SafeObserverTest.java
+++ b/src/test/java/io/reactivex/rxjava4/observers/SafeObserverTest.java
@@ -45,7 +45,6 @@ public void onNextFailure() {
public void onNextFailureSafe() {
AtomicReference onError = new AtomicReference<>();
try {
- @SuppressWarnings("resource")
SafeObserver safeObserver = new SafeObserver<>(OBSERVER_ONNEXT_FAIL(onError));
safeObserver.onSubscribe(Disposable.empty());
safeObserver.onNext("one");
@@ -199,7 +198,6 @@ public void onError(Throwable e) {
public void onComplete() {
}
};
- @SuppressWarnings("resource")
SafeObserver observer = new SafeObserver<>(actual);
assertSame(actual, observer.downstream);
@@ -209,7 +207,6 @@ public void onComplete() {
public void dispose() {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
SafeObserver so = new SafeObserver<>(to);
Disposable d = Disposable.empty();
@@ -228,7 +225,6 @@ public void dispose() {
public void onNextAfterComplete() {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
SafeObserver so = new SafeObserver<>(to);
Disposable d = Disposable.empty();
@@ -250,7 +246,6 @@ public void onNextAfterComplete() {
public void onNextNull() {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
SafeObserver so = new SafeObserver<>(to);
Disposable d = Disposable.empty();
@@ -266,7 +261,6 @@ public void onNextNull() {
public void onNextWithoutOnSubscribe() {
TestObserverEx to = new TestObserverEx<>();
- @SuppressWarnings("resource")
SafeObserver so = new SafeObserver<>(to);
so.onNext(1);
@@ -278,7 +272,6 @@ public void onNextWithoutOnSubscribe() {
public void onErrorWithoutOnSubscribe() {
TestObserverEx to = new TestObserverEx<>();
- @SuppressWarnings("resource")
SafeObserver so = new SafeObserver<>(to);
so.onError(new TestException());
@@ -293,7 +286,6 @@ public void onErrorWithoutOnSubscribe() {
public void onCompleteWithoutOnSubscribe() {
TestObserverEx to = new TestObserverEx<>();
- @SuppressWarnings("resource")
SafeObserver so = new SafeObserver<>(to);
so.onComplete();
@@ -305,7 +297,6 @@ public void onCompleteWithoutOnSubscribe() {
public void onNextNormal() {
TestObserver to = new TestObserver<>();
- @SuppressWarnings("resource")
SafeObserver so = new SafeObserver<>(to);
Disposable d = Disposable.empty();
@@ -490,7 +481,6 @@ public void onNextOnSubscribeCrash() {
List list = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
CrashDummy cd = new CrashDummy(true, 1, false, false, false);
SafeObserver so = cd.toSafe();
@@ -522,7 +512,6 @@ public void noSubscribeOnErrorCrashes() {
List list = TestHelper.trackPluginErrors();
try {
- @SuppressWarnings("resource")
CrashDummy cd = new CrashDummy(false, 1, true, false, false);
SafeObserver so = cd.toSafe();
@@ -553,7 +542,6 @@ public void onErrorNoSubscribeCrash() {
List