Skip to content

Commit c6e43fc

Browse files
committed
1.0.15. Beta/Deprecation of Subject state peeking methods.
This should give users one release to prepare for the class structure changes.
1 parent ebe28de commit c6e43fc

File tree

6 files changed

+101
-50
lines changed

6 files changed

+101
-50
lines changed

src/main/java/rx/subjects/AsyncSubject.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import java.util.*;
2020

2121
import rx.Observer;
22-
import rx.annotations.Experimental;
22+
import rx.annotations.Beta;
2323
import rx.exceptions.Exceptions;
2424
import rx.functions.Action1;
2525
import rx.internal.operators.NotificationLite;
@@ -141,7 +141,7 @@ public boolean hasObservers() {
141141
* retrieved by {@code getValue()} may get outdated.
142142
* @return true if and only if the subject has some value but not an error
143143
*/
144-
@Experimental
144+
@Beta
145145
@Override
146146
public boolean hasValue() {
147147
Object v = lastValue;
@@ -152,7 +152,7 @@ public boolean hasValue() {
152152
* Check if the Subject has terminated with an exception.
153153
* @return true if the subject has received a throwable through {@code onError}.
154154
*/
155-
@Experimental
155+
@Beta
156156
@Override
157157
public boolean hasThrowable() {
158158
Object o = state.get();
@@ -162,7 +162,7 @@ public boolean hasThrowable() {
162162
* Check if the Subject has terminated normally.
163163
* @return true if the subject completed normally via {@code onCompleted()}
164164
*/
165-
@Experimental
165+
@Beta
166166
@Override
167167
public boolean hasCompleted() {
168168
Object o = state.get();
@@ -177,7 +177,7 @@ public boolean hasCompleted() {
177177
* @return the current value or {@code null} if the Subject doesn't have a value,
178178
* has terminated with an exception or has an actual {@code null} as a value.
179179
*/
180-
@Experimental
180+
@Beta
181181
@Override
182182
public T getValue() {
183183
Object v = lastValue;
@@ -192,7 +192,7 @@ public T getValue() {
192192
* @return the Throwable that terminated the Subject or {@code null} if the
193193
* subject hasn't terminated yet or it terminated normally.
194194
*/
195-
@Experimental
195+
@Beta
196196
@Override
197197
public Throwable getThrowable() {
198198
Object o = state.get();
@@ -202,7 +202,7 @@ public Throwable getThrowable() {
202202
return null;
203203
}
204204
@Override
205-
@Experimental
205+
@Deprecated
206206
@SuppressWarnings("unchecked")
207207
public T[] getValues(T[] a) {
208208
Object v = lastValue;

src/main/java/rx/subjects/BehaviorSubject.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.util.*;
2121

2222
import rx.Observer;
23-
import rx.annotations.Experimental;
23+
import rx.annotations.Beta;
2424
import rx.exceptions.Exceptions;
2525
import rx.functions.Action1;
2626
import rx.internal.operators.NotificationLite;
@@ -177,7 +177,7 @@ public boolean hasObservers() {
177177
* retrieved by {@code getValue()} may get outdated.
178178
* @return true if and only if the subject has some value and hasn't terminated yet.
179179
*/
180-
@Experimental
180+
@Beta
181181
@Override
182182
public boolean hasValue() {
183183
Object o = state.get();
@@ -187,7 +187,7 @@ public boolean hasValue() {
187187
* Check if the Subject has terminated with an exception.
188188
* @return true if the subject has received a throwable through {@code onError}.
189189
*/
190-
@Experimental
190+
@Beta
191191
@Override
192192
public boolean hasThrowable() {
193193
Object o = state.get();
@@ -197,7 +197,7 @@ public boolean hasThrowable() {
197197
* Check if the Subject has terminated normally.
198198
* @return true if the subject completed normally via {@code onCompleted()}
199199
*/
200-
@Experimental
200+
@Beta
201201
@Override
202202
public boolean hasCompleted() {
203203
Object o = state.get();
@@ -212,7 +212,7 @@ public boolean hasCompleted() {
212212
* @return the current value or {@code null} if the Subject doesn't have a value,
213213
* has terminated or has an actual {@code null} as a valid value.
214214
*/
215-
@Experimental
215+
@Beta
216216
@Override
217217
public T getValue() {
218218
Object o = state.get();
@@ -226,7 +226,7 @@ public T getValue() {
226226
* @return the Throwable that terminated the Subject or {@code null} if the
227227
* subject hasn't terminated yet or it terminated normally.
228228
*/
229-
@Experimental
229+
@Beta
230230
@Override
231231
public Throwable getThrowable() {
232232
Object o = state.get();
@@ -236,7 +236,7 @@ public Throwable getThrowable() {
236236
return null;
237237
}
238238
@Override
239-
@Experimental
239+
@Beta
240240
@SuppressWarnings("unchecked")
241241
public T[] getValues(T[] a) {
242242
Object o = state.get();

src/main/java/rx/subjects/PublishSubject.java

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import java.util.*;
1919

2020
import rx.Observer;
21-
import rx.annotations.Experimental;
21+
import rx.annotations.Beta;
2222
import rx.exceptions.Exceptions;
2323
import rx.functions.Action1;
2424
import rx.internal.operators.NotificationLite;
@@ -124,7 +124,7 @@ public boolean hasObservers() {
124124
* Check if the Subject has terminated with an exception.
125125
* @return true if the subject has received a throwable through {@code onError}.
126126
*/
127-
@Experimental
127+
@Beta
128128
@Override
129129
public boolean hasThrowable() {
130130
Object o = state.get();
@@ -134,7 +134,7 @@ public boolean hasThrowable() {
134134
* Check if the Subject has terminated normally.
135135
* @return true if the subject completed normally via {@code onCompleted}
136136
*/
137-
@Experimental
137+
@Beta
138138
@Override
139139
public boolean hasCompleted() {
140140
Object o = state.get();
@@ -145,7 +145,7 @@ public boolean hasCompleted() {
145145
* @return the Throwable that terminated the Subject or {@code null} if the
146146
* subject hasn't terminated yet or it terminated normally.
147147
*/
148-
@Experimental
148+
@Beta
149149
@Override
150150
public Throwable getThrowable() {
151151
Object o = state.get();
@@ -155,23 +155,40 @@ public Throwable getThrowable() {
155155
return null;
156156
}
157157

158+
/**
159+
* {@inheritDoc}
160+
* @deprecated this method is scheduled to be removed in the next release
161+
*/
158162
@Override
159-
@Experimental
163+
@Deprecated
160164
public boolean hasValue() {
161165
return false;
162166
}
167+
168+
/**
169+
* {@inheritDoc}
170+
* @deprecated this method is scheduled to be removed in the next release
171+
*/
163172
@Override
164-
@Experimental
173+
@Deprecated
165174
public T getValue() {
166175
return null;
167176
}
177+
/**
178+
* {@inheritDoc}
179+
* @deprecated this method is scheduled to be removed in the next release
180+
*/
168181
@Override
169-
@Experimental
182+
@Deprecated
170183
public Object[] getValues() {
171184
return new Object[0];
172185
}
186+
/**
187+
* {@inheritDoc}
188+
* @deprecated this method is scheduled to be removed in the next release
189+
*/
173190
@Override
174-
@Experimental
191+
@Deprecated
175192
public T[] getValues(T[] a) {
176193
if (a.length > 0) {
177194
a[0] = null;

src/main/java/rx/subjects/ReplaySubject.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import java.util.concurrent.TimeUnit;
2121
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
2222

23-
import rx.*;
2423
import rx.Observer;
25-
import rx.annotations.Experimental;
24+
import rx.Scheduler;
25+
import rx.annotations.Beta;
2626
import rx.exceptions.Exceptions;
2727
import rx.functions.*;
2828
import rx.internal.operators.NotificationLite;
@@ -1098,7 +1098,7 @@ public void evictFinal(NodeList<Object> list) {
10981098
* Check if the Subject has terminated with an exception.
10991099
* @return true if the subject has received a throwable through {@code onError}.
11001100
*/
1101-
@Experimental
1101+
@Beta
11021102
@Override
11031103
public boolean hasThrowable() {
11041104
NotificationLite<T> nl = ssm.nl;
@@ -1109,7 +1109,7 @@ public boolean hasThrowable() {
11091109
* Check if the Subject has terminated normally.
11101110
* @return true if the subject completed normally via {@code onCompleted}
11111111
*/
1112-
@Experimental
1112+
@Beta
11131113
@Override
11141114
public boolean hasCompleted() {
11151115
NotificationLite<T> nl = ssm.nl;
@@ -1121,7 +1121,7 @@ public boolean hasCompleted() {
11211121
* @return the Throwable that terminated the Subject or {@code null} if the
11221122
* subject hasn't terminated yet or it terminated normally.
11231123
*/
1124-
@Experimental
1124+
@Beta
11251125
@Override
11261126
public Throwable getThrowable() {
11271127
NotificationLite<T> nl = ssm.nl;
@@ -1135,18 +1135,18 @@ public Throwable getThrowable() {
11351135
* Returns the current number of items (non-terminal events) available for replay.
11361136
* @return the number of items available
11371137
*/
1138-
@Experimental
1138+
@Beta
11391139
public int size() {
11401140
return state.size();
11411141
}
11421142
/**
11431143
* @return true if the Subject holds at least one non-terminal event available for replay
11441144
*/
1145-
@Experimental
1145+
@Beta
11461146
public boolean hasAnyValue() {
11471147
return !state.isEmpty();
11481148
}
1149-
@Experimental
1149+
@Beta
11501150
@Override
11511151
public boolean hasValue() {
11521152
return hasAnyValue();
@@ -1157,12 +1157,14 @@ public boolean hasValue() {
11571157
* @param a the array to fill in
11581158
* @return the array {@code a} if it had enough capacity or a new array containing the available values
11591159
*/
1160-
@Experimental
1160+
@Beta
11611161
@Override
11621162
public T[] getValues(T[] a) {
11631163
return state.toArray(a);
11641164
}
1165+
11651166
@Override
1167+
@Beta
11661168
public T getValue() {
11671169
return state.latest();
11681170
}

src/main/java/rx/subjects/SerializedSubject.java

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package rx.subjects;
1717

1818
import rx.Subscriber;
19-
import rx.annotations.Experimental;
2019
import rx.observers.SerializedObserver;
2120

2221
/**
@@ -69,38 +68,67 @@ public void onNext(T t) {
6968
public boolean hasObservers() {
7069
return actual.hasObservers();
7170
}
71+
72+
/**
73+
* {@inheritDoc}
74+
* @deprecated this method is scheduled to be removed in the next release
75+
*/
7276
@Override
73-
@Experimental
77+
@Deprecated
7478
public boolean hasCompleted() {
7579
return actual.hasCompleted();
7680
}
81+
/**
82+
* {@inheritDoc}
83+
* @deprecated this method is scheduled to be removed in the next release
84+
*/
7785
@Override
78-
@Experimental
86+
@Deprecated
7987
public boolean hasThrowable() {
8088
return actual.hasThrowable();
8189
}
90+
/**
91+
* {@inheritDoc}
92+
* @deprecated this method is scheduled to be removed in the next release
93+
*/
8294
@Override
83-
@Experimental
95+
@Deprecated
8496
public boolean hasValue() {
8597
return actual.hasValue();
8698
}
99+
/**
100+
* {@inheritDoc}
101+
* @deprecated this method is scheduled to be removed in the next release
102+
*/
87103
@Override
88-
@Experimental
104+
@Deprecated
89105
public Throwable getThrowable() {
90106
return actual.getThrowable();
91107
}
108+
/**
109+
* {@inheritDoc}
110+
* @deprecated this method is scheduled to be removed in the next release
111+
*/
92112
@Override
93-
@Experimental
113+
@Deprecated
94114
public T getValue() {
95115
return actual.getValue();
96116
}
117+
/**
118+
* {@inheritDoc}
119+
* @deprecated this method is scheduled to be removed in the next release
120+
*/
97121
@Override
98-
@Experimental
122+
@Deprecated
99123
public Object[] getValues() {
100124
return actual.getValues();
101125
}
126+
/**
127+
* {@inheritDoc}
128+
* @deprecated this method is scheduled to be removed in the next release
129+
*/
102130
@Override
103-
@Experimental
131+
@Deprecated
104132
public T[] getValues(T[] a) {
105133
return actual.getValues(a);
106134
}

0 commit comments

Comments
 (0)