Skip to content

Fix the JSR223 script engine#608

Merged
opeongo merged 3 commits intobeanshell:masterfrom
opeongo:fix_jsr223
Jan 12, 2022
Merged

Fix the JSR223 script engine#608
opeongo merged 3 commits intobeanshell:masterfrom
opeongo:fix_jsr223

Conversation

@opeongo
Copy link
Contributor

@opeongo opeongo commented May 28, 2021

Fix the JSR223 script engine plugin so update variables in the same scope that they are found in. The previous version would always set variables in the ENGINE_SCOPE, thus causing global scope variables to be shadowed.

Add tests for correctness.

This PR provides a fix for issue #607.

…cope that they are found in. The previous version would always set variables in the ENGINE_SCOPE, thus causing global scope variables to be shadowed.

Add tests for correctness.
@opeongo opeongo merged commit f0196a3 into beanshell:master Jan 12, 2022
int scope = context.getAttributesScope(key);
if (scope<0)
scope = ENGINE_SCOPE;
Object oldValue = context.getAttribute(key);
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this still have the scope, we know now where to look for it?

Object oldValue = context.getAttribute(key, scope);

pgiffuni pushed a commit to pgiffuni/beanshell that referenced this pull request Jan 8, 2024
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

Successfully merging this pull request may close these issues.

2 participants