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

FXMLLoader: exception when using fully qualified names as nested elements

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 7u40, 8
    • javafx
    • None

      Consider following example:

      == Test classes that extend from javafx.shape.Rectangle ==

      d.Rectangle
      F.Rectangle
      d.aRectangle

      == Test FXML ==

      <?xml version="1.0" encoding="utf-8"?>

      <?import javafx.scene.layout.VBox?>
      <!--imports are added here-->

      <VBox xmlns:fx="http://javafx.com/fxml">
        <children>
          <!--test objects are added here-->
        </children>
      </VBox>


      ====== TESTS ======

      test the above fxml with the following commands as children for the VBox

      1)
      <d.Rectangle/>
      works.

      <Rectangle/> with <?import d.Rectangle?>
      works.


      2)
      <F.Rectangle/>
      javafx.fxml.LoadException: F.Rectangle is not a valid type.
      at javafx.fxml.FXMLLoader.createElement(FXMLLoader.java:2415)

      <Rectangle/> with <?import F.Rectangle?>
      works.

      3)
      <d.aRectangle/>
      javafx.fxml.LoadException: d.aRectangle is not a valid property.
      at javafx.fxml.FXMLLoader.createElement(FXMLLoader.java:2391)

      <aRectangle/> with <?import d.aRectangle?>
      javafx.fxml.LoadException: java.lang.ClassNotFoundException
      at javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2489)

      == END TESTS ==

      those are tested with Java 7u40 and 8 EAP.

      The tested objects are valid definitions of classes in Java. Moreover, when obfuscating an application, it is common to fully use the capabilities of the java class definition to choose names for packages and classes that obfuscate the structure as much as possible, so we will likely get classes that have a fully qualified name like "com.mycompany.D.F.H.F.a" and so on.
      Note that this also breaks if the symbols are not ASCII characters.



            Unassigned Unassigned
            srheinnecjfx Sebastian Rheinnecker (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Imported: