RFR: 8264326: Modernize javax.script.ScriptEngineManager and related classes' implementation

Attila Szegedi attila at openjdk.java.net
Sat Mar 27 15:34:32 UTC 2021


I noticed that `javax.script.ScriptEngineManager` `getEngineByXxx` methods had a lot of code duplication among themselves, and even within each method. I refactored them into a modern unified implementation. While there I also took the opportunity to introduce `Objects.requireNonNull` in place of null checks followed by NPE throws, mark private fields final where possible, use lambdas for `doPrivileged` block, use `List.of` and `List.copyOf` where possible, and generally sanitize/deduplicate.

-------------

Commit messages:
 - Tidy
 - require non null in SimpleBindings
 - Simplify SimpleScriptContext.scopes
 - Mark fields final where possible
 - Deduplicate registerEngineXxx methods
 - Misc tidying
 - Deduplicate exception reporting
 - Lambdify
 - Mark fields as final; eliminate now unnecessary init() method.
 - Deduplicate engine creation and setup code
 - ... and 4 more: https://git.openjdk.java.net/jdk/compare/a209ed01...f378f350

Changes: https://git.openjdk.java.net/jdk/pull/3229/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3229&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264326
  Stats: 225 lines in 5 files changed: 38 ins; 142 del; 45 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3229.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3229/head:pull/3229

PR: https://git.openjdk.java.net/jdk/pull/3229


More information about the core-libs-dev mailing list