Generics changes after updating the spec api and also those enabled by the min 1...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 12 Jan 2009 15:02:23 +0000 (15:02 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 12 Jan 2009 15:02:23 +0000 (15:02 +0000)
Add deprecation to the internal Tomcta methods that implement deprecated methods.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@733775 13f79535-47bb-0310-9956-ffa450edef68

15 files changed:
java/org/apache/catalina/ant/jmx/JMXAccessorTask.java
java/org/apache/catalina/connector/Request.java
java/org/apache/catalina/connector/RequestFacade.java
java/org/apache/catalina/core/ApplicationContext.java
java/org/apache/catalina/core/ApplicationContextFacade.java
java/org/apache/catalina/core/ApplicationFilterConfig.java
java/org/apache/catalina/core/ApplicationHttpRequest.java
java/org/apache/catalina/core/ApplicationHttpResponse.java
java/org/apache/catalina/core/DummyRequest.java
java/org/apache/catalina/core/DummyResponse.java
java/org/apache/catalina/core/StandardWrapperFacade.java
java/org/apache/catalina/ha/jmx/ClusterJmxHelper.java
java/org/apache/catalina/ha/session/DeltaSession.java
java/org/apache/catalina/session/StandardSession.java
java/org/apache/catalina/session/StandardSessionFacade.java

index 3f118a7..ce2164e 100644 (file)
@@ -621,7 +621,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
             for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
                 String key = iter.next();
                 Object value = data.get(key);
-                OpenType type = compositeType.getType(key);
+                OpenType<?> type = compositeType.getType(key);
                 if (type instanceof SimpleType) {
                     setProperty(propertyPrefix + "." + key, value);
                 } else {
@@ -636,7 +636,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
                     Object key1 = iter1.next();
                     CompositeData valuedata = data.get(new Object[] { key1 });
                     Object value = valuedata.get("value");
-                    OpenType type = valuedata.getCompositeType().getType(
+                    OpenType<?> type = valuedata.getCompositeType().getType(
                             "value");
                     if (type instanceof SimpleType) {
                         setProperty(propertyPrefix + "." + key1, value);
index 6f5699a..4438bf4 100644 (file)
@@ -1090,7 +1090,7 @@ public class Request
     /**
      * Return the names of all defined request parameters for this request.
      */
-    public Enumeration getParameterNames() {
+    public Enumeration<String> getParameterNames() {
 
         if (!parametersParsed)
             parseParameters();
@@ -1932,7 +1932,7 @@ public class Request
      *
      * @param name Name of the requested header
      */
-    public Enumeration getHeaders(String name) {
+    public Enumeration<String> getHeaders(String name) {
         return coyoteRequest.getMimeHeaders().values(name);
     }
 
@@ -1940,7 +1940,7 @@ public class Request
     /**
      * Return the names of all headers received with this request.
      */
-    public Enumeration getHeaderNames() {
+    public Enumeration<String> getHeaderNames() {
         return coyoteRequest.getMimeHeaders().names();
     }
 
index 825c0aa..387a2e6 100644 (file)
@@ -269,7 +269,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    public Enumeration getAttributeNames() {
+    public Enumeration<String> getAttributeNames() {
 
         if (request == null) {
             throw new IllegalStateException(
@@ -362,7 +362,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    public Enumeration getParameterNames() {
+    public Enumeration<String> getParameterNames() {
 
         if (request == null) {
             throw new IllegalStateException(
@@ -405,7 +405,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    public Map getParameterMap() {
+    public Map<String,String[]> getParameterMap() {
 
         if (request == null) {
             throw new IllegalStateException(
@@ -536,7 +536,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    public Enumeration getLocales() {
+    public Enumeration<Locale> getLocales() {
 
         if (request == null) {
             throw new IllegalStateException(
@@ -649,7 +649,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    public Enumeration getHeaders(String name) {
+    public Enumeration<String> getHeaders(String name) {
 
         if (request == null) {
             throw new IllegalStateException(
@@ -665,7 +665,7 @@ public class RequestFacade implements HttpServletRequest {
     }
 
 
-    public Enumeration getHeaderNames() {
+    public Enumeration<String> getHeaderNames() {
 
         if (request == null) {
             throw new IllegalStateException(
index 29bc2c8..81ae804 100644 (file)
@@ -117,10 +117,18 @@ public class ApplicationContext
 
 
     /**
-     * Empty collection to serve as the basis for empty enumerations.
+     * Empty String collection to serve as the basis for empty enumerations.
      * <strong>DO NOT ADD ANY ELEMENTS TO THIS COLLECTION!</strong>
      */
-    private static final ArrayList<Object> empty = new ArrayList<Object>();
+    private static final ArrayList<String> emptyString =
+        new ArrayList<String>();
+
+    /**
+     * Empty Servlet collection to serve as the basis for empty enumerations.
+     * <strong>DO NOT ADD ANY ELEMENTS TO THIS COLLECTION!</strong>
+     */
+    private static final ArrayList<Servlet> emptyServlet =
+        new ArrayList<Servlet>();
 
 
     /**
@@ -201,7 +209,7 @@ public class ApplicationContext
      * Return an enumeration of the names of the context attributes
      * associated with this context.
      */
-    public Enumeration getAttributeNames() {
+    public Enumeration<String> getAttributeNames() {
 
         return new Enumerator<String>(attributes.keySet(), true);
 
@@ -283,7 +291,7 @@ public class ApplicationContext
      * Return the names of the context's initialization parameters, or an
      * empty enumeration if the context has no initialization parameters.
      */
-    public Enumeration getInitParameterNames() {
+    public Enumeration<String> getInitParameterNames() {
 
         mergeParameters();
         return (new Enumerator<String>(parameters.keySet()));
@@ -562,7 +570,7 @@ public class ApplicationContext
      *
      * @param path Collection path
      */
-    public Set getResourcePaths(String path) {
+    public Set<String> getResourcePaths(String path) {
 
         // Validate the path argument
         if (path == null) {
@@ -640,16 +648,16 @@ public class ApplicationContext
     /**
      * @deprecated As of Java Servlet API 2.1, with no direct replacement.
      */
-    public Enumeration getServletNames() {
-        return (new Enumerator<Object>(empty));
+    public Enumeration<String> getServletNames() {
+        return (new Enumerator<String>(emptyString));
     }
 
 
     /**
      * @deprecated As of Java Servlet API 2.1, with no direct replacement.
      */
-    public Enumeration getServlets() {
-        return (new Enumerator<Object>(empty));
+    public Enumeration<Servlet> getServlets() {
+        return (new Enumerator<Servlet>(emptyServlet));
     }
 
 
index b88792f..7e90c8f 100644 (file)
@@ -159,9 +159,10 @@ public final class ApplicationContextFacade
     }
 
 
-    public Set getResourcePaths(String path) {
+    public Set<String> getResourcePaths(String path) {
         if (SecurityUtil.isPackageProtectionEnabled()){
-            return (Set)doPrivileged("getResourcePaths", new Object[]{path});
+            return (Set<String>)doPrivileged("getResourcePaths",
+                    new Object[]{path});
         } else {
             return context.getResourcePaths(path);
         }
@@ -216,6 +217,9 @@ public final class ApplicationContextFacade
     }
 
 
+    /**
+     * @deprecated
+     */
     public Servlet getServlet(String name)
         throws ServletException {
         if (SecurityUtil.isPackageProtectionEnabled()) {
@@ -234,18 +238,24 @@ public final class ApplicationContextFacade
     }
 
 
-    public Enumeration getServlets() {
+    /**
+     * @deprecated
+     */
+    public Enumeration<Servlet> getServlets() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (Enumeration) doPrivileged("getServlets", null);
+            return (Enumeration<Servlet>) doPrivileged("getServlets", null);
         } else {
             return context.getServlets();
         }
     }
 
 
-    public Enumeration getServletNames() {
+    /**
+     * @deprecated
+     */
+    public Enumeration<String> getServletNames() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (Enumeration) doPrivileged("getServletNames", null);
+            return (Enumeration<String>) doPrivileged("getServletNames", null);
         } else {
             return context.getServletNames();
         }
@@ -261,6 +271,9 @@ public final class ApplicationContextFacade
     }
 
 
+    /**
+     * @deprecated
+     */
     public void log(Exception exception, String msg) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             doPrivileged("log", new Class[]{Exception.class, String.class}, 
@@ -309,9 +322,10 @@ public final class ApplicationContextFacade
     }
 
 
-    public Enumeration getInitParameterNames() {
+    public Enumeration<String> getInitParameterNames() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (Enumeration) doPrivileged("getInitParameterNames", null);
+            return (Enumeration<String>) doPrivileged(
+                    "getInitParameterNames", null);
         } else {
             return context.getInitParameterNames();
         }
@@ -327,9 +341,10 @@ public final class ApplicationContextFacade
      }
 
 
-    public Enumeration getAttributeNames() {
+    public Enumeration<String> getAttributeNames() {
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return (Enumeration) doPrivileged("getAttributeNames", null);
+            return (Enumeration<String>) doPrivileged(
+                    "getAttributeNames", null);
         } else {
             return context.getAttributeNames();
         }
index 4cb4b9e..f06cf2e 100644 (file)
@@ -153,7 +153,7 @@ final class ApplicationFilterConfig implements FilterConfig, Serializable {
      * Return an <code>Enumeration</code> of the names of the initialization
      * parameters for this Filter.
      */
-    public Enumeration getInitParameterNames() {
+    public Enumeration<String> getInitParameterNames() {
 
         Map<String,String> map = filterDef.getParameterMap();
         if (map == null)
index 4d7712e..4088e4d 100644 (file)
@@ -239,7 +239,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
      * Override the <code>getAttributeNames()</code> method of the wrapped
      * request.
      */
-    public Enumeration getAttributeNames() {
+    public Enumeration<String> getAttributeNames() {
         return (new AttributeNamesEnumerator());
     }
 
index ce24523..b2d61fc 100644 (file)
@@ -335,6 +335,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
      *
      * @param sc The new status code
      * @param msg The new message
+     * @deprecated
      */
     public void setStatus(int sc, String msg) {
 
index 5e39590..f108203 100644 (file)
@@ -81,11 +81,11 @@ public class DummyRequest
 
     protected FilterChain filterChain = null;
     
-    private static Enumeration<Object> dummyEnum = new Enumeration<Object>(){
+    private static Enumeration<String> dummyEnum = new Enumeration<String>(){
         public boolean hasMoreElements(){
             return false;
         }
-        public Object nextElement(){
+        public String nextElement(){
             return null;
         }
     };
@@ -194,7 +194,7 @@ public class DummyRequest
     public void setServerName(String name) {}
     public void setServerPort(int port) {}
     public Object getAttribute(String name) { return null; }
-    public Enumeration getAttributeNames() { return null; }
+    public Enumeration<String> getAttributeNames() { return null; }
     public String getCharacterEncoding() { return null; }
     public int getContentLength() { return -1; }
     public void setContentLength(int length) {}
@@ -203,9 +203,10 @@ public class DummyRequest
         return null;
     }
     public Locale getLocale() { return null; }
-    public Enumeration getLocales() { return null; }
+    public Enumeration<Locale> getLocales() { return null; }
     public String getProtocol() { return null; }
     public BufferedReader getReader() throws IOException { return null; }
+    /** @deprecated */
     public String getRealPath(String path) { return null; }
     public String getRemoteAddr() { return null; }
     public String getRemoteHost() { return null; }
@@ -235,8 +236,8 @@ public class DummyRequest
     public void setSecure(boolean secure) {}
     public void setUserPrincipal(Principal principal) {}
     public String getParameter(String name) { return null; }
-    public Map getParameterMap() { return null; }
-    public Enumeration getParameterNames() { return dummyEnum; }
+    public Map<String,String[]> getParameterMap() { return null; }
+    public Enumeration<String> getParameterNames() { return dummyEnum; }
     public String[] getParameterValues(String name) { return null; }
     public RequestDispatcher getRequestDispatcher(String path) {
         return null;
@@ -245,8 +246,8 @@ public class DummyRequest
     public Cookie[] getCookies() { return null; }
     public long getDateHeader(String name) { return -1; }
     public String getHeader(String name) { return null; }
-    public Enumeration getHeaders(String name) { return null; }
-    public Enumeration getHeaderNames() { return null; }
+    public Enumeration<String> getHeaders(String name) { return null; }
+    public Enumeration<String> getHeaderNames() { return null; }
     public int getIntHeader(String name) { return -1; }
     public String getMethod() { return null; }
     public String getPathTranslated() { return null; }
@@ -259,6 +260,7 @@ public class DummyRequest
     public HttpSession getSession(boolean create) { return null; }
     public boolean isRequestedSessionIdFromCookie() { return false; }
     public boolean isRequestedSessionIdFromURL() { return false; }
+    /** @deprecated */
     public boolean isRequestedSessionIdFromUrl() { return false; }
     public boolean isRequestedSessionIdValid() { return false; }
     public boolean isUserInRole(String role) { return false; }
index f4f3667..c167687 100644 (file)
@@ -108,8 +108,10 @@ public class DummyResponse
     public void addIntHeader(String name, int value) {}
     public boolean containsHeader(String name) { return false; }
     public String encodeRedirectURL(String url) { return null; }
+    /** @deprecated */
     public String encodeRedirectUrl(String url) { return null; }
     public String encodeURL(String url) { return null; }
+    /** @deprecated */
     public String encodeUrl(String url) { return null; }
     public void sendAcknowledgement() throws IOException {}
     public void sendError(int status) throws IOException {}
@@ -119,6 +121,7 @@ public class DummyResponse
     public void setHeader(String name, String value) {}
     public void setIntHeader(String name, int value) {}
     public void setStatus(int status) {}
+    /** @deprecated */
     public void setStatus(int status, String message) {}
 
 
index c36c8ed..26282b2 100644 (file)
@@ -88,7 +88,7 @@ public final class StandardWrapperFacade
     }
 
 
-    public Enumeration getInitParameterNames() {
+    public Enumeration<String> getInitParameterNames() {
         return config.getInitParameterNames();
     }
 
index ab4ed73..cfcb149 100644 (file)
@@ -52,7 +52,7 @@ public class ClusterJmxHelper {
     public static MBeanServer getMBeanServer() throws Exception {
         if (mbeanServer == null) {
             if (MBeanServerFactory.findMBeanServer(null).size() > 0) {
-                mbeanServer = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
+                mbeanServer = MBeanServerFactory.findMBeanServer(null).get(0);
             } else {
                 mbeanServer = MBeanServerFactory.createMBeanServer();
             }
index 6343787..3eeeab8 100644 (file)
@@ -779,7 +779,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 final class StandardSessionContext
     implements HttpSessionContext {
 
-    private HashMap dummy = new HashMap();
+    private HashMap<?,String> dummy = new HashMap<String,String>();
 
     /**
      * Return the session identifiers of all sessions defined within this
@@ -789,8 +789,8 @@ final class StandardSessionContext
      *             must return an empty <code>Enumeration</code> and will be
      *             removed in a future version of the API.
      */
-    public Enumeration getIds() {
-        return (new Enumerator(dummy));
+    public Enumeration<String> getIds() {
+        return (new Enumerator<String>(dummy));
     }
 
     /**
index 135a67f..09cafd2 100644 (file)
@@ -1740,7 +1740,7 @@ public class StandardSession
 final class StandardSessionContext implements HttpSessionContext {
 
 
-    protected HashMap dummy = new HashMap();
+    protected HashMap<?,String> dummy = new HashMap<String,String>();
 
     /**
      * Return the session identifiers of all sessions defined
@@ -1750,9 +1750,9 @@ final class StandardSessionContext implements HttpSessionContext {
      *  This method must return an empty <code>Enumeration</code>
      *  and will be removed in a future version of the API.
      */
-    public Enumeration getIds() {
+    public Enumeration<String> getIds() {
 
-        return (new Enumerator(dummy));
+        return (new Enumerator<String>(dummy));
 
     }
 
index eafb499..2d659c5 100644 (file)
@@ -122,7 +122,7 @@ public class StandardSessionFacade
     }
 
 
-    public Enumeration getAttributeNames() {
+    public Enumeration<String> getAttributeNames() {
         return session.getAttributeNames();
     }