beanshell / beanshell

Beanshell scripting language
Apache License 2.0
815 stars 183 forks source link

Implementation for BeanShell 2 compatibility mode (issue #727) #728

Closed opeongo closed 1 year ago

opeongo commented 1 year ago

Implement a mode to allow backward compatibility with BeanShell 2 scripts that use scoping rules that declare loosely typed variables in the outer (enclosing) scope (#727).

Although this touches a lot of files, it is actually not very invasive. The active change is a few lines in NameSpace.java. The bulk of the changes are to change the implementation of the strictJava flag from a boolean to an int flag container such as argument passing and value testing.

codecov[bot] commented 1 year ago

Codecov Report

Merging #728 (5ae59f4) into master (47cbe83) will decrease coverage by 0.08%. The diff coverage is 82.60%.

@@             Coverage Diff              @@
##             master     #728      +/-   ##
============================================
- Coverage     74.16%   74.09%   -0.08%     
- Complexity     3039     3042       +3     
============================================
  Files           108      108              
  Lines          9357     9373      +16     
  Branches       1857     1860       +3     
============================================
+ Hits           6940     6945       +5     
- Misses         2074     2082       +8     
- Partials        343      346       +3     
Flag Coverage Δ
unittests 74.09% <82.60%> (-0.08%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main/java/bsh/Interpreter.java 83.83% <59.09%> (-1.37%) :arrow_down:
src/main/java/bsh/NameSpace.java 87.47% <82.35%> (-0.40%) :arrow_down:
src/main/java/bsh/BSHAssignment.java 90.62% <100.00%> (ø)
src/main/java/bsh/BSHUnaryExpression.java 100.00% <100.00%> (ø)
src/main/java/bsh/BlockNameSpace.java 97.14% <100.00%> (ø)
src/main/java/bsh/BshMethod.java 76.73% <100.00%> (ø)
src/main/java/bsh/ClassGeneratorUtil.java 89.59% <100.00%> (ø)
src/main/java/bsh/ExternalNameSpace.java 60.52% <100.00%> (ø)
src/main/java/bsh/LHS.java 74.35% <100.00%> (ø)
src/main/java/bsh/Name.java 86.76% <100.00%> (ø)
... and 2 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

sonatype-lift[bot] commented 1 year ago

🛠 Lift Auto-fix

Some of the Lift findings in this PR can be automatically fixed. You can download and apply these changes in your local project directory of your branch to review the suggestions before committing.[^1]

# Download the patch
curl https://lift.sonatype.com/api/patch/github.com/beanshell/beanshell/728.diff -o lift-autofixes.diff

# Apply the patch with git
git apply lift-autofixes.diff

# Review the changes
git diff

Want it all in a single command? Open a terminal in your project's directory and copy and paste the following command:

curl https://lift.sonatype.com/api/patch/github.com/beanshell/beanshell/728.diff | git apply

Once you're satisfied, commit and push your changes in your project. [^1]: You can preview the patch by opening the patch URL in the browser.

nickl- commented 1 year ago

Closed as per #727