On Sat, 27 Mar 2021 15:19:37 GMT, Attila Szegedi <att...@openjdk.org> wrote:
> 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. src/java.scripting/share/classes/javax/script/ScriptEngineManager.java line 215: > 213: } > 214: > 215: private ScriptEngine getEngineBy(String selector, Map<String, > ScriptEngineFactory> associations, Function<ScriptEngineFactory, > List<String>> valuesFn) { No objection to do some modernization of this code but probably best to avoid introducing overly long lines as it is impossible to see the changes with side-by-side diffs. ------------- PR: https://git.openjdk.java.net/jdk/pull/3229