File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,8 @@ object Observer {
63
63
*/
64
64
private [scala] def apply [T ](observer : rx.Observer [T ]) : Observer [T ] = {
65
65
new Observer [T ]() {
66
- override def asJavaObserver : rx.Observer [_ >: T ] = observer
66
+
67
+ override def asJavaObserver = observer
67
68
68
69
def onCompleted (): Unit = asJavaObserver.onCompleted()
69
70
def onError (error : Throwable ): Unit = asJavaObserver.onError(error)
Original file line number Diff line number Diff line change 15
15
*/
16
16
package rx .lang .scala
17
17
18
+ import rx .joins .ObserverBase
19
+
18
20
/**
19
21
* A Subject is an Observable and an Observer at the same time.
20
22
*/
21
23
trait Subject [- T , + R ] extends Observable [R ] with Observer [T ] {
22
- val asJavaSubject : rx.subjects.Subject [_ >: T , _< : R ]
24
+ val asJavaSubject : rx.subjects.Subject [_ >: T , _< : R ]
25
+
23
26
def asJavaObservable : rx.Observable [_ <: R ] = asJavaSubject
24
- override def asJavaObserver : rx.Observer [_ >: T ] = asJavaSubject
27
+
28
+ // temporary hack to workaround bugs in rx Subjects
29
+ override def asJavaObserver : rx.Observer [_ >: T ] = new ObserverBase [T ] {
30
+ protected def onErrorCore (error : Throwable ) = asJavaSubject.onError(error)
31
+ protected def onCompletedCore () = asJavaSubject.onCompleted()
32
+ protected def onNextCore (value : T ) = asJavaSubject.onNext(value)
33
+ }
25
34
26
35
def onCompleted (): Unit = asJavaObserver.onCompleted()
27
36
def onError (error : Throwable ): Unit = asJavaObserver.onError(error)
28
37
def onNext (value : T ): Unit = asJavaObserver.onNext(value)
38
+
29
39
}
30
40
You can’t perform that action at this time.
0 commit comments