diff --git a/compiler/testData/codegen/java8/box/async.kt b/compiler/testData/codegen/java8/box/async.kt index d791792e1c1..a857832feef 100644 --- a/compiler/testData/codegen/java8/box/async.kt +++ b/compiler/testData/codegen/java8/box/async.kt @@ -12,10 +12,8 @@ fun foobar(x: String, y: String) = x + y fun box(): String { var result = "" fun log(x: String) { - synchronized(result) { - if (result.isNotEmpty()) result += "\n" - result += x - } + if (result.isNotEmpty()) result += "\n" + result += x } val future = async { @@ -29,14 +27,7 @@ fun box(): String { future.whenComplete { value, t -> log("completed with '$value'") - } - - future.join() - java.lang.Thread.sleep(1000) - - val readResult = synchronized(result) { - result - } + }.join() val expectedResult = """ @@ -45,7 +36,7 @@ fun box(): String { |got '123 bar with foo' after 'foo' |completed with '123 bar with foo'""".trimMargin().trim('\n', ' ') - if (expectedResult != readResult) return readResult + if (expectedResult != result) return result return "OK" } diff --git a/compiler/testData/codegen/java8/box/asyncException.kt b/compiler/testData/codegen/java8/box/asyncException.kt index 2083d7f9397..aabc3232801 100644 --- a/compiler/testData/codegen/java8/box/asyncException.kt +++ b/compiler/testData/codegen/java8/box/asyncException.kt @@ -23,8 +23,6 @@ fun box(): String { if (future.get() != "56") return "fail: ${future.get()}" - java.lang.Thread.sleep(1000) - if (result != "OK") return "fail notOk" val future2 = async() {