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:
@@ -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"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user