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

Fix variable binding in ScriptTransformationService #3464

Merged
merged 1 commit into from
Mar 19, 2023

Conversation

jimtng
Copy link
Contributor

@jimtng jimtng commented Mar 18, 2023

...by setting all attributes before compiling.

In JRuby, because an identifier can either be a variable or a method call, the compiler needs to know variables ahead of time in order to recognise them as variables. Because scripts are compiled first, and then the attributes set, this information is missing, therefore a "hack" was needed in jruby transformations to give the compiler the needed hint.

This PR simply reverses the order so that attributes were set before compiling, so the hack in jruby will no longer be needed. I have tested this on my jrubyscripting addon installation.

For more info, see jruby/jruby#5876

by setting all attributes before compiling

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
@jimtng jimtng requested a review from a team as a code owner March 18, 2023 12:59
@J-N-K J-N-K added bug An unexpected problem or unintended behavior of the Core rebuild Triggers the Jenkins PR build and removed rebuild Triggers the Jenkins PR build labels Mar 18, 2023
Copy link
Member

@J-N-K J-N-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@J-N-K J-N-K merged commit cb38d19 into openhab:main Mar 19, 2023
@J-N-K J-N-K added this to the 4.0 milestone Mar 19, 2023
@jimtng
Copy link
Contributor Author

jimtng commented Mar 19, 2023

Thanks for merging! @openhab/core-maintainers could this please be applied to 3.4.x too? patch tag I think?

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/jruby-in-oh4/145180/8

ccutrer pushed a commit to openhab/openhab-jruby that referenced this pull request Mar 21, 2023
and remove the need for giving input variable hints for the compiler

openhab/openhab-core#3464
If this doesn't propagate to openhab 3.4.x, we need to add a note about
it.

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 12, 2023
by setting all attributes before compiling

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
GitOrigin-RevId: cb38d19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants