Bug 30607 - [Viewers] CustomHashtable.put should change key even if an entry under that key already exists.
Summary: [Viewers] CustomHashtable.put should change key even if an entry under that k...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nick Edgar CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-30 09:54 EST by Dirk Baeumer CLA
Modified: 2003-01-31 14:08 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2003-01-30 09:54:40 EST
Build 20030129

The current implementation of the custom hashtable doesn't adjust the key if an 
entry with the same hash value already exists. IMO the following statement is 
missing:

if (entry == null) {
  ...
}
Object result = entry.value;
entry.key = key;                  <=== missing statement
entry.value = value;

Otherwise the hash table might hang on "old" keys which could be garbage 
collect. Additionally it is confusing to see "wrong" keys in the hash table.

In JDT the hash table kept a pointer to a working copy element although it 
could be garbage collected since we exchanged the element with the original.
Comment 1 Nick Edgar CLA 2003-01-31 14:08:42 EST
Good catch.  Fixed.