mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Add test for asynchronous class initialisation from asynchronous constructor.
(cherry picked from commit 34961e4)
This commit is contained in:
parent
891e3b8ea9
commit
651532c203
|
@ -160,6 +160,13 @@ public class VMTest {
|
||||||
assertEquals("ok", AsyncClinitClass.state);
|
assertEquals("ok", AsyncClinitClass.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void asyncClinitInstance() {
|
||||||
|
AsyncClinitClass acl = new AsyncClinitClass();
|
||||||
|
assertEquals("ok", AsyncClinitClass.state);
|
||||||
|
assertEquals("ok", acl.instanceState);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SkipJVM
|
@SkipJVM
|
||||||
public void loopAndExceptionPhi() {
|
public void loopAndExceptionPhi() {
|
||||||
|
@ -218,6 +225,7 @@ public class VMTest {
|
||||||
|
|
||||||
private static class AsyncClinitClass {
|
private static class AsyncClinitClass {
|
||||||
static String state = "";
|
static String state = "";
|
||||||
|
String instanceState = "";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
initCount++;
|
initCount++;
|
||||||
|
@ -236,6 +244,16 @@ public class VMTest {
|
||||||
public static String bar() {
|
public static String bar() {
|
||||||
return "bar";
|
return "bar";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AsyncClinitClass() {
|
||||||
|
instanceState += "ok";
|
||||||
|
try {
|
||||||
|
Thread.sleep(1);
|
||||||
|
}
|
||||||
|
catch (InterruptedException ie) {
|
||||||
|
throw new RuntimeException(ie);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void throwException() {
|
private void throwException() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user