Minor, improve test case for KT-1157

Multithreaded version was not working correctly and was throwing NPEs in the
log sometimes
This commit is contained in:
Alexander Udalov
2014-05-28 21:03:36 +04:00
parent 8a84d07645
commit 6210e45fbc
@@ -1,28 +1,17 @@
public object SomeClass { public object SomeClass {
var bug: Any = "" private val work = object : Runnable {
private val workerThread = object : Thread() {
override fun run() { override fun run() {
try { foo()
foo()
bug = "none"
}
catch(t: Throwable) {
bug = t
}
} }
} }
{ private fun foo(): Unit {
workerThread.start()
} }
private fun foo() : Unit { public fun run(): Unit = work.run()
}
} }
public fun box():String { fun box(): String {
if(SomeClass.bug is Throwable) SomeClass.run()
throw SomeClass.bug as Throwable
return "OK" return "OK"
} }