Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333654

Summary: AIOOBE in IdentityHashSet.getInsertionIndex(*)
Product: [Eclipse Project] JDT Reporter: Paul Webster <pwebster>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, remy.suen
Version: 3.7   
Target Milestone: 3.7 M5   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Fix none

Description Paul Webster CLA 2011-01-06 09:12:23 EST
On of the test teams reported intermittent failures from ArrayIndexOutOfBoundsExceptions on 64 bit JVMs in
org.eclipse.jdt.ui.leaktest.reftracker.IdentityHashSet.getInsertionIndex(Object, Object[]).

It seems System.identityHashCode(*) is returning an extremely large number, which results in the modulo being negative.  It should probably be protected against numbers larger than 0x7FFFFFFF

PW
Comment 1 Dani Megert CLA 2011-01-06 09:19:18 EST
Paul, we need
- the exact VM
- the build id
Comment 2 Markus Keller CLA 2011-01-06 12:37:56 EST
Created attachment 186200 [details]
Fix

Yeah, makes sense. My VMs don't produce such high (low) identity hash codes, but the problem is easily reproducible when you replace
    System.identityHashCode(x)
with
    (0x80000000 | System.identityHashCode(x))
Comment 3 Markus Keller CLA 2011-01-06 12:45:04 EST
Fixed in HEAD.