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

Remove Blockly as an option when GraalVM JavaScript add-on is installed #1169

Closed
rkoshak opened this issue Sep 27, 2021 · 2 comments
Closed
Assignees
Labels
enhancement New feature or request main ui Main UI

Comments

@rkoshak
Copy link

rkoshak commented Sep 27, 2021

The problem

The built in Nashorn JavaScript and GraalVM JavaScript add-on are not compatible. When the GraalVM add-on is installed, anything written in Nashorn will break. Since Blockly ends up resolving to Nashorn, that means anything written using Nashorn will also break.

Your suggestion

Somehow detect when the GraalVM add-on is installed and hide the option to use Blockly.

Additional information

A number of users, including highly advanced users with years of experience have run into this and related problems when the add-on is installed.

@rkoshak rkoshak added enhancement New feature or request main ui Main UI labels Sep 27, 2021
@ghys ghys self-assigned this Sep 29, 2021
ghys added a commit to ghys/openhab-webui that referenced this issue Sep 29, 2021
This prepends code that makes the `ctx`, `itemRegistry` & `events`
objects accessible when the scripts are run with GraalVM, as they
are when run with Nashorn.

Closes openhab#1169.

Signed-off-by: Yannick Schaus <[email protected]>
@ghys
Copy link
Member

ghys commented Sep 29, 2021

#1170 seems to make the Blockly code run in GraalVM, following my remark in openhab/openhab-core#2433 (comment).
This supposes the user has a working GraalVM (in particular, this supposes a manual creation of the conf/automation/lib/javascript/personal directory for now, see openhab/openhab-addons#11219).

Then the following works:

image

image

But note the "create text with" blocks that were not required in Nashorn (GraalVM is more strict with method resolution and will only accept java.lang.String in these cases, perhaps adding a few .toString() for these blocks wouldn't hurt).

@rkoshak
Copy link
Author

rkoshak commented Dec 12, 2022

I think this issue as written can be closed. With the introduction of the new MIMEType for JS Scripting, the two can happily live side-byy-side.

@rkoshak rkoshak closed this as completed Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request main ui Main UI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants