Vertispan / j2clmavenplugin

Maven plugin to launch new J2CL compilation
https://vertispan.github.io/j2clmavenplugin/
Apache License 2.0
53 stars 26 forks source link

Assert.fail is unstable #190

Closed treblereel closed 1 year ago

treblereel commented 1 year ago

j2cl-m-p: 0.20 env: osx java: OpenJDK Runtime Environment Zulu11.56+19-CA (build 11.0.15+10-LTS)

Running the same test leads to positive or negative results.

@J2clTestInput(TheTest.class)
public class TheTest extends TestCase {

    @Test
    public void testException() {
        int a = new Random().nextInt();
        int b = a * 2;

        try {
            exception(a,b);
            fail("Should throw Exception");
        } catch (MyException e) {
            DomGlobal.console.log("Exception: " + e.getMessage());
        }
    }

    public void exception(int a, int b) {
        if (b > a) {
            throw new MyException();
        }
    }
}

build.log

reproducer: https://github.com/treblereel/j2cl-tests/tree/bug

How to produce it: 1) clone repo and use branch 'bug' 2) run mvn clean j2cl:test 3) run mvn j2cl:test several times