[prev in list] [next in list] [prev in thread] [next in thread] 

List:       velocity-dev
Subject:    Re[2]: svn commit: r449347 - in /jakarta/velocity/engine/trunk:
From:       Alexey Panchenko <alex+news () olmisoft ! com>
Date:       2006-09-28 7:28:54
Message-ID: 1092586542.20060928142854 () olmisoft ! com
[Download RAW message or body]

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:alex+news@olmisoft.com


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic