diff --git a/src/main/java/io/reactivex/processors/AsyncProcessor.java b/src/main/java/io/reactivex/processors/AsyncProcessor.java index b03bef985d..37d6937e49 100644 --- a/src/main/java/io/reactivex/processors/AsyncProcessor.java +++ b/src/main/java/io/reactivex/processors/AsyncProcessor.java @@ -254,7 +254,9 @@ public T getValue() { * Returns an Object array containing snapshot all values of the Subject. *

The method is thread-safe. * @return the array containing the snapshot of all values of the Subject + * @deprecated in 2.1.14; put the result of {@link #getValue()} into an array manually, will be removed in 3.x */ + @Deprecated public Object[] getValues() { T v = getValue(); return v != null ? new Object[] { v } : new Object[0]; @@ -267,7 +269,9 @@ public Object[] getValues() { *

The method is thread-safe. * @param array the target array to copy values into if it fits * @return the given array if the values fit into it or a new array containing all values + * @deprecated in 2.1.14; put the result of {@link #getValue()} into an array manually, will be removed in 3.x */ + @Deprecated public T[] getValues(T[] array) { T v = getValue(); if (v == null) { diff --git a/src/main/java/io/reactivex/processors/BehaviorProcessor.java b/src/main/java/io/reactivex/processors/BehaviorProcessor.java index 55fb95fe8b..4c407a7e7f 100644 --- a/src/main/java/io/reactivex/processors/BehaviorProcessor.java +++ b/src/main/java/io/reactivex/processors/BehaviorProcessor.java @@ -377,7 +377,9 @@ public T getValue() { * Returns an Object array containing snapshot all values of the BehaviorProcessor. *

The method is thread-safe. * @return the array containing the snapshot of all values of the BehaviorProcessor + * @deprecated in 2.1.14; put the result of {@link #getValue()} into an array manually, will be removed in 3.x */ + @Deprecated public Object[] getValues() { @SuppressWarnings("unchecked") T[] a = (T[])EMPTY_ARRAY; @@ -396,7 +398,9 @@ public Object[] getValues() { *

The method is thread-safe. * @param array the target array to copy values into if it fits * @return the given array if the values fit into it or a new array containing all values + * @deprecated in 2.1.14; put the result of {@link #getValue()} into an array manually, will be removed in 3.x */ + @Deprecated @SuppressWarnings("unchecked") public T[] getValues(T[] array) { Object o = value.get(); diff --git a/src/main/java/io/reactivex/subjects/AsyncSubject.java b/src/main/java/io/reactivex/subjects/AsyncSubject.java index af5b6e5fdd..2a99ab03ad 100644 --- a/src/main/java/io/reactivex/subjects/AsyncSubject.java +++ b/src/main/java/io/reactivex/subjects/AsyncSubject.java @@ -325,7 +325,9 @@ public T getValue() { * Returns an Object array containing snapshot all values of the Subject. *

The method is thread-safe. * @return the array containing the snapshot of all values of the Subject + * @deprecated in 2.1.14; put the result of {@link #getValue()} into an array manually, will be removed in 3.x */ + @Deprecated public Object[] getValues() { T v = getValue(); return v != null ? new Object[] { v } : new Object[0]; @@ -338,7 +340,9 @@ public Object[] getValues() { *

The method is thread-safe. * @param array the target array to copy values into if it fits * @return the given array if the values fit into it or a new array containing all values + * @deprecated in 2.1.14; put the result of {@link #getValue()} into an array manually, will be removed in 3.x */ + @Deprecated public T[] getValues(T[] array) { T v = getValue(); if (v == null) { diff --git a/src/main/java/io/reactivex/subjects/BehaviorSubject.java b/src/main/java/io/reactivex/subjects/BehaviorSubject.java index 7199ba2d0c..d147f24b85 100644 --- a/src/main/java/io/reactivex/subjects/BehaviorSubject.java +++ b/src/main/java/io/reactivex/subjects/BehaviorSubject.java @@ -331,7 +331,9 @@ public T getValue() { * Returns an Object array containing snapshot all values of the Subject. *

The method is thread-safe. * @return the array containing the snapshot of all values of the Subject + * @deprecated in 2.1.14; put the result of {@link #getValue()} into an array manually, will be removed in 3.x */ + @Deprecated public Object[] getValues() { @SuppressWarnings("unchecked") T[] a = (T[])EMPTY_ARRAY; @@ -350,7 +352,9 @@ public Object[] getValues() { *

The method is thread-safe. * @param array the target array to copy values into if it fits * @return the given array if the values fit into it or a new array containing all values + * @deprecated in 2.1.14; put the result of {@link #getValue()} into an array manually, will be removed in 3.x */ + @Deprecated @SuppressWarnings("unchecked") public T[] getValues(T[] array) { Object o = value.get(); diff --git a/src/test/java/io/reactivex/processors/SerializedProcessorTest.java b/src/test/java/io/reactivex/processors/SerializedProcessorTest.java index 790419220e..efbfe02a69 100644 --- a/src/test/java/io/reactivex/processors/SerializedProcessorTest.java +++ b/src/test/java/io/reactivex/processors/SerializedProcessorTest.java @@ -38,6 +38,7 @@ public void testBasic() { ts.assertValue("hello"); } + @SuppressWarnings("deprecation") @Test public void testAsyncSubjectValueRelay() { AsyncProcessor async = AsyncProcessor.create(); @@ -56,6 +57,8 @@ public void testAsyncSubjectValueRelay() { assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { 1, null }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testAsyncSubjectValueEmpty() { AsyncProcessor async = AsyncProcessor.create(); @@ -73,6 +76,8 @@ public void testAsyncSubjectValueEmpty() { assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testAsyncSubjectValueError() { AsyncProcessor async = AsyncProcessor.create(); @@ -91,6 +96,7 @@ public void testAsyncSubjectValueError() { assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 })); } + @Test public void testPublishSubjectValueRelay() { PublishProcessor async = PublishProcessor.create(); @@ -128,6 +134,7 @@ public void testPublishSubjectValueError() { assertSame(te, serial.getThrowable()); } + @SuppressWarnings("deprecation") @Test public void testBehaviorSubjectValueRelay() { BehaviorProcessor async = BehaviorProcessor.create(); @@ -146,6 +153,8 @@ public void testBehaviorSubjectValueRelay() { assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testBehaviorSubjectValueRelayIncomplete() { BehaviorProcessor async = BehaviorProcessor.create(); @@ -163,6 +172,8 @@ public void testBehaviorSubjectValueRelayIncomplete() { assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { 1, null }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testBehaviorSubjectIncompleteEmpty() { BehaviorProcessor async = BehaviorProcessor.create(); @@ -179,6 +190,8 @@ public void testBehaviorSubjectIncompleteEmpty() { assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testBehaviorSubjectEmpty() { BehaviorProcessor async = BehaviorProcessor.create(); @@ -196,6 +209,8 @@ public void testBehaviorSubjectEmpty() { assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testBehaviorSubjectError() { BehaviorProcessor async = BehaviorProcessor.create(); diff --git a/src/test/java/io/reactivex/subjects/SerializedSubjectTest.java b/src/test/java/io/reactivex/subjects/SerializedSubjectTest.java index e1042c8680..31498d7a04 100644 --- a/src/test/java/io/reactivex/subjects/SerializedSubjectTest.java +++ b/src/test/java/io/reactivex/subjects/SerializedSubjectTest.java @@ -39,6 +39,7 @@ public void testBasic() { to.assertValue("hello"); } + @SuppressWarnings("deprecation") @Test public void testAsyncSubjectValueRelay() { AsyncSubject async = AsyncSubject.create(); @@ -57,6 +58,8 @@ public void testAsyncSubjectValueRelay() { assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { 1, null }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testAsyncSubjectValueEmpty() { AsyncSubject async = AsyncSubject.create(); @@ -74,6 +77,8 @@ public void testAsyncSubjectValueEmpty() { assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testAsyncSubjectValueError() { AsyncSubject async = AsyncSubject.create(); @@ -92,6 +97,7 @@ public void testAsyncSubjectValueError() { assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 })); } + @Test public void testPublishSubjectValueRelay() { PublishSubject async = PublishSubject.create(); @@ -129,6 +135,7 @@ public void testPublishSubjectValueError() { assertSame(te, serial.getThrowable()); } + @SuppressWarnings("deprecation") @Test public void testBehaviorSubjectValueRelay() { BehaviorSubject async = BehaviorSubject.create(); @@ -147,6 +154,8 @@ public void testBehaviorSubjectValueRelay() { assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testBehaviorSubjectValueRelayIncomplete() { BehaviorSubject async = BehaviorSubject.create(); @@ -164,6 +173,8 @@ public void testBehaviorSubjectValueRelayIncomplete() { assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { 1, null }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testBehaviorSubjectIncompleteEmpty() { BehaviorSubject async = BehaviorSubject.create(); @@ -180,6 +191,8 @@ public void testBehaviorSubjectIncompleteEmpty() { assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testBehaviorSubjectEmpty() { BehaviorSubject async = BehaviorSubject.create(); @@ -197,6 +210,8 @@ public void testBehaviorSubjectEmpty() { assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 })); } + + @SuppressWarnings("deprecation") @Test public void testBehaviorSubjectError() { BehaviorSubject async = BehaviorSubject.create(); @@ -234,6 +249,7 @@ public void testReplaySubjectValueRelay() { assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[] { 0 })); assertArrayEquals(new Integer[] { 1, null }, async.getValues(new Integer[] { 0, 0 })); } + @Test public void testReplaySubjectValueRelayIncomplete() { ReplaySubject async = ReplaySubject.create();