From 482ad348b5a72d22aff60c60463076bfb55c1ed8 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Thu, 22 Dec 2016 18:09:58 +0300 Subject: [PATCH] 8169900: The code which use Applets should be deprecated Reviewed-by: prr --- .../classes/java/beans/AppletInitializer.java | 11 ++++----- .../share/classes/java/beans/Beans.java | 24 +++++++++++++------ .../classes/javax/swing/PopupFactory.java | 1 + .../classes/javax/swing/RepaintManager.java | 6 ++++- .../share/classes/sun/applet/AppletEvent.java | 5 ++++ .../sun/applet/AppletEventMulticaster.java | 5 ++++ .../classes/sun/applet/AppletIOException.java | 8 +++++-- .../AppletIllegalArgumentException.java | 8 +++++-- .../classes/sun/applet/AppletImageRef.java | 1 + .../classes/sun/applet/AppletListener.java | 6 ++++- .../sun/applet/AppletObjectInputStream.java | 6 ++++- .../share/classes/sun/applet/AppletPanel.java | 7 +++++- .../share/classes/sun/applet/AppletProps.java | 2 ++ .../classes/sun/applet/AppletViewer.java | 12 ++++++++-- .../sun/applet/AppletViewerFactory.java | 4 ++-- .../classes/sun/applet/AppletViewerPanel.java | 5 ++++ .../share/classes/sun/applet/Main.java | 5 ++++ .../share/classes/sun/awt/EmbeddedFrame.java | 8 +++++-- 18 files changed, 96 insertions(+), 28 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/java/beans/AppletInitializer.java b/jdk/src/java.desktop/share/classes/java/beans/AppletInitializer.java index 50c54643209..1e2a99b357c 100644 --- a/jdk/src/java.desktop/share/classes/java/beans/AppletInitializer.java +++ b/jdk/src/java.desktop/share/classes/java/beans/AppletInitializer.java @@ -30,21 +30,20 @@ import java.applet.Applet; import java.beans.beancontext.BeanContext; /** - *

* This interface is designed to work in collusion with java.beans.Beans.instantiate. * The interface is intended to provide mechanism to allow the proper * initialization of JavaBeans that are also Applets, during their * instantiation by java.beans.Beans.instantiate(). - *

* * @see java.beans.Beans#instantiate * * @since 1.2 * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ - - -@SuppressWarnings("deprecation") +@Deprecated(since = "9") public interface AppletInitializer { /** @@ -74,7 +73,6 @@ public interface AppletInitializer { * @param bCtxt The BeanContext intended for this Applet, or * null. */ - void initialize(Applet newAppletBean, BeanContext bCtxt); /** @@ -86,6 +84,5 @@ public interface AppletInitializer { * * @param newApplet The newly instantiated JavaBean */ - void activate(Applet newApplet); } diff --git a/jdk/src/java.desktop/share/classes/java/beans/Beans.java b/jdk/src/java.desktop/share/classes/java/beans/Beans.java index 43e5c42ffd0..c8b820bb4dc 100644 --- a/jdk/src/java.desktop/share/classes/java/beans/Beans.java +++ b/jdk/src/java.desktop/share/classes/java/beans/Beans.java @@ -97,8 +97,10 @@ public class Beans { * @exception IOException if an I/O error occurs. * @since 1.2 */ - - public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws IOException, ClassNotFoundException { + @SuppressWarnings("deprecation") + public static Object instantiate(ClassLoader cls, String beanName, + BeanContext beanContext) + throws IOException, ClassNotFoundException { return Beans.instantiate(cls, beanName, beanContext, null); } @@ -153,10 +155,18 @@ public class Beans { * object could not be found. * @exception IOException if an I/O error occurs. * @since 1.2 + * + * @deprecated It is recommended to use + * {@link #instantiate(ClassLoader, String, BeanContext)}, + * because the Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ - @SuppressWarnings("deprecation") - public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer) - throws IOException, ClassNotFoundException { + @Deprecated(since = "9") + public static Object instantiate(ClassLoader cls, String beanName, + BeanContext beanContext, + AppletInitializer initializer) + throws IOException, ClassNotFoundException { InputStream ins; ObjectInputStream oins = null; @@ -501,7 +511,7 @@ class ObjectInputStreamWithLoader extends ObjectInputStream * Package private support class. This provides a default AppletContext * for beans which are applets. */ -@SuppressWarnings("deprecation") +@Deprecated(since = "9") class BeansAppletContext implements AppletContext { Applet target; Hashtable imageCache = new Hashtable<>(); @@ -586,7 +596,7 @@ class BeansAppletContext implements AppletContext { * Package private support class. This provides an AppletStub * for beans which are applets. */ -@SuppressWarnings("deprecation") +@Deprecated(since = "9") class BeansAppletStub implements AppletStub { transient boolean active; transient Applet target; diff --git a/jdk/src/java.desktop/share/classes/javax/swing/PopupFactory.java b/jdk/src/java.desktop/share/classes/javax/swing/PopupFactory.java index d45390709cc..4343ae15984 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/PopupFactory.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/PopupFactory.java @@ -260,6 +260,7 @@ public class PopupFactory { * Obtains the appropriate Popup based on * popupType. */ + @SuppressWarnings("deprecation") private Popup getPopup(Component owner, Component contents, int ownerX, int ownerY, int popupType) { if (GraphicsEnvironment.isHeadless()) { diff --git a/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java b/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java index 8737b6bb760..93bae569daa 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java @@ -525,8 +525,12 @@ public class RepaintManager * @param h Height of the region to repaint * @see JApplet#repaint * @since 1.6 + * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ - @SuppressWarnings("deprecation") + @Deprecated(since = "9") public void addDirtyRegion(Applet applet, int x, int y, int w, int h) { addDirtyRegion0(applet, x, y, w, h); } diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletEvent.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletEvent.java index 9b7e9c25526..6a1a5880fc8 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletEvent.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletEvent.java @@ -32,8 +32,13 @@ import java.util.EventObject; * AppletEvent class. * * @author Sunita Mani + * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ @SuppressWarnings("serial") // JDK-implementation class +@Deprecated(since = "9") public class AppletEvent extends EventObject { private Object arg; diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletEventMulticaster.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletEventMulticaster.java index 6889240a1c4..31542d0665b 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletEventMulticaster.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletEventMulticaster.java @@ -36,7 +36,12 @@ import java.io.IOException; * responsible for dispatching events to them. * * @author Sunita Mani + * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ +@Deprecated(since = "9") public class AppletEventMulticaster implements AppletListener { private final AppletListener a, b; diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletIOException.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletIOException.java index de435906e17..e8bd4e0bf75 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletIOException.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletIOException.java @@ -31,10 +31,14 @@ import java.io.IOException; * An applet IO exception. * * @author Koji Uno + * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ @SuppressWarnings("serial") // JDK implementation class -public -class AppletIOException extends IOException { +@Deprecated(since = "9") +public class AppletIOException extends IOException { private String key = null; private Object msgobj = null; diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletIllegalArgumentException.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletIllegalArgumentException.java index 292bd957053..750d09d3113 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletIllegalArgumentException.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletIllegalArgumentException.java @@ -29,10 +29,14 @@ package sun.applet; * An applet security exception. * * @author Arthur van Hoff + * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ @SuppressWarnings("serial") // JDK implementation class -public -class AppletIllegalArgumentException extends IllegalArgumentException { +@Deprecated(since = "9") +public class AppletIllegalArgumentException extends IllegalArgumentException { private String key = null; public AppletIllegalArgumentException(String key) { diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletImageRef.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletImageRef.java index e3eb5a26fb1..bdda032a8ff 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletImageRef.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletImageRef.java @@ -31,6 +31,7 @@ import java.lang.ref.SoftReference; import sun.awt.image.URLImageSource; import java.net.URL; +@Deprecated(since = "9") class AppletImageRef { private SoftReference soft = null; diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletListener.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletListener.java index 00664938251..728060326ad 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletListener.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletListener.java @@ -32,8 +32,12 @@ import java.util.EventListener; * by objects interested in AppletEvents. * * @author Sunita Mani + * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ - +@Deprecated(since = "9") public interface AppletListener extends EventListener { public void appletStateChanged(AppletEvent e); } diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletObjectInputStream.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletObjectInputStream.java index 0906136bfec..689529b77e0 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletObjectInputStream.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletObjectInputStream.java @@ -34,8 +34,12 @@ import java.lang.reflect.Array; /** * This subclass of ObjectInputStream delegates loading of classes to * an existing ClassLoader. + * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ - +@Deprecated(since = "9") class AppletObjectInputStream extends ObjectInputStream { private AppletClassLoader loader; diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java index fc8eaac0845..221314ad04d 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java @@ -52,9 +52,14 @@ import sun.security.util.SecurityConstants; * thread group to call the applet's init(), start(), stop(), and * destroy() methods. * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. + * * @author Arthur van Hoff */ -@SuppressWarnings({"serial", "deprecation"}) // JDK implementation class +@SuppressWarnings({"serial"}) // JDK implementation class +@Deprecated(since = "9") public abstract class AppletPanel extends Panel implements AppletStub, Runnable { diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletProps.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletProps.java index f78e4160209..bb30abe9897 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletProps.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletProps.java @@ -36,6 +36,7 @@ import java.security.PrivilegedActionException; import sun.security.action.*; @SuppressWarnings("serial") // JDK implementation class +@Deprecated(since = "9") class AppletProps extends Frame { TextField proxyHost; @@ -197,6 +198,7 @@ class AppletProps extends Frame { /* 4066432 */ /* Dialog class to display property-related errors to user */ @SuppressWarnings("serial") // JDK implementation class +@Deprecated(since = "9") class AppletPropsErrorDialog extends Dialog { @SuppressWarnings("deprecation") public AppletPropsErrorDialog(Frame parent, String title, String message, diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java index f11804dddab..c64971b4fb0 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java @@ -43,6 +43,7 @@ import sun.awt.AppContext; * A frame to show the applet tag in. */ @SuppressWarnings("serial") // JDK-implementation class +@Deprecated(since = "9") final class TextFrame extends Frame { /** @@ -91,6 +92,7 @@ final class TextFrame extends Frame { /** * Lets us construct one using unix-style one shot behaviors. */ +@Deprecated(since = "9") final class StdAppletViewerFactory implements AppletViewerFactory { @Override @@ -116,8 +118,13 @@ final class StdAppletViewerFactory implements AppletViewerFactory { * AppletViewer Tags. * (The document named appletviewertags.html in the JDK's docs/tooldocs directory, * once the JDK docs have been installed.) + * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ -@SuppressWarnings({"serial", "deprecation"}) // JDK-implementation class +@SuppressWarnings({"serial"}) // JDK-implementation class +@Deprecated(since = "9") public class AppletViewer extends Frame implements AppletContext, Printable { /** @@ -146,7 +153,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { */ AppletViewerFactory factory; - + @Deprecated(since = "9") private final class UserActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent evt) { @@ -219,6 +226,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { } }; + @Deprecated(since = "9") class AppletEventListener implements AppletListener { final Frame frame; diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerFactory.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerFactory.java index 16b6db4679d..7cf319f6941 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerFactory.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerFactory.java @@ -33,8 +33,8 @@ import java.util.Hashtable; import java.net.URL; import java.awt.MenuBar; -public -interface AppletViewerFactory { +@Deprecated(since = "9") +public interface AppletViewerFactory { public AppletViewer createAppletViewer(int x, int y, URL doc, Hashtable atts); public MenuBar getBaseMenuBar(); diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerPanel.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerPanel.java index c0aaf07ad03..86ef3671df0 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerPanel.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerPanel.java @@ -40,7 +40,12 @@ import java.applet.*; * destroy() methods. * * @author Arthur van Hoff + * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ +@Deprecated(since = "9") class AppletViewerPanel extends AppletPanel { /* Are we debugging? */ diff --git a/jdk/src/java.desktop/share/classes/sun/applet/Main.java b/jdk/src/java.desktop/share/classes/sun/applet/Main.java index 6c28c8f9d11..6f5d0c178d7 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/Main.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/Main.java @@ -39,7 +39,12 @@ import sun.net.www.ParseUtil; /** * The main entry point into AppletViewer. + * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ +@Deprecated(since = "9") public class Main { /** * The file which contains all of the AppletViewer specific properties. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java b/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java index 38060aa55a6..704a8619591 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java @@ -496,10 +496,14 @@ public abstract class EmbeddedFrame extends Frame * Checks if the component is in an EmbeddedFrame. If so, * returns the applet found in the hierarchy or null if * not found. - * @return the parent applet or {@ null} + * @return the parent applet or {@code null} * @since 1.6 + * + * @deprecated The Applet API is deprecated. See the + * java.applet package + * documentation for further information. */ - @SuppressWarnings("deprecation") + @Deprecated(since = "9") public static Applet getAppletIfAncestorOf(Component comp) { Container parent = comp.getParent(); Applet applet = null;