New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Feature: limiting shared code #449
Comments
You can create |
Aha, cool. So it seems you already have some kind of GWT super-sourcing equivalent in TeaVM. |
Is the same approach also working to provide client implementations for non JDK internal code? |
No, things are little bit complex. The rules are provided here, you can add you own |
Does that mean if I add such |
What do you mean?
Which types you want to override? |
Ok let me give an example: |
I see. You can change your code to not instantiate/access Class99 directly, but introduce Interface99, with two implementations: Class99JVM and Class99TeaVM, both in different modules. To instantiate Interface99 you should use ServiceLoader, and corresponding JVM-specific and TeaVM-specific module should contain correspoinding |
A cool feature of GWT was that I could "emulate" shared code that was written for the server in the client with a "limited" implementation. The actual way to do this in GWT via super-sourcing was maybe a little odd but I wanted to make my code work in teavm und stubled over this problem. First of all I am impressed what is already working and at which speed - so thanks for all your hard work.
When using by Bean class in TeaVM, I got this error:
Code is open-source, so you can find it here:
https://github.com/m-m-m/bean/blob/master/core/src/main/java/io/github/mmm/bean/AbstractBean.java#L54
Of course, I can try to rewrite my code and change the design so that I use a protected method providing the map implementation that gets overridden for the backend. However, I am sure this is not the last time I hit some problem like this. Also the problem could occur with external code that can not be tweaked.
Is there a solution in TeaVM for this problem available or planned?
Sidenote: Also I am thinking about the approach of
candies
in https://dragome.com where one can provide a complete JavaScript version for a library (JAR). Allowing to implement an optimized JavaScript/WASM would also be a killer feature to emulate the beans and properties I created in my OSS project natively in the browser to even more boost performance as JavaScript already has properties with value change listeners and this does not need to be emulated via Java compiled with teavm.The text was updated successfully, but these errors were encountered: