I ran into some issues when compiling and running an existing program, I was able to reduce it to the following program:
public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
new Main().test();
}
private void test() {
System.out.println("HERE");
System.out.println("HERE");
}
}
If I compile and cheerpjfy this and run it in a browser (happens in both Firefox and Chrome), the dev tools break on an assertion error:
This all happens before the first print in the test method happens (likely happens during the invoke).
Steps To Reproduce
I downloaded a fresh copy of cheerpj_2.3 and compiled the entire program like this:
javac Main.java
jar cfe main.jar Main Main.class
./cheerpj_2.3/cheerpjfy.py main.jar
I used the following HTML skeleton:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CheerpJ test</title>
<script src="https://cjrtnc.leaningtech.com/2.3/loader.js"></script>
</head>
<body>
</body>
<script>
cheerpjInit();
cheerpjCreateDisplay(800,600);
// main.jar is in the same folder as html
cheerpjRunMain("Main", "/app/main.jar");
</script>
</html>
I ran into some issues when compiling and running an existing program, I was able to reduce it to the following program:
If I compile and cheerpjfy this and run it in a browser (happens in both Firefox and Chrome), the dev tools break on an assertion error:
Stack Trace:
If I let the program continue, it throws an uncaught exception:
This all happens before the first print in the
test
method happens (likely happens during the invoke).Steps To Reproduce
I downloaded a fresh copy of
cheerpj_2.3
and compiled the entire program like this:I used the following HTML skeleton:
Compiled files:
main.jar
(rename first): main.zipmain.jar.js
: main.jar.js.txtAdditional Context
The
Hello World
printing is not necessary for this crash, it is just here to show that the crash happens in the middle of the user program.The
test
method requires both print calls, otherwise no crash happens because thetest
method is inlined.This happens on Linux on both Firefox 109 and Chrome 109.0.5414.74
The java files were compiled with JDK17