11/*
2- * Copyright 2015 DiffPlug
2+ * Copyright (C) 2015-2023 DiffPlug
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
66 * You may obtain a copy of the License at
77 *
8- * http ://www.apache.org/licenses/LICENSE-2.0
8+ * https ://www.apache.org/licenses/LICENSE-2.0
99 *
1010 * Unless required by applicable law or agreed to in writing, software
1111 * distributed under the License is distributed on an "AS IS" BASIS,
1515 */
1616package com .diffplug .jscriptbox .javascript ;
1717
18+ import com .diffplug .jscriptbox .Language ;
1819import java .util .Arrays ;
1920import java .util .HashSet ;
2021import java .util .Set ;
21-
2222import javax .script .ScriptContext ;
2323import javax .script .ScriptEngine ;
2424import javax .script .ScriptEngineManager ;
2525
26- import com .diffplug .jscriptbox .Language ;
27-
2826public class Nashorn {
2927 /**
3028 * Language implementation for javascript using the nashorn engine.
@@ -39,7 +37,7 @@ public static Language language() {
3937 /** Language implementation for javascript using the given policy for resolving any potential conflicts with reserved keywords. */
4038 public static Language language (OnReservedKeyword policy ) {
4139 return map -> {
42- ScriptEngine jsEngine = new ScriptEngineManager ().getEngineByName ("nashorn" );
40+ ScriptEngine jsEngine = new ScriptEngineManager (Nashorn . class . getClassLoader () ).getEngineByName ("nashorn" );
4341 ScriptContext context = jsEngine .getContext ();
4442
4543 String mapName = "nashornScriptBoxMap" ;
0 commit comments