Skip to content

Commit 8cf821a

Browse files
committed
Fix issue #1173
1 parent 50b618e commit 8cf821a

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Subscriber.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ object Subscriber extends ObserverFactoryMethods[Subscriber] {
3434

3535
private[scala] def apply[T](subscriber: rx.Subscriber[T]): Subscriber[T] = new Subscriber[T] {
3636
override val asJavaSubscriber = subscriber
37+
override val asJavaObserver: rx.Observer[_ >: T] = asJavaSubscriber
38+
override val asJavaSubscription: rx.Subscription = asJavaSubscriber
3739

3840
override def onNext(value: T): Unit = asJavaSubscriber.onNext(value)
3941
override def onError(error: Throwable): Unit = asJavaSubscriber.onError(error)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright 2013 Netflix, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package rx.lang.scala
17+
18+
import org.junit.Test
19+
import org.junit.Assert.assertNotNull
20+
import org.scalatest.junit.JUnitSuite
21+
22+
class SubscriberTests extends JUnitSuite {
23+
24+
@Test def testIssue1173() {
25+
// https://github.com/Netflix/RxJava/issues/1173
26+
val subscriber = Subscriber((n: Int) => println(n))
27+
assertNotNull(subscriber.asJavaObserver)
28+
assertNotNull(subscriber.asJavaSubscription)
29+
assertNotNull(subscriber.asJavaSubscriber)
30+
}
31+
32+
}

0 commit comments

Comments
 (0)