Skip to content

Commit acfbc75

Browse files
Prevent direct instantiation of BlockingObservable via no-arg constructor
- also questioning why to allow extending this and would like to make it a private constructor
1 parent 35f20be commit acfbc75

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

rxjava-core/src/main/java/rx/observables/BlockingObservable.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@
4444
*/
4545
public class BlockingObservable<T> extends Observable<T> {
4646

47+
protected BlockingObservable(Func1<Observer<T>, Subscription> onSubscribe) {
48+
super(onSubscribe);
49+
}
50+
51+
/**
52+
* Used to prevent public instantiation
53+
*/
54+
@SuppressWarnings("unused")
55+
private BlockingObservable() {
56+
// prevent public instantiation
57+
}
58+
4759
public static <T> BlockingObservable<T> from(final Observable<T> o) {
4860
return new BlockingObservable<T>(new Func1<Observer<T>, Subscription>() {
4961

@@ -330,10 +342,6 @@ public static <T> Iterable<T> toIterable(final Observable<T> source) {
330342
return from(source).toIterable();
331343
}
332344

333-
protected BlockingObservable(Func1<Observer<T>, Subscription> onSubscribe) {
334-
super(onSubscribe);
335-
}
336-
337345
/**
338346
* Used for protecting against errors being thrown from Observer implementations and ensuring onNext/onError/onCompleted contract compliance.
339347
* <p>

0 commit comments

Comments
 (0)