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

[TEST_BUG] Replace obsolete FXML tests that use Nashorn

    XMLWordPrintable

Details

    Description

      Two of the FXML unit tests use the Nashorn JavaScript engine to test the FXML scripting capability. Nashorn has been deprecated since JDK 11 and has been removed in JDK 15.

      When these tests are run with the default JDK 14, they pass, but produce a warning:

      test.javafx.fxml.FXMLLoader_ScriptTest > testScriptHandler STANDARD_ERROR
          Warning: Nashorn engine is planned to be removed from a future JDK release

      test.javafx.fxml.FXMLLoader_ScriptTest > testExternalScriptHandler STANDARD_ERROR
          Warning: Nashorn engine is planned to be removed from a future JDK release


      When running with JDK 15-ea these two tests fail (as expected, since Nashorn is gone).

      test.javafx.fxml.FXMLLoader_ScriptTest > testScriptHandler FAILED
          javafx.fxml.LoadException: Page language not specified.
          /C:/Users/kcr/javafx/jfx-kcr/jfx/rt/modules/javafx.fxml/build/resources/test/test/javafx/fxml/script_handler.fxml:35
              at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
              at javafx.fxml/javafx.fxml.FXMLLoader$ScriptElement.processCharacters(FXMLLoader.java:1604)
              at javafx.fxml/javafx.fxml.FXMLLoader.processCharacters(FXMLLoader.java:2855)
              at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2566)
              at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2470)
              at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2439)
              at test.javafx.fxml.FXMLLoader_ScriptTest.testScriptHandler(FXMLLoader_ScriptTest.java:134)

      test.javafx.fxml.FXMLLoader_ScriptTest > testExternalScriptHandler FAILED
          javafx.fxml.LoadException: Unable to locate scripting engine for extension js.
          /C:/Users/kcr/javafx/jfx-kcr/jfx/rt/modules/javafx.fxml/build/resources/test/test/javafx/fxml/script_handler_external.fxml:31
              at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
              at javafx.fxml/javafx.fxml.FXMLLoader$ScriptElement.processStartElement(FXMLLoader.java:1544)
              at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2726)
              at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2556)
              at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2470)
              at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2439)
              at test.javafx.fxml.FXMLLoader_ScriptTest.testExternalScriptHandler(FXMLLoader_ScriptTest.java:147)


      We should remove these two tests and replace them with a different (custom) javax.script implementation. See the tests added for JDK-8234959 for an example of how this might be done.

      Attachments

        Issue Links

          Activity

            People

              aghaisas Ajit Ghaisas
              kcr Kevin Rushforth
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: