# HG changeset patch # User kcr # Date 1492473693 25200 # Mon Apr 17 17:01:33 2017 -0700 # Node ID 8c1f29882df19b1175305218b9c6de2bc7504d6f # Parent f0ffe260a77d03ac1d6a8fc7bdb73bde656f2d25 8178015: Clarify requirement for app modules to export/open packages to javafx modules Reviewed-by: diff --git a/modules/javafx.fxml/src/main/java/javafx/fxml/FXML.java b/modules/javafx.fxml/src/main/java/javafx/fxml/FXML.java --- a/modules/javafx.fxml/src/main/java/javafx/fxml/FXML.java +++ b/modules/javafx.fxml/src/main/java/javafx/fxml/FXML.java @@ -34,16 +34,16 @@ /** * Annotation that tags a field or method as accessible to markup. * If the object being annotated is in a named module then it must - * be reflectively accessible to the {@code javafx.fxml} module. + * be reflectively accessible by the {@code javafx.fxml} module. * An object is reflectively accessible if the module containing that - * object opens (see {@code Module.isOpen}) the containing package to the + * object {@link Module#isOpen(String,Module) opens} the containing package to the * {@code javafx.fxml} module, either in its {@link ModuleDescriptor} - * (e.g., in its module-info.class) or by calling {@code Module.addOpens}. + * (e.g., in its module-info.class) or by calling {@link Module#addOpens}. * An object is also reflectively accessible if it is declared as a public * member, is in a public class, and the module containing that class - * exports (see {@code Module.isExported(String,Module)}) - * the containing package to the {@code javafx.fxml} module. - * If the object is not reflectively accessible to the {@code javafx.fxml} + * {@link Module#isExported(String,Module) exports} + * the containing package to at least the {@code javafx.fxml} module. + * If the object is not reflectively accessible by the {@code javafx.fxml} * module, then the {@link FXMLLoader} will fail with an * {@code InaccessibleObjectException} when it attempts to modify the * annotated element. diff --git a/modules/javafx.graphics/src/main/java/javafx/application/Application.java b/modules/javafx.graphics/src/main/java/javafx/application/Application.java --- a/modules/javafx.graphics/src/main/java/javafx/application/Application.java +++ b/modules/javafx.graphics/src/main/java/javafx/application/Application.java @@ -25,8 +25,7 @@ package javafx.application; -import java.security.AccessController; -import java.security.PrivilegedAction; +import java.lang.module.ModuleDescriptor; import java.util.List; import java.util.Map; @@ -66,10 +65,8 @@ *

Note that the {@code start} method is abstract and must be overridden. * The {@code init} and {@code stop} methods have concrete implementations * that do nothing.

- *

The {@code Application} subclass must be declared public, must have a - * public no-argument constructor, and the - * containing package must be exported (see {@code Module.isExported(String,Module)}) - * to the {@code javafx.graphics} module.

+ *

The {@code Application} subclass must be declared public and must have a + * public no-argument constructor.

* *

Calling {@link Platform#exit} is the preferred way to explicitly terminate * a JavaFX Application. Directly calling {@link System#exit} is @@ -82,6 +79,24 @@ * {@link #stop} method returns or {@link System#exit} is called. *

* + *

Applications in a Module

+ *

+ * If the {@code Application} subclass is in a named module then that class + * must be accessible by the {@code javafx.graphics} module. This means that + * in addition to the class itself being public, the module must + * {@link Module#isExported(String,Module) export} the containing package to + * at least the {@code javafx.graphics} module, either in its + * {@link ModuleDescriptor} (e.g., in its module-info.class) or by calling + * {@link Module#addExports}. Alternatively, the module can + * {@link Module#isOpen(String,Module) open} the containing package to the + * {@code javafx.graphics} module. + *

+ *

+ * If the class is not accessible by + * the {@code javafx.graphics} module, then an exception will be thrown when + * the application is launched. + *

+ * *

Parameters

*

* Application parameters are available by calling the {@link #getParameters} @@ -211,8 +226,9 @@ * This is equivalent to launch(TheClass.class, args) where TheClass is the * immediately enclosing class of the method that called launch. It must * be a public subclass of Application with a public no-argument - * constructor, in a package that is exported - * (see {@code Module.isExported(String,Module)}) to at least the + * constructor, in a package that is + * {@link Module#isExported(String,Module) exported} + * (or {@link Module#isOpen(String,Module) opened}) to at least the * {@code javafx.graphics} module, or a RuntimeException will be thrown. * *