8169900: The code which use Applets should be deprecated

Reviewed-by: prr
This commit is contained in:
Sergey Bylokhov 2016-12-22 18:09:58 +03:00
parent ba4736cba3
commit 482ad348b5
18 changed files with 96 additions and 28 deletions

View File

@ -30,21 +30,20 @@ import java.applet.Applet;
import java.beans.beancontext.BeanContext;
/**
* <p>
* 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().
* </p>
*
* @see java.beans.Beans#instantiate
*
* @since 1.2
*
* @deprecated The Applet API is deprecated. See the
* <a href="../applet/package-summary.html"> java.applet package
* documentation</a> 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);
}

View File

@ -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
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> 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<URL,Object> 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;

View File

@ -260,6 +260,7 @@ public class PopupFactory {
* Obtains the appropriate <code>Popup</code> based on
* <code>popupType</code>.
*/
@SuppressWarnings("deprecation")
private Popup getPopup(Component owner, Component contents,
int ownerX, int ownerY, int popupType) {
if (GraphicsEnvironment.isHeadless()) {

View File

@ -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
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> 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);
}

View File

@ -32,8 +32,13 @@ import java.util.EventObject;
* AppletEvent class.
*
* @author Sunita Mani
*
* @deprecated The Applet API is deprecated. See the
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> for further information.
*/
@SuppressWarnings("serial") // JDK-implementation class
@Deprecated(since = "9")
public class AppletEvent extends EventObject {
private Object arg;

View File

@ -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
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> for further information.
*/
@Deprecated(since = "9")
public class AppletEventMulticaster implements AppletListener {
private final AppletListener a, b;

View File

@ -31,10 +31,14 @@ import java.io.IOException;
* An applet IO exception.
*
* @author Koji Uno
*
* @deprecated The Applet API is deprecated. See the
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> 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;

View File

@ -29,10 +29,14 @@ package sun.applet;
* An applet security exception.
*
* @author Arthur van Hoff
*
* @deprecated The Applet API is deprecated. See the
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> 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) {

View File

@ -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<Image> soft = null;

View File

@ -32,8 +32,12 @@ import java.util.EventListener;
* by objects interested in AppletEvents.
*
* @author Sunita Mani
*
* @deprecated The Applet API is deprecated. See the
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> for further information.
*/
@Deprecated(since = "9")
public interface AppletListener extends EventListener {
public void appletStateChanged(AppletEvent e);
}

View File

@ -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
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> for further information.
*/
@Deprecated(since = "9")
class AppletObjectInputStream extends ObjectInputStream
{
private AppletClassLoader loader;

View File

@ -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
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> 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 {

View File

@ -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,

View File

@ -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 {
* <a href="../../../docs/tooldocs/appletviewertags.html">AppletViewer Tags</a>.
* (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
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> 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;

View File

@ -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<String, String> atts);
public MenuBar getBaseMenuBar();

View File

@ -40,7 +40,12 @@ import java.applet.*;
* destroy() methods.
*
* @author Arthur van Hoff
*
* @deprecated The Applet API is deprecated. See the
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> for further information.
*/
@Deprecated(since = "9")
class AppletViewerPanel extends AppletPanel {
/* Are we debugging? */

View File

@ -39,7 +39,12 @@ import sun.net.www.ParseUtil;
/**
* The main entry point into AppletViewer.
*
* @deprecated The Applet API is deprecated. See the
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> for further information.
*/
@Deprecated(since = "9")
public class Main {
/**
* The file which contains all of the AppletViewer specific properties.

View File

@ -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
* <a href="../../java/applet/package-summary.html"> java.applet package
* documentation</a> for further information.
*/
@SuppressWarnings("deprecation")
@Deprecated(since = "9")
public static Applet getAppletIfAncestorOf(Component comp) {
Container parent = comp.getParent();
Applet applet = null;