harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r674816 - /harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java
Date Tue, 08 Jul 2008 13:29:52 GMT
Author: sjanuary
Date: Tue Jul  8 06:29:51 2008
New Revision: 674816

URL: http://svn.apache.org/viewvc?rev=674816&view=rev
Log:
Apply patch for HARMONY-5899 ([classlib][pack200] ByteCode.equals() can be optimized)

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java?rev=674816&r1=674815&r2=674816&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java
Tue Jul  8 06:29:51 2008
@@ -66,18 +66,7 @@
     }
 
     public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (obj == null)
-            return false;
-        if (getClass() != obj.getClass())
-            return false;
-        final ByteCode other = (ByteCode) obj;
-        if (getByteCodeForm() != other.getByteCodeForm())
-            return false;
-        if (rewrite != other.rewrite)
-            return false;
-        return true;
+    	return this == obj;
     }
 
     public void extractOperands(OperandManager operandManager, Segment segment,
@@ -116,11 +105,11 @@
     }
 
     public int hashCode() {
-        final int prime = 31;
+        final int prime = 41;
         int result = 1;
-        result = prime * result + getByteCodeForm().hashCode();
+        result = prime * result + getName().hashCode() + getByteCodeForm().hashCode();
         // Don't forget to take the operands = rewrite into account
-        result += rewrite.hashCode();
+        result += (prime * rewrite.hashCode());
         return result;
     }
 



Mime
View raw message