Add test for asynchronous class initialisation from asynchronous constructor.

This commit is contained in:
Davin McCall 2017-02-21 16:04:45 +00:00
parent 230ebaf420
commit 34961e4d9d

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() {