Skip to content

Commit

Permalink
Remove unnecessary "immutableList" method
Browse files Browse the repository at this point in the history
  • Loading branch information
szegedi committed Feb 13, 2021
1 parent 8545f5f commit 7fded73
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,32 +254,29 @@ private static void checkConfigPermission() {
private static final List<String> extensions;

static {
names = immutableList(
names = List.of(
"nashorn", "Nashorn",
"js", "JS",
"JavaScript", "javascript",
"ECMAScript", "ecmascript"
);

mimeTypes = immutableList(
mimeTypes = List.of(
"application/javascript",
"application/ecmascript",
"text/javascript",
"text/ecmascript"
);

extensions = immutableList("js");
}

private static List<String> immutableList(final String... elements) {
return List.of(elements);
extensions = List.of("js");
}

private static ClassLoader getAppClassLoader() {
// Revisit: script engine implementation needs the capability to
// find the class loader of the context in which the script engine
// is running so that classes will be found and loaded properly
final ClassLoader ccl = Thread.currentThread().getContextClassLoader();
return (ccl == null)? NashornScriptEngineFactory.class.getClassLoader() : ccl;
return Objects.requireNonNullElseGet(
Thread.currentThread().getContextClassLoader(),
NashornScriptEngineFactory.class::getClassLoader);
}
}

0 comments on commit 7fded73

Please sign in to comment.