Will Glass-Husain wrote:

> I'll take responsibility to work with Alexey in cleaning this up.
> Though to be fair, you are holding the patch to a higher standard than
> the original.  Of course the original had a bug.

I have added the following patch to VELOCITY-453

It is small patch, so it could be applied quickly.

The changes are:
- private String methodName
- MethodCacheKey is a static class

Index: ASTMethod.java
===================================================================
--- ASTMethod.java      (revision 450716)
+++ ASTMethod.java      (working copy)
@@ -46,7 +46,7 @@
  */
 public class ASTMethod extends SimpleNode
 {
-    protected String methodName = "";
+    private String methodName = "";
     private int paramCount = 0;
 
     /**
@@ -143,7 +198,7 @@
              *   check the cache
              */
 
-            MethodCacheKey mck = new MethodCacheKey(paramClasses);
+            MethodCacheKey mck = new MethodCacheKey(methodName, paramClasses);
             IntrospectionCacheData icd =  context.icacheGet( mck );
 
             /*
@@ -317,20 +338,17 @@
      * Internal class used as key for method cache.  Combines
      * ASTMethod fields with array of parameter classes.
      */
-    class MethodCacheKey
+    private static class MethodCacheKey
     {
-        Class[] params;
+        private final String methodName;  
+        private final Class[] params;
 
-        MethodCacheKey(Class[] params)
+        private MethodCacheKey(String methodName, Class[] params)
         {
+            this.methodName = methodName;
             this.params = params;
         }
 
-        private final ASTMethod getASTMethod() 
-        {
-            return ASTMethod.this;
-        }
-        
         /**
          * @see java.lang.Object#equals(java.lang.Object)
          */
@@ -339,7 +357,7 @@
             if (o instanceof MethodCacheKey) 
             {
                 final MethodCacheKey other = (MethodCacheKey) o;            
-                if (params.length == other.params.length && 
methodName.equals(other.getASTMethod().methodName)) 
+                if (params.length == other.params.length && 
methodName.equals(other.methodName)) 
                 {              
                     for (int i = 0; i < params.length; ++i) 
                     {

-- 
Best regards,
 Alexey                            mailto:[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to