1
1
/*
2
- * Copyright 2015 DiffPlug
2
+ * Copyright (C) 2015-2023 DiffPlug
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
6
6
* You may obtain a copy of the License at
7
7
*
8
- * http ://www.apache.org/licenses/LICENSE-2.0
8
+ * https ://www.apache.org/licenses/LICENSE-2.0
9
9
*
10
10
* Unless required by applicable law or agreed to in writing, software
11
11
* distributed under the License is distributed on an "AS IS" BASIS,
15
15
*/
16
16
package com .diffplug .jscriptbox .javascript ;
17
17
18
+ import com .diffplug .jscriptbox .Language ;
18
19
import java .util .Arrays ;
19
20
import java .util .HashSet ;
20
21
import java .util .Set ;
21
-
22
22
import javax .script .ScriptContext ;
23
23
import javax .script .ScriptEngine ;
24
24
import javax .script .ScriptEngineManager ;
25
25
26
- import com .diffplug .jscriptbox .Language ;
27
-
28
26
public class Nashorn {
29
27
/**
30
28
* Language implementation for javascript using the nashorn engine.
@@ -39,7 +37,7 @@ public static Language language() {
39
37
/** Language implementation for javascript using the given policy for resolving any potential conflicts with reserved keywords. */
40
38
public static Language language (OnReservedKeyword policy ) {
41
39
return map -> {
42
- ScriptEngine jsEngine = new ScriptEngineManager ().getEngineByName ("nashorn" );
40
+ ScriptEngine jsEngine = new ScriptEngineManager (Nashorn . class . getClassLoader () ).getEngineByName ("nashorn" );
43
41
ScriptContext context = jsEngine .getContext ();
44
42
45
43
String mapName = "nashornScriptBoxMap" ;
0 commit comments