Skip to content

Commit 78acf47

Browse files
author
Cantor Chron
committed
Change Proto signature.
1 parent 4c4681b commit 78acf47

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/main/scala/scala/reactive/Proto.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object Proto {
6262
* @param params parameters for instantiating the prototype
6363
* @return a new prototype of an isolate of type `T` with the specified parameters
6464
*/
65-
def apply[I <: Iso[_]](clazz: Class[I], params: Any*) = new Proto[I](clazz, params)
65+
def apply[I <: Iso[_]: ClassTag](params: Any*) = new Proto[I](implicitly[ClassTag[I]].erasure.asInstanceOf[Class[I]], params)
6666

6767
}
6868

src/test/scala/scala/reactive/test/isolate/IsolateSpec.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ trait IsolateSpec extends FlatSpec with ShouldMatchers {
129129
val sv = new SyncVar[String]
130130

131131
val emitter = new Reactive.Emitter[String]
132-
val proto = Proto(classOf[OneIso], sv)
132+
val proto = Proto[OneIso](sv)
133133
val c = isoSystem.isolate(proto).attach(emitter).seal()
134134
emitter += "test event"
135135
emitter.close()
@@ -141,7 +141,7 @@ trait IsolateSpec extends FlatSpec with ShouldMatchers {
141141
val sv = new SyncVar[List[Int]]
142142

143143
val emitter = new Reactive.Emitter[Int]
144-
val proto = Proto(classOf[ManyIso], many, sv)
144+
val proto = Proto[ManyIso](many, sv)
145145
val c = isoSystem.isolate(proto).attach(emitter).seal()
146146
for (i <- 0 until many) emitter += i
147147
emitter.close()
@@ -160,7 +160,7 @@ trait IsolateSpec extends FlatSpec with ShouldMatchers {
160160

161161
val emitter = new Reactive.Emitter[Int]
162162

163-
val proto = Proto(classOf[SelfIso], sv)
163+
val proto = Proto[SelfIso](sv)
164164
val c = isoSystem.isolate(proto).attach(emitter).seal()
165165

166166
emitter += 7
@@ -174,7 +174,7 @@ trait IsolateSpec extends FlatSpec with ShouldMatchers {
174174

175175
val emitter = new Reactive.Emitter[Int]
176176

177-
val proto = Proto(classOf[CustomIso], sv).withEventQueue(EventQueue.DevNull.factory)
177+
val proto = Proto[CustomIso](sv).withEventQueue(EventQueue.DevNull.factory)
178178
val c = isoSystem.isolate(proto).attach(emitter).seal()
179179

180180
emitter += 7
@@ -186,7 +186,7 @@ trait IsolateSpec extends FlatSpec with ShouldMatchers {
186186
it should "close its reactives when it terminates" in {
187187
val sv = new SyncVar[Boolean]
188188

189-
val proto = Proto(classOf[AutoClosingIso], sv)
189+
val proto = Proto[AutoClosingIso](sv)
190190
val c = isoSystem.isolate(proto).seal()
191191

192192
sv.get should equal (true)
@@ -197,8 +197,8 @@ trait IsolateSpec extends FlatSpec with ShouldMatchers {
197197

198198
val emitter = new Reactive.Emitter[Channel[Int]]
199199

200-
val dc = isoSystem.isolate(Proto(classOf[DualChannelIso], sv))
201-
val mc = isoSystem.isolate(Proto(classOf[MasterIso], dc))
200+
val dc = isoSystem.isolate(Proto[DualChannelIso](sv))
201+
val mc = isoSystem.isolate(Proto[MasterIso](dc))
202202

203203
sv.get should equal (7)
204204

@@ -212,8 +212,8 @@ trait IsolateSpec extends FlatSpec with ShouldMatchers {
212212

213213
val emitter = new Reactive.Emitter[Channel[Int]]
214214

215-
val rc = isoSystem.isolate(Proto(classOf[RegChannelIso], sv))
216-
val lc = isoSystem.isolate(Proto(classOf[LookupIso]))
215+
val rc = isoSystem.isolate(Proto[RegChannelIso](sv))
216+
val lc = isoSystem.isolate(Proto[LookupIso])
217217

218218
sv.get should equal (7)
219219

@@ -227,9 +227,9 @@ trait IsolateSpec extends FlatSpec with ShouldMatchers {
227227

228228
val emitter = new Reactive.Emitter[Channel[Int]]
229229

230-
val lc = isoSystem.isolate(Proto(classOf[LookupIso]))
230+
val lc = isoSystem.isolate(Proto[LookupIso])
231231
Thread.sleep(100)
232-
val rc = isoSystem.isolate(Proto(classOf[RegChannelIso], sv))
232+
val rc = isoSystem.isolate(Proto[RegChannelIso](sv))
233233

234234
sv.get should equal (7)
235235

@@ -252,7 +252,7 @@ trait LooperIsolateSpec extends FlatSpec with ShouldMatchers {
252252

253253
println("looper -----------")
254254

255-
val proto = Proto(classOf[TestLooper], sv)
255+
val proto = Proto[TestLooper](sv)
256256
isoSystem.isolate(proto)
257257

258258
sv.get should equal (3)

0 commit comments

Comments
 (0)