A WIP for JDK-8238080 for review/discussion (Re: "Internal review ID 9063426: "FXMLLoader: if script engines implement javax.script.Compilabel compile scripts"
Rony G. Flatscher
Rony.Flatscher at wu.ac.at
Fri Feb 28 18:22:24 UTC 2020
Here is a WIP  implementation of . The WIP is based on , which is currently in review, and
has an appropriate test unit going with it as well, please review.
There should be no compatibility issue with this implementation.
Discussion: another solution could be to not compile by default. Rather compile, if some new
information is present with the FXML file which cannot possibly be present in existing FXML files.
In this scenario one possible and probably simple solution would be to only compile scripts if the
language process instruction (e.g. <?language rexx?>) contains an appropriate attribute with a value
indicating that compilation should be carried out (e.g.: compile="true"). This way only FXML with
PIs having this attribute set to true would be affected. If desired I could try to come up with a
respective solution as well.
 "Implementation and test unit": <https://github.com/openjdk/jfx/pull/129>
 "JDK-8238080 : FXMLLoader: if script engines implement javax.script.Compilable compile scripts":
 "8234959: FXMLLoader does not populate ENGINE_SCOPE Bindings with FILENAME and ARGV":
On 24.01.2020 16:26, Kevin Rushforth wrote:
> Thank you for filing this enhancement request. As an enhancement it should be discussed on this
> list before proceeding with a pull request (although a "WIP" or Draft PR can be used to illustrate
> the concept).
> For my part, this seems like a reasonable enhancement, as long as there are no compatibility
> issues, but it would be good to hear from application developers who heavily use FXML.
> -- Kevin
> On 1/24/2020 7:21 AM, Rony G. Flatscher wrote:
>> Just filed a RFE with the following information:
>> * Component:
>> o JavaFX
>> * Subcomponent:
>> o fxml: JavaFX FXML
>> * Synopsis:
>> o "FXMLLoader: if script engines implement javax.script.Compilabel compile scripts"
>> * Descriptions:
>> o "FXMLLoader is able to execute scripts in Java script languages (javax.script.ScriptEngine
>> implementations) if such a Java script language gets defined as the controller language in
>> the FXML file.
>> If a script engine implements the javax.script.Compilable interface, then such scripts
>> be compiled and the resulting javax.script.CompiledScript could be executed instead using
>> its eval() methods.
>> Evaluating the CompiledScript objects may help speed up the execution of script
>> especially for scripts defined for event attributes in FXML elements (e.g. like
>> which may be repetitevly invoked and evaluated."
>> * System /OS/Java Runtime Information:
>> o "All systems."
>> Received the internal review ID: "9063426"
More information about the openjfx-dev