# HG changeset patch # User kcr # Date 1488575011 -19800 # Sat Mar 04 02:33:31 2017 +0530 # Node ID 4875fc817ea83a5982a651c92b9c8b824d6c3143 # Parent ba188ce090552f8c5042aa69873828ebd87231c6 8170702: Document that javafx.graphics needs explicit access to application main class Reviewed-by: 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ package javafx.application; +import java.lang.reflect.Module; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.List; @@ -64,6 +65,9 @@ *
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, and the + * containing package must be {@link Module#isExported(String,Module) exported} + * to the {@code javafx.graphics} module.
* *Calling {@link Platform#exit} is the preferred way to explicitly terminate
* a JavaFX Application. Directly calling {@link System#exit} is
@@ -186,6 +190,11 @@
* @throws IllegalStateException if this method is called more than once.
* @throws IllegalArgumentException if appClass
is not a
* subclass of Application
.
+ * @throws RuntimeException if there is an error launching the
+ * JavaFX runtime, or if the application class cannot be constructed
+ * (e.g., if the class is not public or is not in an exported package), or
+ * if an Exception or Error is thrown by the Application constructor, init
+ * method, start method, or stop method.
*/
public static void launch(Class extends Application> appClass, String... args) {
LauncherImpl.launchApplication(appClass, args);
@@ -219,6 +228,11 @@
* {@link #getParameters()} method.
*
* @throws IllegalStateException if this method is called more than once.
+ * @throws RuntimeException if there is an error launching the
+ * JavaFX runtime, or if the application class cannot be constructed
+ * (e.g., if the class is not public or is not in an exported package), or
+ * if an Exception or Error is thrown by the Application constructor, init
+ * method, start method, or stop method.
*/
public static void launch(String... args) {
// Figure out the right class to call