Author: ebourg Date: Wed Feb 4 21:53:42 2015 New Revision: 1657412 URL: http://svn.apache.org/r1657412 Log: Removed the 'index' variable from the LocalVariableGen's hash code, thanks to Mark Roberts (BCEL-194)
Modified: commons/proper/bcel/trunk/RELEASE-NOTES.txt commons/proper/bcel/trunk/src/changes/changes.xml commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/LocalVariableGen.java Modified: commons/proper/bcel/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/RELEASE-NOTES.txt?rev=1657412&r1=1657411&r2=1657412&view=diff ============================================================================== --- commons/proper/bcel/trunk/RELEASE-NOTES.txt (original) +++ commons/proper/bcel/trunk/RELEASE-NOTES.txt Wed Feb 4 21:53:42 2015 @@ -96,6 +96,7 @@ Bug fixes from 5.2 [BCEL-174] Verification of interfaces with default methods fails with Java 8 [BCEL-177] MethodParameters should read 1 byte not two for parameter count [BCEL-181] ClassLoaderRepository.loadClass(String) leaks input streams +[BCEL-194] LocalVariableGen hashCode() function is incorrrect Feedback Modified: commons/proper/bcel/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/changes/changes.xml?rev=1657412&r1=1657411&r2=1657412&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/changes/changes.xml (original) +++ commons/proper/bcel/trunk/src/changes/changes.xml Wed Feb 4 21:53:42 2015 @@ -63,6 +63,9 @@ The <action> type attribute can be add,u <body> <release version="6.0" date="TBA" description="Major release with Java 7 and 8 support"> + <action issue="BCEL-194" type="fix" due-to="Mark Roberts"> + Removed the 'index' variable from the LocalVariableGen's hash code. + </action> <action issue="BCEL-186" type="fix" dev="sebb"> Performance degradation with the UTF8 cache getInstance no longer uses cache Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/LocalVariableGen.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/LocalVariableGen.java?rev=1657412&r1=1657411&r2=1657412&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/LocalVariableGen.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/LocalVariableGen.java Wed Feb 4 21:53:42 2015 @@ -172,13 +172,11 @@ public class LocalVariableGen implements } - /** @return a hash code value for the object. - */ @Override 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(); - return hc; + // If the user changes the name or type, problems with the targeter hashmap will occur. + // Note: index cannot be part of hash as it may be changed by the user. + return name.hashCode() ^ type.hashCode(); }