Skip to content
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

Incompatibility issue with Oracle JDK 9 and 17 #49

Open
philiptzou opened this issue Jul 18, 2022 · 1 comment
Open

Incompatibility issue with Oracle JDK 9 and 17 #49

philiptzou opened this issue Jul 18, 2022 · 1 comment

Comments

@philiptzou
Copy link

Greetings! I am trying to develop a JWebAssembly project but encountered difficulties when I just tried to build WASM for a simple @Export:

https://github.com/hivdb/asiface/blob/41190e253010c445d57a5d928c62c530091e8143/asiwasm/src/main/java/edu/stanford/hivdb/asiwasm/Entrypoint.java#L8-L12

At the first I used Oracle JDK 17.0.1. The error was "WASM compile failed with: Abstract or native method can not be used: java/lang/ref/Reference.refersTo0(Ljava/lang/Object;)Z". After I read the discussion from #40, I switched to Oracle JDK 9.0.1. The error was changed to "WASM compile failed with: Abstract or native method can not be used: java/lang/StringCoding.err(Ljava/lang/String;)V".

Eventually I realized that the project is tested using OpenJDK 8 so I switched again. This time I can successfully compile the WASM binary.

You can find the corresponding build.gradle and source code here: https://github.com/hivdb/asiface/tree/41190e253010c445d57a5d928c62c530091e8143/asiwasm.

@Horcrux7
Copy link
Member

I does understand that you does not want use an old JDK for a new project. But that's not on the agenda for now. First the bugs in the core must be fixed. Since Java 9 there many more magic in the Java VM.

Any help and contribution are welcome.

  • If you does not want return a Java String then you should not declare a parameter of type String for an @export method. Use Object and convert it with JSObject.toJavaString( str );
  • The error message is outdated. This means you have an old snapshot of the compiler.
  • With properties[ 'IgnoreNative' ] = true you can convert this compiler errors into a runtime error for the case that it is in a unused else case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants