From 2afbe5c470fb9936a9cccf3cf8b08772762720d7 Mon Sep 17 00:00:00 2001 From: Joachim Hofer Date: Thu, 12 Sep 2013 09:44:33 +0200 Subject: [PATCH 1/2] a few warnings, javadoc, and one missing scheduler parameter --- rxjava-core/src/main/java/rx/Observable.java | 4 +--- .../src/main/java/rx/operators/OperationGroupBy.java | 1 - rxjava-core/src/main/java/rx/operators/OperationMap.java | 5 ----- rxjava-core/src/main/java/rx/operators/OperationRetry.java | 2 +- .../src/main/java/rx/operators/OperationTakeUntil.java | 6 ------ .../src/test/java/rx/concurrency/TestSchedulers.java | 6 ------ .../src/test/java/rx/performance/PerformanceTest.java | 1 - 7 files changed, 2 insertions(+), 23 deletions(-) diff --git a/rxjava-core/src/main/java/rx/Observable.java b/rxjava-core/src/main/java/rx/Observable.java index 8bfe25ce63..5e33c18367 100644 --- a/rxjava-core/src/main/java/rx/Observable.java +++ b/rxjava-core/src/main/java/rx/Observable.java @@ -1863,7 +1863,7 @@ public Observable debounce(long timeout, TimeUnit unit) { * @see {@link #throttleWithTimeout}; */ public Observable debounce(long timeout, TimeUnit unit, Scheduler scheduler) { - return create(OperationDebounce.debounce(this, timeout, unit)); + return create(OperationDebounce.debounce(this, timeout, unit, scheduler)); } /** @@ -1924,8 +1924,6 @@ public Observable throttleWithTimeout(long timeout, TimeUnit unit, Scheduler * Time to wait before sending another value after emitting last value. * @param unit * The unit of time for the specified timeout. - * @param scheduler - * The {@link Scheduler} to use internally to manage the timers which handle timeout for each event. * @return Observable which performs the throttle operation. */ public Observable throttleFirst(long windowDuration, TimeUnit unit) { diff --git a/rxjava-core/src/main/java/rx/operators/OperationGroupBy.java b/rxjava-core/src/main/java/rx/operators/OperationGroupBy.java index c7ec074c85..96a6861406 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationGroupBy.java +++ b/rxjava-core/src/main/java/rx/operators/OperationGroupBy.java @@ -287,7 +287,6 @@ public void testEmpty() { public void testError() { Observable sourceStrings = Observable.from("one", "two", "three", "four", "five", "six"); Observable errorSource = Observable.error(new RuntimeException("forced failure")); - @SuppressWarnings("unchecked") Observable source = Observable.concat(sourceStrings, errorSource); Observable> grouped = Observable.create(groupBy(source, length)); diff --git a/rxjava-core/src/main/java/rx/operators/OperationMap.java b/rxjava-core/src/main/java/rx/operators/OperationMap.java index bdc9ee5098..fa7fca2758 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationMap.java +++ b/rxjava-core/src/main/java/rx/operators/OperationMap.java @@ -148,7 +148,6 @@ public void before() { public void testMap() { Map m1 = getMap("One"); Map m2 = getMap("Two"); - @SuppressWarnings("unchecked") Observable> observable = Observable.from(m1, m2); Observable m = Observable.create(map(observable, new Func1, String>() { @@ -176,7 +175,6 @@ public void testMapMany() { /* now simulate the behavior to take those IDs and perform nested async calls based on them */ Observable m = Observable.create(mapMany(ids, new Func1>() { - @SuppressWarnings("unchecked") @Override public Observable call(Integer id) { /* simulate making a nested async call which creates another Observable */ @@ -215,15 +213,12 @@ public String call(Map map) { public void testMapMany2() { Map m1 = getMap("One"); Map m2 = getMap("Two"); - @SuppressWarnings("unchecked") Observable> observable1 = Observable.from(m1, m2); Map m3 = getMap("Three"); Map m4 = getMap("Four"); - @SuppressWarnings("unchecked") Observable> observable2 = Observable.from(m3, m4); - @SuppressWarnings("unchecked") Observable>> observable = Observable.from(observable1, observable2); Observable m = Observable.create(mapMany(observable, new Func1>, Observable>() { diff --git a/rxjava-core/src/main/java/rx/operators/OperationRetry.java b/rxjava-core/src/main/java/rx/operators/OperationRetry.java index c7007a00a7..977373cb01 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationRetry.java +++ b/rxjava-core/src/main/java/rx/operators/OperationRetry.java @@ -198,6 +198,6 @@ public Subscription onSubscribe(Observer o) { } return Subscriptions.empty(); } - }; + } } } diff --git a/rxjava-core/src/main/java/rx/operators/OperationTakeUntil.java b/rxjava-core/src/main/java/rx/operators/OperationTakeUntil.java index ab2d6045a9..841190f023 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationTakeUntil.java +++ b/rxjava-core/src/main/java/rx/operators/OperationTakeUntil.java @@ -50,12 +50,6 @@ public static Observable takeUntil(final Observable sourc Observable> s = Observable.create(new SourceObservable(source)); Observable> o = Observable.create(new OtherObservable(other)); - @SuppressWarnings("unchecked") - /** - * In JDK 7 we could use 'varargs' instead of 'unchecked'. - * See http://stackoverflow.com/questions/1445233/is-it-possible-to-solve-the-a-generic-array-of-t-is-created-for-a-varargs-param - * and http://hg.openjdk.java.net/jdk7/tl/langtools/rev/46cf751559ae - */ Observable> result = Observable.merge(s, o); return result.takeWhile(new Func1, Boolean>() { diff --git a/rxjava-core/src/test/java/rx/concurrency/TestSchedulers.java b/rxjava-core/src/test/java/rx/concurrency/TestSchedulers.java index e3da50b6f4..4241ee3f84 100644 --- a/rxjava-core/src/test/java/rx/concurrency/TestSchedulers.java +++ b/rxjava-core/src/test/java/rx/concurrency/TestSchedulers.java @@ -44,7 +44,6 @@ public void testComputationThreadPool1() { Observable o1 = Observable. from(1, 2, 3, 4, 5); Observable o2 = Observable. from(6, 7, 8, 9, 10); - @SuppressWarnings("unchecked") Observable o = Observable. merge(o1, o2).map(new Func1() { @Override @@ -68,7 +67,6 @@ public void testIOThreadPool1() { Observable o1 = Observable. from(1, 2, 3, 4, 5); Observable o2 = Observable. from(6, 7, 8, 9, 10); - @SuppressWarnings("unchecked") Observable o = Observable. merge(o1, o2).map(new Func1() { @Override @@ -94,7 +92,6 @@ public void testMergeWithoutScheduler1() { Observable o1 = Observable. from(1, 2, 3, 4, 5); Observable o2 = Observable. from(6, 7, 8, 9, 10); - @SuppressWarnings("unchecked") Observable o = Observable. merge(o1, o2).map(new Func1() { @Override @@ -120,7 +117,6 @@ public void testMergeWithImmediateScheduler1() { Observable o1 = Observable. from(1, 2, 3, 4, 5); Observable o2 = Observable. from(6, 7, 8, 9, 10); - @SuppressWarnings("unchecked") Observable o = Observable. merge(o1, o2).subscribeOn(Schedulers.immediate()).map(new Func1() { @Override @@ -146,7 +142,6 @@ public void testMergeWithCurrentThreadScheduler1() { Observable o1 = Observable. from(1, 2, 3, 4, 5); Observable o2 = Observable. from(6, 7, 8, 9, 10); - @SuppressWarnings("unchecked") Observable o = Observable. merge(o1, o2).subscribeOn(Schedulers.currentThread()).map(new Func1() { @Override @@ -172,7 +167,6 @@ public void testMergeWithScheduler1() { Observable o1 = Observable. from(1, 2, 3, 4, 5); Observable o2 = Observable. from(6, 7, 8, 9, 10); - @SuppressWarnings("unchecked") Observable o = Observable. merge(o1, o2).subscribeOn(Schedulers.threadPoolForComputation()).map(new Func1() { @Override diff --git a/rxjava-core/src/test/java/rx/performance/PerformanceTest.java b/rxjava-core/src/test/java/rx/performance/PerformanceTest.java index 73dcf8c25b..5a92609bbe 100644 --- a/rxjava-core/src/test/java/rx/performance/PerformanceTest.java +++ b/rxjava-core/src/test/java/rx/performance/PerformanceTest.java @@ -122,7 +122,6 @@ public static void main(String[] args) { System.out.println("nonCompositionalTestWithArrayOfFunctionsTotalTime: " + nonCompositionalTestWithArrayOfFunctionsTotalTime.get()); } - @SuppressWarnings("unchecked") public void runCompositionTestWithMultipleOperations(AtomicLong aggregateTime, Integer[] values) { System.out.println("runCompositionTestWithMultipleOperations"); From 965a2125b72042017137d2a4e13a2ea95cee094d Mon Sep 17 00:00:00 2001 From: Joachim Hofer Date: Thu, 12 Sep 2013 13:39:09 +0200 Subject: [PATCH 2/2] fixed all the javadoc build warnings --- rxjava-core/src/main/java/rx/Observable.java | 60 ++++++------------- .../java/rx/operators/ChunkedOperation.java | 5 +- 2 files changed, 22 insertions(+), 43 deletions(-) diff --git a/rxjava-core/src/main/java/rx/Observable.java b/rxjava-core/src/main/java/rx/Observable.java index 5e33c18367..beac20163e 100644 --- a/rxjava-core/src/main/java/rx/Observable.java +++ b/rxjava-core/src/main/java/rx/Observable.java @@ -19,7 +19,6 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.List; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; @@ -544,7 +543,7 @@ public static Observable from(Iterable iterable) { *

Implementation note: the entire iterable sequence will be immediately emitted each time an {@link Observer} subscribes. Since this occurs before the {@link Subscription} is returned, * it in not possible to unsubscribe from the sequence before it completes. * - * @param array + * @param items * the source sequence * @param * the type of items in the {@link Iterable} sequence and the type of items to be @@ -1434,7 +1433,7 @@ public static Observable mergeDelayError(Observable Observable mergeDelayError(Observable t1, Obse } /** - * This behaves like {@link #merge(Observable...)} except that if any of the merged Observables + * This behaves like {@link #merge(Observable, Observable, Observable)} except that if any of the merged Observables * notify of an error via {@link Observer#onError onError}, {@code mergeDelayError} will * refrain from propagating that error notification until all of the merged Observables have * finished emitting items. @@ -1492,7 +1491,7 @@ public static Observable mergeDelayError(Observable t1, Obse } /** - * This behaves like {@link #merge(Observable...)} except that if any of the merged Observables + * This behaves like {@link #merge(Observable, Observable, Observable, Observable)} except that if any of the merged Observables * notify of an error via {@link Observer#onError onError}, {@code mergeDelayError} will * refrain from propagating that error notification until all of the merged Observables have * finished emitting items. @@ -1524,7 +1523,7 @@ public static Observable mergeDelayError(Observable t1, Obse } /** - * This behaves like {@link #merge(Observable...)} except that if any of the merged Observables + * This behaves like {@link #merge(Observable, Observable, Observable, Observable, Observable)} except that if any of the merged Observables * notify of an error via {@link Observer#onError onError}, {@code mergeDelayError} will * refrain from propagating that error notification until all of the merged Observables have * finished emitting items. @@ -1558,7 +1557,7 @@ public static Observable mergeDelayError(Observable t1, Obse } /** - * This behaves like {@link #merge(Observable...)} except that if any of the merged Observables + * This behaves like {@link #merge(Observable, Observable, Observable, Observable, Observable, Observable)} except that if any of the merged Observables * notify of an error via {@link Observer#onError onError}, {@code mergeDelayError} will * refrain from propagating that error notification until all of the merged Observables have * finished emitting items. @@ -1594,7 +1593,7 @@ public static Observable mergeDelayError(Observable t1, Obse } /** - * This behaves like {@link #merge(Observable...)} except that if any of the merged Observables + * This behaves like {@link #merge(Observable, Observable, Observable, Observable, Observable, Observable, Observable)} except that if any of the merged Observables * notify of an error via {@link Observer#onError onError}, {@code mergeDelayError} will * refrain from propagating that error notification until all of the merged Observables have * finished emitting items. @@ -1632,7 +1631,7 @@ public static Observable mergeDelayError(Observable t1, Obse } /** - * This behaves like {@link #merge(Observable...)} except that if any of the merged Observables + * This behaves like {@link #merge(Observable, Observable, Observable, Observable, Observable, Observable, Observable, Observable)} except that if any of the merged Observables * notify of an error via {@link Observer#onError onError}, {@code mergeDelayError} will * refrain from propagating that error notification until all of the merged Observables have * finished emitting items. @@ -1672,7 +1671,7 @@ public static Observable mergeDelayError(Observable t1, Obse } /** - * This behaves like {@link #merge(Observable...)} except that if any of the merged Observables + * This behaves like {@link #merge(Observable, Observable, Observable, Observable, Observable, Observable, Observable, Observable, Observable)} except that if any of the merged Observables * notify of an error via {@link Observer#onError onError}, {@code mergeDelayError} will * refrain from propagating that error notification until all of the merged Observables have * finished emitting items. @@ -1832,7 +1831,7 @@ public static Observable interval(long interval, TimeUnit unit, Scheduler * The {@link TimeUnit} for the timeout. * * @return An {@link Observable} which filters out values which are too quickly followed up with newer values. - * @see {@link #throttleWithTimeout}; + * @see #throttleWithTimeout(long, TimeUnit) */ public Observable debounce(long timeout, TimeUnit unit) { return create(OperationDebounce.debounce(this, timeout, unit)); @@ -1860,7 +1859,7 @@ public Observable debounce(long timeout, TimeUnit unit) { * @param scheduler * The {@link Scheduler} to use internally to manage the timers which handle timeout for each event. * @return Observable which performs the throttle operation. - * @see {@link #throttleWithTimeout}; + * @see #throttleWithTimeout(long, TimeUnit, Scheduler) */ public Observable debounce(long timeout, TimeUnit unit, Scheduler scheduler) { return create(OperationDebounce.debounce(this, timeout, unit, scheduler)); @@ -1887,7 +1886,7 @@ public Observable debounce(long timeout, TimeUnit unit, Scheduler scheduler) * The {@link TimeUnit} for the timeout. * * @return An {@link Observable} which filters out values which are too quickly followed up with newer values. - * @see {@link #debounce} + * @see #debounce(long, TimeUnit) */ public Observable throttleWithTimeout(long timeout, TimeUnit unit) { return create(OperationDebounce.debounce(this, timeout, unit)); @@ -1907,7 +1906,7 @@ public Observable throttleWithTimeout(long timeout, TimeUnit unit) { * @param scheduler * The {@link Scheduler} to use internally to manage the timers which handle timeout for each event. * @return Observable which performs the throttle operation. - * @see {@link #debounce} + * @see #debounce(long, TimeUnit, Scheduler) */ public Observable throttleWithTimeout(long timeout, TimeUnit unit, Scheduler scheduler) { return create(OperationDebounce.debounce(this, timeout, unit, scheduler)); @@ -1920,7 +1919,7 @@ public Observable throttleWithTimeout(long timeout, TimeUnit unit, Scheduler *

* * - * @param skipDuration + * @param windowDuration * Time to wait before sending another value after emitting last value. * @param unit * The unit of time for the specified timeout. @@ -1961,7 +1960,7 @@ public Observable throttleFirst(long skipDuration, TimeUnit unit, Scheduler s * @param unit * The unit of time for the specified interval. * @return Observable which performs the throttle operation. - * @see {@link #sample(long, TimeUnit)} + * @see #sample(long, TimeUnit) */ public Observable throttleLast(long intervalDuration, TimeUnit unit) { return sample(intervalDuration, unit); @@ -1979,7 +1978,7 @@ public Observable throttleLast(long intervalDuration, TimeUnit unit) { * @param unit * The unit of time for the specified interval. * @return Observable which performs the throttle operation. - * @see {@link #sample(long, TimeUnit, Scheduler)} + * @see #sample(long, TimeUnit, Scheduler) */ public Observable throttleLast(long intervalDuration, TimeUnit unit, Scheduler scheduler) { return sample(intervalDuration, unit, scheduler); @@ -2725,7 +2724,7 @@ public Observable> window(int count) { * The maximum size of each window before it should be emitted. * @param skip * How many produced values need to be skipped before starting a new window. Note that when "skip" and - * "count" are equals that this is the same operation as {@link Observable#window(Observable, int)}. + * "count" are equals that this is the same operation as {@link #window(int)}. * @return * An {@link Observable} which produces windows every "skipped" values containing at most * "count" produced values. @@ -3332,9 +3331,6 @@ public Observable retry(int retryCount) { *

* For example, if an Observable fails on first time but emits [1, 2] then succeeds the second time and * emits [1, 2, 3, 4, 5] then the complete output would be [1, 2, 1, 2, 3, 4, 5, onCompleted]. - * - * @param retryCount - * Number of retry attempts before failing. * @return Observable with retry logic. */ public Observable retry() { @@ -3655,7 +3651,7 @@ public Observable takeWhileWithIndex(final Func2MSDN: Observable.First - * @see {@link #first()} + * @see #first() */ public Observable takeFirst() { return first(); @@ -3670,7 +3666,7 @@ public Observable takeFirst() { * @return an Observable that emits only the very first item satisfying the given condition from the source, * or none if the source Observable completes without emitting a single matching item. * @see MSDN: Observable.First - * @see {@link #first(Func1)} + * @see #first(Func1) */ public Observable takeFirst(Func1 predicate) { return first(predicate); @@ -3810,8 +3806,6 @@ public Observable startWith(Iterable values) { * * @param t1 * item to include - * @param values - * Iterable of the items you want the modified Observable to emit first * @return an Observable that exhibits the modified behavior */ public Observable startWith(T t1) { @@ -3827,8 +3821,6 @@ public Observable startWith(T t1) { * item to include * @param t2 * item to include - * @param values - * Iterable of the items you want the modified Observable to emit first * @return an Observable that exhibits the modified behavior */ public Observable startWith(T t1, T t2) { @@ -3846,8 +3838,6 @@ public Observable startWith(T t1, T t2) { * item to include * @param t3 * item to include - * @param values - * Iterable of the items you want the modified Observable to emit first * @return an Observable that exhibits the modified behavior */ public Observable startWith(T t1, T t2, T t3) { @@ -3867,8 +3857,6 @@ public Observable startWith(T t1, T t2, T t3) { * item to include * @param t4 * item to include - * @param values - * Iterable of the items you want the modified Observable to emit first * @return an Observable that exhibits the modified behavior */ public Observable startWith(T t1, T t2, T t3, T t4) { @@ -3890,8 +3878,6 @@ public Observable startWith(T t1, T t2, T t3, T t4) { * item to include * @param t5 * item to include - * @param values - * Iterable of the items you want the modified Observable to emit first * @return an Observable that exhibits the modified behavior */ public Observable startWith(T t1, T t2, T t3, T t4, T t5) { @@ -3915,8 +3901,6 @@ public Observable startWith(T t1, T t2, T t3, T t4, T t5) { * item to include * @param t6 * item to include - * @param values - * Iterable of the items you want the modified Observable to emit first * @return an Observable that exhibits the modified behavior */ public Observable startWith(T t1, T t2, T t3, T t4, T t5, T t6) { @@ -3942,8 +3926,6 @@ public Observable startWith(T t1, T t2, T t3, T t4, T t5, T t6) { * item to include * @param t7 * item to include - * @param values - * Iterable of the items you want the modified Observable to emit first * @return an Observable that exhibits the modified behavior */ public Observable startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7) { @@ -3971,8 +3953,6 @@ public Observable startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7) { * item to include * @param t8 * item to include - * @param values - * Iterable of the items you want the modified Observable to emit first * @return an Observable that exhibits the modified behavior */ public Observable startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8) { @@ -4002,8 +3982,6 @@ public Observable startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8) { * item to include * @param t9 * item to include - * @param values - * Iterable of the items you want the modified Observable to emit first * @return an Observable that exhibits the modified behavior */ public Observable startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9) { diff --git a/rxjava-core/src/main/java/rx/operators/ChunkedOperation.java b/rxjava-core/src/main/java/rx/operators/ChunkedOperation.java index 1b5cf8d0d1..5cd0845ea5 100644 --- a/rxjava-core/src/main/java/rx/operators/ChunkedOperation.java +++ b/rxjava-core/src/main/java/rx/operators/ChunkedOperation.java @@ -61,7 +61,8 @@ protected interface ChunkCreator { * * @param * The type of objects which this {@link Chunk} can hold. - * The type of object being tracked by the {@link Chunk} + * @param + * The type of object being tracked by the {@link Chunk} */ protected abstract static class Chunk { protected final List contents = new ArrayList(); @@ -78,7 +79,7 @@ public void pushValue(T value) { /** * @return - * The mutable underlying {@link C} which contains all the + * The mutable underlying {@code C} which contains all the * recorded values in this {@link Chunk} object. */ abstract public C getContents();