Add test for asynchronous class initialisation from asynchronous constructor.

(cherry picked from commit 34961e4)
This commit is contained in:
Davin McCall 2017-02-21 19:04:45 +03:00 committed by Alexey Andreev
parent 891e3b8ea9
commit 651532c203

View File

@ -160,6 +160,13 @@ public class VMTest {
assertEquals("ok", AsyncClinitClass.state);
}
@Test
public void asyncClinitInstance() {
AsyncClinitClass acl = new AsyncClinitClass();
assertEquals("ok", AsyncClinitClass.state);
assertEquals("ok", acl.instanceState);
}
@Test
@SkipJVM
public void loopAndExceptionPhi() {
@ -218,6 +225,7 @@ public class VMTest {
private static class AsyncClinitClass {
static String state = "";
String instanceState = "";
static {
initCount++;
@ -236,6 +244,16 @@ public class VMTest {
public static String bar() {
return "bar";
}
public AsyncClinitClass() {
instanceState += "ok";
try {
Thread.sleep(1);
}
catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
}
}
private void throwException() {