tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r898275 - in /tomcat/trunk/java: javax/el/ org/apache/catalina/loader/ org/apache/el/lang/ org/apache/el/parser/ org/apache/naming/resources/
Date Tue, 12 Jan 2010 10:31:03 GMT
Author: markt
Date: Tue Jan 12 10:31:03 2010
New Revision: 898275

URL: http://svn.apache.org/viewvc?rev=898275&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48517
Reduce scope of @SupressWarnings and document reasoning
Based on a patch by sebb

Modified:
    tomcat/trunk/java/javax/el/BeanELResolver.java
    tomcat/trunk/java/javax/el/ELContext.java
    tomcat/trunk/java/javax/el/ResourceBundleELResolver.java
    tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
    tomcat/trunk/java/org/apache/el/lang/ELSupport.java
    tomcat/trunk/java/org/apache/el/lang/EvaluationContext.java
    tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java
    tomcat/trunk/java/org/apache/el/parser/AstValue.java
    tomcat/trunk/java/org/apache/el/parser/SimpleNode.java
    tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java

Modified: tomcat/trunk/java/javax/el/BeanELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/BeanELResolver.java?rev=898275&r1=898274&r2=898275&view=diff
==============================================================================
--- tomcat/trunk/java/javax/el/BeanELResolver.java (original)
+++ tomcat/trunk/java/javax/el/BeanELResolver.java Tue Jan 12 10:31:03 2010
@@ -37,8 +37,8 @@
 
 	private final boolean readOnly;
 
-	private final ConcurrentCache<String, BeanProperties> cache = new ConcurrentCache<String,
BeanProperties>(
-			1000);
+	private final ConcurrentCache<String, BeanProperties> cache =
+	    new ConcurrentCache<String, BeanProperties>(1000);
 
 	public BeanELResolver() {
 		this.readOnly = false;
@@ -230,8 +230,8 @@
 			this.type = descriptor.getPropertyType();
 		}
 
-		@SuppressWarnings("unchecked") // Can't use Class<?> because API needs to match specification
-        public Class getPropertyType() {
+		// Can't use Class<?> because API needs to match specification
+        public @SuppressWarnings("unchecked") Class getPropertyType() {
 			return this.type;
 		}
 

Modified: tomcat/trunk/java/javax/el/ELContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/ELContext.java?rev=898275&r1=898274&r2=898275&view=diff
==============================================================================
--- tomcat/trunk/java/javax/el/ELContext.java (original)
+++ tomcat/trunk/java/javax/el/ELContext.java Tue Jan 12 10:31:03 2010
@@ -39,16 +39,17 @@
         this.resolved = false;
     }
     
-    @SuppressWarnings("unchecked") // Can't use Class<?> because API needs to match
specification
-    public Object getContext(Class key) {
+    // Can't use Class<?> because API needs to match specification
+    public Object getContext(@SuppressWarnings("unchecked") Class key) {
         if (this.map == null) {
             return null;
         }
         return this.map.get(key);
     }
     
-    @SuppressWarnings("unchecked") // Can't use Class<?> because API needs to match
specification
-    public void putContext(Class key, Object contextObject) throws NullPointerException {
+    // Can't use Class<?> because API needs to match specification
+    public void putContext(@SuppressWarnings("unchecked") Class key,
+            Object contextObject) throws NullPointerException {
         if (key == null || contextObject == null) {
             throw new NullPointerException();
         }

Modified: tomcat/trunk/java/javax/el/ResourceBundleELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/ResourceBundleELResolver.java?rev=898275&r1=898274&r2=898275&view=diff
==============================================================================
--- tomcat/trunk/java/javax/el/ResourceBundleELResolver.java (original)
+++ tomcat/trunk/java/javax/el/ResourceBundleELResolver.java Tue Jan 12 10:31:03 2010
@@ -100,8 +100,9 @@
 	}
 
 	@Override
-    @SuppressWarnings("unchecked") // Can't use Iterator<FeatureDescriptor> because
API needs to match specification
-    public Iterator getFeatureDescriptors(ELContext context, Object base) {
+    // Can't use Iterator<FeatureDescriptor> because API needs to match specification
+    public @SuppressWarnings("unchecked") Iterator getFeatureDescriptors(
+            ELContext context, Object base) {
 		if (base instanceof ResourceBundle) {
 			List<FeatureDescriptor> feats = new ArrayList<FeatureDescriptor>();
 			Enumeration<String> e = ((ResourceBundle) base).getKeys();

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=898275&r1=898274&r2=898275&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Tue Jan 12 10:31:03
2010
@@ -1788,7 +1788,7 @@
                 defineClass("org.apache.catalina.loader.JdbcLeakPrevention",
                     classBytes, 0, offset);
             Object obj = lpClass.newInstance();
-            @SuppressWarnings("unchecked")
+            @SuppressWarnings("unchecked") // clearJdbcDriverRegistrations() returns List<String>

             List<String> driverNames = (List<String>) obj.getClass().getMethod(
                     "clearJdbcDriverRegistrations").invoke(obj);
             for (String name : driverNames) {
@@ -1812,7 +1812,7 @@
 
     private final void clearReferencesStaticFinal() {
         
-        @SuppressWarnings("unchecked")
+        @SuppressWarnings("unchecked") // resourceEntries is HashMap<String, ResourceEntry>
         Collection<ResourceEntry> values =
             ((HashMap<String,ResourceEntry>) resourceEntries.clone()).values();
         Iterator<ResourceEntry> loadedClasses = values.iterator();
@@ -1934,7 +1934,7 @@
     }
 
 
-    @SuppressWarnings("deprecation")
+    @SuppressWarnings("deprecation") // thread.stop()
     private void clearReferencesThreads() {
         Thread[] threads = getThreads();
         

Modified: tomcat/trunk/java/org/apache/el/lang/ELSupport.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/ELSupport.java?rev=898275&r1=898274&r2=898275&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/lang/ELSupport.java (original)
+++ tomcat/trunk/java/org/apache/el/lang/ELSupport.java Tue Jan 12 10:31:03 2010
@@ -107,12 +107,12 @@
             return coerceToString(obj0).compareTo(coerceToString(obj1));
         }
         if (obj0 instanceof Comparable<?>) {
-            @SuppressWarnings("unchecked")
+            @SuppressWarnings("unchecked") // checked above
             final Comparable<Object> comparable = (Comparable<Object>) obj0;
             return (obj1 != null) ? comparable.compareTo(obj1) : 1;
         }
         if (obj1 instanceof Comparable<?>) {
-            @SuppressWarnings("unchecked")
+            @SuppressWarnings("unchecked") // checked above
             final Comparable<Object> comparable = (Comparable<Object>) obj1;
             return (obj0 != null) ? -comparable.compareTo(obj0) : -1;
         }

Modified: tomcat/trunk/java/org/apache/el/lang/EvaluationContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/EvaluationContext.java?rev=898275&r1=898274&r2=898275&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/lang/EvaluationContext.java (original)
+++ tomcat/trunk/java/org/apache/el/lang/EvaluationContext.java Tue Jan 12 10:31:03 2010
@@ -54,8 +54,8 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked") // Can't use Class<?> because API needs to match
specification in super-class
-    public Object getContext(Class key) {
+    // Can't use Class<?> because API needs to match specification in superclass
+    public Object getContext(@SuppressWarnings("unchecked") Class key) {
         return this.elContext.getContext(key);
     }
 
@@ -70,8 +70,9 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked") // Can't use Class<?> because API needs to match
specification in super-class
-    public void putContext(Class key, Object contextObject) {
+    // Can't use Class<?> because API needs to match specification in superclass
+    public void putContext(@SuppressWarnings("unchecked") Class key,
+            Object contextObject) {
         this.elContext.putContext(key, contextObject);
     }
 

Modified: tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java?rev=898275&r1=898274&r2=898275&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java Tue Jan 12 10:31:03 2010
@@ -91,17 +91,19 @@
         ctx.getELResolver().setValue(ctx, null, this.image, value);
     }
 
-    @SuppressWarnings("unchecked")
     @Override
-    public Object invoke(EvaluationContext ctx, Class[] paramTypes,
+    // Interface el.parser.Node uses raw types (and is auto-generated)
+    public Object invoke(EvaluationContext ctx,
+            @SuppressWarnings("unchecked") Class[] paramTypes,
             Object[] paramValues) throws ELException {
         return this.getMethodExpression(ctx).invoke(ctx.getELContext(), paramValues);
     }
     
 
-    @SuppressWarnings("unchecked")
     @Override
-    public MethodInfo getMethodInfo(EvaluationContext ctx, Class[] paramTypes)
+    // Interface el.parser.Node uses raw types (and is auto-generated)
+    public MethodInfo getMethodInfo(EvaluationContext ctx, 
+            @SuppressWarnings("unchecked") Class[] paramTypes)
             throws ELException {
         return this.getMethodExpression(ctx).getMethodInfo(ctx.getELContext());
     }

Modified: tomcat/trunk/java/org/apache/el/parser/AstValue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstValue.java?rev=898275&r1=898274&r2=898275&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/parser/AstValue.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/AstValue.java Tue Jan 12 10:31:03 2010
@@ -161,9 +161,10 @@
     }
 
 
-    @SuppressWarnings("unchecked")
     @Override
-    public MethodInfo getMethodInfo(EvaluationContext ctx, Class[] paramTypes)
+    // Interface el.parser.Node uses raw types (and is auto-generated)
+    public MethodInfo getMethodInfo(EvaluationContext ctx, 
+            @SuppressWarnings("unchecked") Class[] paramTypes)
             throws ELException {
         Target t = getTarget(ctx);
         Method m = ReflectionUtil.getMethod(t.base, t.property, paramTypes);
@@ -171,9 +172,10 @@
                 .getParameterTypes());
     }
 
-    @SuppressWarnings("unchecked")
     @Override
-    public Object invoke(EvaluationContext ctx, Class[] paramTypes,
+    // Interface el.parser.Node uses a raw type (and is auto-generated)
+    public Object invoke(EvaluationContext ctx, 
+            @SuppressWarnings("unchecked") Class[] paramTypes,
             Object[] paramValues) throws ELException {
         Target t = getTarget(ctx);
         Method m = ReflectionUtil.getMethod(t.base, t.property, paramTypes);

Modified: tomcat/trunk/java/org/apache/el/parser/SimpleNode.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/SimpleNode.java?rev=898275&r1=898274&r2=898275&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/parser/SimpleNode.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/SimpleNode.java Tue Jan 12 10:31:03 2010
@@ -153,15 +153,17 @@
         }
     }
 
-    @SuppressWarnings("unchecked")
-    public Object invoke(EvaluationContext ctx, Class[] paramTypes,
+    // Interface el.parser.Node uses raw types (and is auto-generated)
+    public Object invoke(EvaluationContext ctx, 
+            @SuppressWarnings("unchecked") Class[] paramTypes,
             Object[] paramValues) throws ELException {
         throw new UnsupportedOperationException();
     }
 
-    @SuppressWarnings("unchecked")
+    // Interface el.parser.Node uses a raw type (and is auto-generated)
     public MethodInfo getMethodInfo(EvaluationContext ctx,
-            Class[] paramTypes) throws ELException {
+            @SuppressWarnings("unchecked") Class[] paramTypes)
+            throws ELException {
         throw new UnsupportedOperationException();
     }
 }

Modified: tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java?rev=898275&r1=898274&r2=898275&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java Tue Jan 12 10:31:03
2010
@@ -147,9 +147,8 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked")
-    protected ArrayList list(File file) {
-        ArrayList entries = super.list(file);
+    protected ArrayList<NamingEntry> list(File file) {
+        ArrayList<NamingEntry> entries = super.list(file);
 
         // adds virtual tlds for WEB-INF listing
         if ("WEB-INF".equals(file.getName())) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message