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

Use Reflect.construct for calling JS constructors #673

Closed
borkdude opened this issue Jan 31, 2022 · 1 comment
Closed

Use Reflect.construct for calling JS constructors #673

borkdude opened this issue Jan 31, 2022 · 1 comment

Comments

@borkdude
Copy link
Collaborator

borkdude commented Jan 31, 2022

Another way doesn't work with Polyglot:

$ $GRAALVM_HOME/bin/node --jvm --polyglot $(which nbb)
user=> (def String (js/Java.type "java.lang.String"))
#'user/String
user=> (new String "foo")
"#error {:message \"JavaClass[java.lang.String] is not a function
user=> (js/Reflect.construct String #js ["foo"])
"foo"

See https://www.graalvm.org/22.0/reference-manual/js/JavaInteroperability/#constructing-java-objects

@borkdude
Copy link
Collaborator Author

/cc @littleli : found another problem with GraalVM polyglot

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

1 participant