leaningtech / cheerpj-meta

Run Java 8 applications, libraries, applets, Java Web Start, and Oracle Forms on the web without legacy plugins.
https://labs.leaningtech.com/cheerpj
445 stars 21 forks source link

Math.hypot is missing an implementation #124

Closed aiden-w-135752345 closed 3 years ago

aiden-w-135752345 commented 3 years ago
Run main for Main
rt.jar.js:387 Uncaught (in promise) ReferenceError: _m4Vaerq8cyuZMath5hypotE54 is not defined
    at _m4VZ4Math5hypotE59 (rt.jar.js:387)
    at _d4_YMain4mainE1 (eval at <anonymous> (eval at buildContinuations (loader.js:118)), <anonymous>:1:377)
    at Object.func (loader.js:578)
    at runContinuationStack (loader.js:390)
    at cheerpjSchedule (loader.js:1090)
    at cheerpjRunStaticMethod (loader.js:584)
    at loader.js:2291

the implementation of Math.hypot (_m4Vaerq8cyuZMath5hypotE54) is missing. looking at rt.jar.js, it looks like the next couple of math functions (expm1 and log1p) also are missing their implementations (_m4Vaerq8cyuZMath5expm1E55 and _m4Vaerq8cyuZMath5log1pE56).

I found this bug in a bigger project, but this is a test that reproduces it test files Main.jar.zip Java:

class Main {
    public static void main(String[] args) {
        double hypot = Math.hypot(1.5, 3.0);
    }
}

HTML

<script src="https://cjrtnc.leaningtech.com/latest/loader.js"></script>
<body><script>
    cheerpjInit().then(v=>cheerpjRunMain("Main","Main.jar"));
</script></body>
marsicplusplus commented 3 years ago

Hi @aiden-w-135752345,

You will find these functions implemented in this runtime https://cjrtnc.leaningtech.com/20210409/loader.js

Thanks for letting us know of those missing functionalities.

Best, Lorenzo