Add test for asynchronous class initialisation from asynchronous constructor.
@@ -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() {
