You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/01/10 14:11:52 UTC

svn commit: r897635 - in /tomcat/trunk/java/org/apache/el/parser: AstIdentifier.java AstValue.java SimpleNode.java

Author: markt
Date: Sun Jan 10 13:11:52 2010
New Revision: 897635

URL: http://svn.apache.org/viewvc?rev=897635&view=rev
Log:
Fix the remaining Eclipse warnings in the non-generated classes

Modified:
    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

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=897635&r1=897634&r2=897635&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java Sun Jan 10 13:11:52 2010
@@ -91,6 +91,7 @@
         ctx.getELResolver().setValue(ctx, null, this.image, value);
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public Object invoke(EvaluationContext ctx, Class[] paramTypes,
             Object[] paramValues) throws ELException {
@@ -98,6 +99,7 @@
     }
     
 
+    @SuppressWarnings("unchecked")
     @Override
     public MethodInfo getMethodInfo(EvaluationContext ctx, Class[] paramTypes)
             throws ELException {

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=897635&r1=897634&r2=897635&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/parser/AstValue.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/AstValue.java Sun Jan 10 13:11:52 2010
@@ -142,9 +142,11 @@
         Class<?> targetClass = resolver.getType(ctx, t.base, t.property);
         if (COERCE_TO_ZERO == true
                 || !isAssignable(value, targetClass)) {
-            value = ELSupport.coerceToType(value, targetClass);
+            resolver.setValue(ctx, t.base, t.property,
+                    ELSupport.coerceToType(value, targetClass));
+        } else {
+            resolver.setValue(ctx, t.base, t.property, value);
         }
-        resolver.setValue(ctx, t.base, t.property, value);
     }
 
     private boolean isAssignable(Object value, Class<?> targetClass) {
@@ -159,6 +161,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     @Override
     public MethodInfo getMethodInfo(EvaluationContext ctx, Class[] paramTypes)
             throws ELException {
@@ -168,6 +171,7 @@
                 .getParameterTypes());
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public Object invoke(EvaluationContext ctx, Class[] paramTypes,
             Object[] paramValues) throws ELException {

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=897635&r1=897634&r2=897635&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/parser/SimpleNode.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/SimpleNode.java Sun Jan 10 13:11:52 2010
@@ -45,9 +45,11 @@
     }
 
     public void jjtOpen() {
+        // NOOP by default
     }
 
     public void jjtClose() {
+        // NOOP by default
     }
 
     public void jjtSetParent(Node n) {
@@ -151,11 +153,13 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     public Object invoke(EvaluationContext ctx, Class[] paramTypes,
             Object[] paramValues) throws ELException {
         throw new UnsupportedOperationException();
     }
 
+    @SuppressWarnings("unchecked")
     public MethodInfo getMethodInfo(EvaluationContext ctx,
             Class[] paramTypes) throws ELException {
         throw new UnsupportedOperationException();



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


Re: svn commit: r897635 - in /tomcat/trunk/java/org/apache/el/parser: AstIdentifier.java AstValue.java SimpleNode.java

Posted by sebb <se...@gmail.com>.
On 10/01/2010, markt@apache.org <ma...@apache.org> wrote:
> Author: markt
>  Date: Sun Jan 10 13:11:52 2010
>  New Revision: 897635
>
>  URL: http://svn.apache.org/viewvc?rev=897635&view=rev
>  Log:
>  Fix the remaining Eclipse warnings in the non-generated classes
>
>  Modified:
>     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
>
>  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=897635&r1=897634&r2=897635&view=diff
>  ==============================================================================
>  --- tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java (original)
>  +++ tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java Sun Jan 10 13:11:52 2010
>  @@ -91,6 +91,7 @@
>          ctx.getELResolver().setValue(ctx, null, this.image, value);
>      }
>
>  +    @SuppressWarnings("unchecked")
>      @Override
>      public Object invoke(EvaluationContext ctx, Class[] paramTypes,
>              Object[] paramValues) throws ELException {
>  @@ -98,6 +99,7 @@
>      }
>

May I suggest that the annotation is applied to the parameter only,
and a comment added as to why it was used?

For example:

    @Override
    public Object invoke(EvaluationContext ctx,
            @SuppressWarnings("unchecked") // Interface uses a raw type
            Class[] paramTypes,
            Object[] paramValues) throws ELException {
        return this.getMethodExpression(ctx).invoke(ctx.getELContext(),
paramValues);
    }

I can provide patches if you prefer.

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