teavm icon indicating copy to clipboard operation
teavm copied to clipboard

#451: add missing methods to java.util.Math (required by java.time)

Open hohwille opened this issue 4 years ago • 6 comments

add missing methods to Math required by java.time (for #451). As discussed in https://github.com/m-m-m/tvm/issues/2 I am creating a temporary external extension module for java.time support for TeaVM so I am not blocked with TeaVM. My plan is to do small PRs with changes in TeaVM that make sense, are consistent and can therefore (hopefully) be merged and included in upcoming releases. (I can not easily change existing T* classes from classlib outside TeaVM in my lib as the classloader order (that is kind of random) then decides whether the original class from TeaVM or my alternative implementation is used. Therefore existing classes like TMath should be extended directly in TeaVM project).

hohwille avatar Jan 26 '21 12:01 hohwille

Any feedback on this PR yet? Merging this would really help me to get out of the blockade I am currently facing with TeaVM. My dream would be that after merging this PR a new release of TeaVM gets released (ideally to maven central, but bintray would also help). Since more than one year I am unable to push out a working demo of https://github.com/m-m-m/ui-demo/ build with TeaVM. It works when I build TeaVM locally from this PR. Surely you can say "what the fuss" and "this is your problem and not ours" but it could also be a nice promotion for TeaVM to see great dreams and demos comming true with the help of TeaVM.

hohwille avatar Feb 02 '21 14:02 hohwille

For what purpose you need these methods?

konsoletyper avatar Feb 02 '21 15:02 konsoletyper

As described above for java.time support in the browser.

hohwille avatar Feb 03 '21 11:02 hohwille

I believe this PR is not necessary for your java.time implementation. AFAIR, you use threeten implementation which does not rely on java 8 method, instead it comes with Jdk8Methods class which contains implementation for these methods.

konsoletyper avatar Feb 08 '21 08:02 konsoletyper

Surely I can bypass Math in the T* classes emulating java.time. So if it is a problem for you to merge this I have to add more workarounds to make TeaVM compile my code...

hohwille avatar Feb 08 '21 22:02 hohwille

Actually, methods @hohwille provided are in JDK 8-9, so you can merge this PR as usual addition of missing methods.

Ihromant avatar Mar 07 '21 13:03 Ihromant

@konsoletyper consider reviewing and merging this PR.

Ihromant avatar Oct 13 '23 08:10 Ihromant

This PR lacks tests

konsoletyper avatar Oct 13 '23 08:10 konsoletyper