< prev index next >

modules/javafx.graphics/src/main/java/javafx/application/Application.java

Print this page
rev 10358 : 8170702: Document that javafx.graphics needs explicit access to application main class
Reviewed-by:

*** 1,7 **** /* ! * Copyright (c) 2010, 2015, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 23,32 **** --- 23,33 ---- * questions. */ package javafx.application; + import java.lang.reflect.Module; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.List; import java.util.Map;
*** 62,71 **** --- 63,75 ---- * <li>Calls the {@link #stop} method</li> * </ol> * <p>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.</p> + * <p>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.</p> * * <p>Calling {@link Platform#exit} is the preferred way to explicitly terminate * a JavaFX Application. Directly calling {@link System#exit} is * an acceptable alternative, but doesn't allow the Application {@link #stop} * method to run.
*** 184,193 **** --- 188,202 ---- * {@link #getParameters()} method. * * @throws IllegalStateException if this method is called more than once. * @throws IllegalArgumentException if <code>appClass</code> is not a * subclass of <code>Application</code>. + * @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); }
*** 217,226 **** --- 226,240 ---- * @param args the command line arguments passed to the application. * An application may get these parameters using the * {@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 StackTraceElement[] cause = Thread.currentThread().getStackTrace();
< prev index next >