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.
== 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.
- duplicates
-
JDK-8093509 FXMLLoader fails to load a type and throws ClassNotFoundException if the classname starts with a lowercase letter
-
- Closed
-
-
JDK-8125940 FXML: instance declaration isn't clear
-
- Closed
-