Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8326588

Setting of nashorn.args has changed (and does not work)

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      Customer reported (https://shibboleth.atlassian.net/browse/JSCRIPTING-19) that whereas in JDK11 the following worked and supressed deprecations warnings

      -Dnashorn.args=--no-deprecation-warning)

      In JDK17 with nashorn-core-15.4.1 (inserted onto the classpath) this doesn't work. Instead the scripting engine SILENTLY fails to load.

      Spelunking the code shows me that the property setting paradigm has changed to

      -Dnashorn.args=-D--no-deprecation-warning

      or even

      -D--no-deprecation-warning

      this appears to make the property available to the Nashorn scripting engine. Customer additionally reports that even with this set the warnings are still emitted.

      1) Why does the engine silently fail to load (rather than throw an exception or print a log message)?
      2) Is this change documented (so I can reflect it in our documentation)
      3) Why, even with that parameterization, does the engine still warn?
      [2024-02-22 08:29:26] [info] Warning: Nashorn engine is planned to be removed from a future JDK release

      REGRESSION : Last worked in version 11.0.22

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) add nashorn to you class path
      2) Run this code segment

      System.setProperty("nashorn.args","-no-deprecation-warning");
      final ScriptEngineManager engineManager = new ScriptEngineManager();
      final ScriptEngine scriptEngine = engineManager.getEngineByName("javascript");
      assert scriptEngine != null;
      nothing happens because the engine fails to load


      ---------- BEGIN SOURCE ----------
      https://git.shibboleth.net/view/?p=java-idp-plugin-scripting.git;a=blob;f=nashorn-jdk-impl/src/test/java/net/shibboleth/idp/plugin/scripting/nashorn/EngineTests.java;h=abab340b30e211d7ec9e026a4f99704a781ba4a4;hb=HEAD

      Has the test but with the problem fixed.
      ---------- END SOURCE ----------

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: