commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (BCEL-194) LocalVariableGen hashCode() function is incorrrect.
Date Wed, 04 Feb 2015 21:44:34 GMT

     [ 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)

Mime
View raw message