You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unclear what you want. You can't use it from other modules. It would only hidden, dead code. If you want export some methods then you must annotate with the annotation @export. All methods with this annotation will also be compiled.
What I am doing now is compiling the source code of an existing jar package. Due to the large size of the code, I cannot annotate it with @export one by one. The reason for compiling the jar package is to use the jar package as a module of wasm to reduce the size of the java application code.Looking forward to your reply.
I just want to convert a jar package source code to wasm, any suggestions? Even though I use the export annotation to export the methods I need one by one, the exported methods must also be static methods, so I have to change a lot of non-static methods to static methods, which is not feasible.
Add an extra class in which you define the interface methods that you want use from JavaScript. This methods call your library methods.
But if you have not write the library for the WASM target then there are only a low chance that it will compile. Many API like the file, network, reflection API can't compile to WASM.
Activity
Horcrux7 commentedon Oct 8, 2023
Why you want compile unused classes? This is not possible yet.
wangshuli0315 commentedon Oct 9, 2023
I need to export some classes and methods for other modules to use, any suggestions?
Horcrux7 commentedon Oct 9, 2023
I am unclear what you want. You can't use it from other modules. It would only hidden, dead code. If you want export some methods then you must annotate with the annotation @export. All methods with this annotation will also be compiled.
wangshuli0315 commentedon Oct 10, 2023
What I am doing now is compiling the source code of an existing jar package. Due to the large size of the code, I cannot annotate it with @export one by one. The reason for compiling the jar package is to use the jar package as a module of wasm to reduce the size of the java application code.Looking forward to your reply.
Horcrux7 commentedon Oct 10, 2023
If you want use it as module then you must declare the interface that you want use. How do you want use the module without any usable methods?
wangshuli0315 commentedon Oct 16, 2023
I just want to convert a jar package source code to wasm, any suggestions? Even though I use the export annotation to export the methods I need one by one, the exported methods must also be static methods, so I have to change a lot of non-static methods to static methods, which is not feasible.
Horcrux7 commentedon Oct 21, 2023
Add an extra class in which you define the interface methods that you want use from JavaScript. This methods call your library methods.
But if you have not write the library for the WASM target then there are only a low chance that it will compile. Many API like the file, network, reflection API can't compile to WASM.