svn commit: r231532 - /jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
Author: dbrosius
Date: Thu Aug 11 15:53:03 2005
New Revision: 231532

URL: http://svn.apache.org/viewcvs?rev=231532&view=rev
Log:
remove start and end hashing from LocalVariableGen's hashCode, as these values are changed after this LocalVariableGen is added to a HashMap. Change hashCode to be based on index, name and type. These means the problem still occurs if a change is made to the name or type. But this 'might' happen, as opposed to start/end absolutely happening. -- A real fix should be developed in the future.

Modified:
    jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java?rev=231532&r1=231531&r2=231532&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java Thu Aug 11 15:53:03 2005
@@ -142,11 +142,8 @@
   /** @return a hash code value for the object.
    */
   public int hashCode() { 
-    int hc = index;
-    if (start != null)
-      hc ^= start.hashCode();
-    if (end != null) 
-      hc ^= end.hashCode();
+	//If the user changes the name or type, problems with the targeter hashmap will occur
+    int hc = index ^ name.hashCode() ^ type.hashCode();
     return hc;
   }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.