beanshell / beanshell

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

Rewrite Modifiers to be JAVA compatible #691

Closed nickl- closed 1 year ago

nickl- commented 1 year ago

A drop in replacement still serves the same purpose, to capture modifier names through the parser but instead of storing the text in a collection the modifiers are translahe to their int values and stored as a distinct bit definition compatible with Modifier and ASM constants. Includes complete validation of applicable modifiers as defined by JAVA Modifier and includes additional contexts for INTERFARCE, PARAMETER, and CONSTRUCTOR, which was previously missing. Dropped duplicate modifier checks because the math will automatically roll duplicates in. Can process multiple modifier definitions and is capable of context change. Retained the hasModifier functionality can use with both name and bit identifier and will work with Modifier to decode the values as well.

Reflect coverage improvements

Allow scripted objects overwrite toString. Fixes #371 adding a toString method to a scripted object will now be called instead of This.toString.

Conformance fix on Entry lists. All other properties on BeanShell will return void if not found but Entry lists raises a No such property error.

Resolve NPE on ParseException.

codecov[bot] commented 1 year ago

Codecov Report

Merging #691 (294bf66) into master (f3e57b0) will increase coverage by 0.53%. The diff coverage is 97.65%.

@@             Coverage Diff              @@
##             master     #691      +/-   ##
============================================
+ Coverage     72.18%   72.72%   +0.53%     
- Complexity     2879     2916      +37     
============================================
  Files           107      107              
  Lines          9215     9254      +39     
  Branches       1805     1810       +5     
============================================
+ Hits           6652     6730      +78     
+ Misses         2169     2152      -17     
+ Partials        394      372      -22     
Flag Coverage Δ
unittests 72.72% <97.65%> (+0.53%) :arrow_up:

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

Impacted Files Coverage Δ
src/main/java/bsh/This.java 80.32% <85.71%> (-0.52%) :arrow_down:
src/main/java/bsh/ParseException.java 46.96% <90.00%> (-0.73%) :arrow_down:
src/main/java/bsh/BSHClassDeclaration.java 97.05% <100.00%> (+0.18%) :arrow_up:
src/main/java/bsh/BSHEnhancedForStatement.java 83.01% <100.00%> (ø)
src/main/java/bsh/BSHFormalParameters.java 94.73% <100.00%> (ø)
src/main/java/bsh/BSHTryStatement.java 92.77% <100.00%> (ø)
src/main/java/bsh/ClassGeneratorUtil.java 89.17% <100.00%> (+0.42%) :arrow_up:
src/main/java/bsh/DelayedEvalBshMethod.java 61.97% <100.00%> (+0.54%) :arrow_up:
src/main/java/bsh/Modifiers.java 100.00% <100.00%> (+2.32%) :arrow_up:
src/main/java/bsh/Reflect.java 89.70% <100.00%> (+7.21%) :arrow_up:
... and 5 more

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