You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mc...@apache.org on 2011/10/16 23:11:12 UTC

svn commit: r1184934 - in /commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry: DeclaredMethodCacheEntry.java MethodCacheEntry.java

Author: mcucchiara
Date: Sun Oct 16 21:11:12 2011
New Revision: 1184934

URL: http://svn.apache.org/viewvc?rev=1184934&view=rev
Log:
Equals and HashCode method must count on type property

Modified:
    commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntry.java
    commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntry.java

Modified: commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntry.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntry.java?rev=1184934&r1=1184933&r2=1184934&view=diff
==============================================================================
--- commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntry.java (original)
+++ commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntry.java Sun Oct 16 21:11:12 2011
@@ -41,10 +41,6 @@ public class DeclaredMethodCacheEntry
 
         DeclaredMethodCacheEntry that = (DeclaredMethodCacheEntry) o;
 
-        if ( type != that.type )
-        {
-            return false;
-        }
         if ( targetClass != that.targetClass )
         {
             return false;
@@ -55,9 +51,8 @@ public class DeclaredMethodCacheEntry
     @Override
     public int hashCode( )
     {
-        int result = targetClass.hashCode( );
-        if(type!=null)
-            result = 31 * result + type.hashCode();
+        int result = super.hashCode( );
+        result = 31 * result + ( type != null ? type.hashCode( ) : 0 );
         return result;
     }
 }

Modified: commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntry.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntry.java?rev=1184934&r1=1184933&r2=1184934&view=diff
==============================================================================
--- commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntry.java (original)
+++ commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntry.java Sun Oct 16 21:11:12 2011
@@ -13,4 +13,32 @@ public class MethodCacheEntry implements
     {
         this.targetClass = targetClass;
     }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( !( o instanceof MethodCacheEntry ) )
+        {
+            return false;
+        }
+
+        MethodCacheEntry that = (MethodCacheEntry) o;
+
+        if ( !targetClass.equals( that.targetClass ) )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode( )
+    {
+        return targetClass.hashCode( );
+    }
 }