Get javax.servlet passing TCK API check
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 7 Feb 2010 21:02:03 +0000 (21:02 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 7 Feb 2010 21:02:03 +0000 (21:02 +0000)
Mainly removing generics and @Deprecated

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

java/javax/servlet/HttpConstraintElement.java
java/javax/servlet/HttpMethodConstraintElement.java
java/javax/servlet/ServletContext.java
java/javax/servlet/ServletRequest.java
java/javax/servlet/ServletRequestWrapper.java
java/javax/servlet/ServletResponseWrapper.java
java/javax/servlet/SingleThreadModel.java
java/javax/servlet/UnavailableException.java
java/javax/servlet/annotation/HandlesTypes.java
java/javax/servlet/annotation/MultipartConfig.java

index cb9ae8e..f70ad74 100644 (file)
@@ -28,7 +28,7 @@ import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
 public class HttpConstraintElement {
     
     private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
-    protected static final ResourceBundle lStrings =
+    private static final ResourceBundle lStrings =
         ResourceBundle.getBundle(LSTRING_FILE);
 
     private EmptyRoleSemantic emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
index 025a5d6..4b016f8 100644 (file)
 */
 package javax.servlet;
 
+import java.util.ResourceBundle;
+
 /**
  * @since Servlet 3.0
  * TODO SERVLET3 - Add comments
  */
 public class HttpMethodConstraintElement extends HttpConstraintElement {
-    
+
+    // Can't inherit from HttpConstraintElement as API does not allow it
+    private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
+    private static final ResourceBundle lStrings =
+        ResourceBundle.getBundle(LSTRING_FILE);
+
     private String methodName;
 
     public HttpMethodConstraintElement(String methodName) {
index 6afa6c1..71042bc 100644 (file)
@@ -353,10 +353,10 @@ public interface ServletContext {
      * <p>In lieu of this method, servlets can share information using the 
      * <code>ServletContext</code> class and can perform shared business logic
      * by invoking methods on common non-servlet classes.
-     *
+     * 
+     * @deprecated
      */
-
-    @Deprecated
+    @SuppressWarnings("dep-ann") // Spec API does not use dep-ann
     public Servlet getServlet(String name) throws ServletException;
     
   
@@ -374,10 +374,10 @@ public interface ServletContext {
      * remains only to preserve binary compatibility. This method
      * will be permanently removed in a future version of the Java
      * Servlet API.
-     *
+     * 
+     * @deprecated
      */
-    
-    @Deprecated
+    @SuppressWarnings("dep-ann") // Spec API does not use dep-ann
     public Enumeration<Servlet> getServlets();
     
     
@@ -394,10 +394,10 @@ public interface ServletContext {
      * this method always returns an empty <code>Enumeration</code> and 
      * remains only to preserve binary compatibility. This method will 
      * be permanently removed in a future version of the Java Servlet API.
-     *
+     * 
+     * @deprecated
      */
-    @Deprecated
+    @SuppressWarnings("dep-ann") // Spec API does not use dep-ann
     public Enumeration<String> getServletNames();
     
   
@@ -430,10 +430,10 @@ public interface ServletContext {
      * <p>This method was originally defined to write an 
      * exception's stack trace and an explanatory error message
      * to the servlet log file.
-     *
+     * 
+     * @deprecated
      */
-
-    @Deprecated
+    @SuppressWarnings("dep-ann") // Spec API does not use dep-ann
     public void log(Exception exception, String msg);
     
     
index 01c04eb..eca0106 100644 (file)
@@ -540,13 +540,10 @@ public interface ServletRequest {
     
 
     /**
-     * 
      * @deprecated     As of Version 2.1 of the Java Servlet API,
      *                         use {@link ServletContext#getRealPath} instead.
-     *
      */
-
-    @Deprecated
+    @SuppressWarnings("dep-ann") // Spec API does not use dep-ann
     public String getRealPath(String path);
     
     
index 3c7e21f..0371952 100644 (file)
@@ -351,8 +351,7 @@ public class ServletRequestWrapper implements ServletRequest {
      * on the wrapped request object.
      * @deprecated As of Version 3.0 of the Java Servlet API
      */
-
-    @Deprecated
+    @SuppressWarnings("dep-ann") // Spec API does not use dep-ann
     public String getRealPath(String path) {
        return this.request.getRealPath(path);
     }
@@ -493,7 +492,8 @@ public class ServletRequestWrapper implements ServletRequest {
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
      */
-    public boolean isWrapperFor(Class<? extends ServletRequest> wrappedType) {
+    @SuppressWarnings("unchecked") // Spec API does not use generics
+    public boolean isWrapperFor(Class wrappedType) {
         if (wrappedType.isAssignableFrom(request.getClass())) {
             return true;
         }
index f144210..47230e7 100644 (file)
@@ -231,7 +231,8 @@ public class ServletResponseWrapper implements ServletResponse {
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
      */
-    public boolean isWrapperFor(Class<? extends ServletResponse> wrappedType) {
+    @SuppressWarnings("unchecked") // Spec API does not use generics
+    public boolean isWrapperFor(Class wrappedType) {
         if (wrappedType.isAssignableFrom(response.getClass())) {
             return true;
         }
index 06051f0..3cec4c2 100644 (file)
@@ -44,8 +44,7 @@ package javax.servlet;
  * @deprecated As of Java Servlet API 2.4, with no direct
  *     replacement.
  */
-
-@Deprecated
+@SuppressWarnings("dep-ann") // Spec API does not use dep-ann
 public interface SingleThreadModel {
     // No methods
 }
index eb0d3f0..f3353ef 100644 (file)
@@ -56,19 +56,16 @@ extends ServletException {
     private int         seconds;           // unavailability estimate
 
     /**
-     * 
-     * @deprecated     As of Java Servlet API 2.2, use {@link
-     *                         #UnavailableException(String)} instead.
-     *
      * @param servlet  the <code>Servlet</code> instance that is
      *                  unavailable
      *
      * @param msg      a <code>String</code> specifying the
      *                  descriptive message
-     *
+     * 
+     * @deprecated  As of Java Servlet API 2.2, use {@link
+     *          #UnavailableException(String)} instead.
      */
-
-    @Deprecated
+    @SuppressWarnings("dep-ann") // Spec API does not use dep-ann
     public UnavailableException(Servlet servlet, String msg) {
        super(msg);
        this.servlet = servlet;
@@ -76,8 +73,6 @@ extends ServletException {
     }
  
     /**
-     * @deprecated     As of Java Servlet API 2.2, use {@link
-     *                 #UnavailableException(String, int)} instead.
      *
      * @param seconds  an integer specifying the number of seconds
      *                         the servlet expects to be unavailable; if
@@ -89,10 +84,11 @@ extends ServletException {
      * @param msg      a <code>String</code> specifying the descriptive 
      *                 message, which can be written to a log file or 
      *                 displayed for the user.
-     *
+     * 
+     * @deprecated  As of Java Servlet API 2.2, use {@link
+     *          #UnavailableException(String, int)} instead.
      */
-    
-    @Deprecated
+    @SuppressWarnings("dep-ann") // Spec API does not use dep-ann
     public UnavailableException(int seconds, Servlet servlet, String msg) {
        super(msg);
        this.servlet = servlet;
@@ -172,16 +168,14 @@ extends ServletException {
     }
   
     /**
-     * @deprecated     As of Java Servlet API 2.2, with no replacement.
-     *
      * Returns the servlet that is reporting its unavailability.
      * 
      * @return         the <code>Servlet</code> object that is 
      *                 throwing the <code>UnavailableException</code>
      *
+     * @deprecated  As of Java Servlet API 2.2, with no replacement.
      */
-     
-    @Deprecated
+    @SuppressWarnings("dep-ann") // Spec API does not use dep-ann
     public Servlet getServlet() {
        return servlet;
     }
index d32c71e..f0fc1df 100644 (file)
@@ -16,7 +16,6 @@
  */
 package javax.servlet.annotation;
 
-import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -28,7 +27,7 @@ import java.lang.annotation.Target;
  */
 @Target({ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
-@Documented
+@SuppressWarnings("unchecked") // Spec API does not use generics
 public @interface HandlesTypes {
-    Class<?>[] value();
+    Class[] value();
 }
index fe2ee17..dbd19f5 100644 (file)
@@ -16,7 +16,6 @@
  */
 package javax.servlet.annotation;
 
-import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -28,7 +27,6 @@ import java.lang.annotation.Target;
  */
 @Target({ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
-@Documented
 public @interface MultipartConfig {
     String location() default "";
     long maxFileSize() default -1L;