JaroslavTulach commented on a change in pull request #1011: Enhanced wrapper 
for Scripting API 
URL: 
https://github.com/apache/incubator-netbeans/pull/1011#discussion_r249013895
 
 

 ##########
 File path: 
platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java
 ##########
 @@ -336,37 +328,25 @@ private PacScriptEngine getScriptEngine(String 
pacSource) throws PacParsingExcep
 
             // Do some minimal testing of the validity of the PAC Script.
             final PacJsEntryFunction jsMainFunction;
-            if (nashornJava8u40Available) {
-                jsMainFunction = testScriptEngine(engine, true);
-            } else {
-                jsMainFunction = testScriptEngine(engine, false);
-            }
+            jsMainFunction = testScriptEngine(engine, false);
             
             return new PacScriptEngine(engine, jsMainFunction);
         } catch (ScriptException ex) {
             throw new  PacParsingException(ex);
         }
     }
     
-    private boolean getNashornJava8u40Available() {
-        try {
-            Class<?> klass = 
Class.forName("jdk.nashorn.api.scripting.NashornScriptEngineFactory");
-        } catch (ClassNotFoundException ex) {
-            return false;
-        }
-        return true;
-    }
-    
-    private ScriptEngine getNashornJSScriptEngine() {
-        NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        return factory.getScriptEngine(new ClassFilterPacHelpers());
-    }
-    
     private ScriptEngine getGenericJSScriptEngine() {
-        // The result of the statements below may be Rhino, but more likely
-        // - since Java 8 - it will be a Nashorn engine.
-        ScriptEngineManager factory = new ScriptEngineManager();
-        return factory.getEngineByName("JavaScript");
+        ScriptEngineManager manager = Scripting.createManager();
 
 Review comment:
   Using engine from `libs.graaljs` module, if it is available. Otherwise 
falling back to default JavaScript engine. No special treatment needed, as all 
Java objects are wrapped into appropriate JavaScript function closures. CCing 
@lbruun 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to