[ 
https://issues.apache.org/jira/browse/BCEL-194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emmanuel Bourg updated BCEL-194:
--------------------------------
    Description: The BCEL API allows a user to change the location of a local 
variable.  Thus, using 'index' as part of the hash function is incorrect.  
(was: The BCEL API allows a user to change the location of a local variable.  
Thus, using 'index' as part of the hash function is incorrect.

(don't see how to attach a diff so I include it here until I figure out how to 
use jira - sorry)

Index: LocalVariableGen.java
===================================================================
--- LocalVariableGen.java       (revision 1651903)
+++ LocalVariableGen.java       (working copy)
@@ -178,5 +178,6 @@
     public int hashCode() {
         //If the user changes the name or type, problems with the targeter 
hashmap will occur
-        int hc = index ^ name.hashCode() ^ type.hashCode();
+        // Note: index cannot be part of hash as it may be changed by the 
user.  (markro)
+        int hc = name.hashCode() ^ type.hashCode();
         return hc;
     }
)

> LocalVariableGen hashCode() function is incorrrect.
> ---------------------------------------------------
>
>                 Key: BCEL-194
>                 URL: https://issues.apache.org/jira/browse/BCEL-194
>             Project: Commons BCEL
>          Issue Type: Bug
>            Reporter: Mark Roberts
>         Attachments: LocalVariableGen.diff
>
>
> The BCEL API allows a user to change the location of a local variable.  Thus, 
> using 'index' as part of the hash function is incorrect.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to