From 41a7cb78cd0ce11b2b49bcd04deecc2de26bdb05 Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Wed, 27 Mar 2013 16:33:31 -0700 Subject: [PATCH] Remove use of JSR 305 and dependency on com.google.code.findbugs https://github.com/Netflix/RxJava/issues/192 The library and annotations were being used for trivial reasons so removing the usage so we don't have the dependency. --- rxjava-core/build.gradle | 1 - .../src/main/java/rx/operators/OperationZip.java | 13 +++++++------ .../java/rx/util/AtomicObservableSubscription.java | 3 --- .../src/main/java/rx/util/SynchronizedObserver.java | 3 --- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/rxjava-core/build.gradle b/rxjava-core/build.gradle index 45f231be750..43f6444c936 100644 --- a/rxjava-core/build.gradle +++ b/rxjava-core/build.gradle @@ -8,7 +8,6 @@ targetCompatibility = JavaVersion.VERSION_1_6 dependencies { compile 'org.slf4j:slf4j-api:1.7.0' - compile 'com.google.code.findbugs:jsr305:2.0.0' provided 'junit:junit:4.10' provided 'org.mockito:mockito-core:1.8.5' } diff --git a/rxjava-core/src/main/java/rx/operators/OperationZip.java b/rxjava-core/src/main/java/rx/operators/OperationZip.java index d1c1ca2ff5a..73091e32b56 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationZip.java +++ b/rxjava-core/src/main/java/rx/operators/OperationZip.java @@ -23,9 +23,6 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicBoolean; -import javax.annotation.concurrent.GuardedBy; -import javax.annotation.concurrent.ThreadSafe; - import org.junit.Test; import org.mockito.InOrder; @@ -68,7 +65,9 @@ public static Func1, Subscription> zip(Observabl return a; } - @ThreadSafe + /* + * ThreadSafe + */ private static class ZipObserver implements Observer { final Observable w; final Aggregator a; @@ -110,9 +109,10 @@ public void onNext(T args) { /** * Receive notifications from each of the Observables we are reducing and execute the zipFunction whenever we have received events from all Observables. * + * This class is thread-safe. + * * @param */ - @ThreadSafe private static class Aggregator implements Func1, Subscription> { private volatile SynchronizedObserver observer; @@ -132,10 +132,11 @@ public Aggregator(FuncN zipFunction) { /** * Receive notification of a Observer starting (meaning we should require it for aggregation) + * + * Thread Safety => Invoke ONLY from the static factory methods at top of this class which are always an atomic execution by a single thread. * * @param w */ - @GuardedBy("Invoked ONLY from the static factory methods at top of this class which are always an atomic execution by a single thread.") private void addObserver(ZipObserver w) { // initialize this ZipObserver observers.add(w); diff --git a/rxjava-core/src/main/java/rx/util/AtomicObservableSubscription.java b/rxjava-core/src/main/java/rx/util/AtomicObservableSubscription.java index 3b572a3f2c4..50233586c2b 100644 --- a/rxjava-core/src/main/java/rx/util/AtomicObservableSubscription.java +++ b/rxjava-core/src/main/java/rx/util/AtomicObservableSubscription.java @@ -18,8 +18,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; -import javax.annotation.concurrent.ThreadSafe; - import rx.Subscription; /** @@ -32,7 +30,6 @@ *
  • handle both synchronous and asynchronous subscribe() execution flows
  • * */ -@ThreadSafe public final class AtomicObservableSubscription implements Subscription { private AtomicReference actualSubscription = new AtomicReference(); diff --git a/rxjava-core/src/main/java/rx/util/SynchronizedObserver.java b/rxjava-core/src/main/java/rx/util/SynchronizedObserver.java index eddb0c85ede..11f71383034 100644 --- a/rxjava-core/src/main/java/rx/util/SynchronizedObserver.java +++ b/rxjava-core/src/main/java/rx/util/SynchronizedObserver.java @@ -26,8 +26,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import javax.annotation.concurrent.ThreadSafe; - import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -50,7 +48,6 @@ * * @param */ -@ThreadSafe public final class SynchronizedObserver implements Observer { /**