Bug 92373

Summary: [1.5] Can't distinguish capture ITypeBindings by #getKey() or #isEqualTo()
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: dirk_baeumer
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2005-04-22 10:25:37 EDT
v_552a

I can't distinguish capture ITypeBindings by #getKey() or #isEqualTo():
The two references to 'list' below (or their respective type arguments) are
equal by all measures except identity. That makes it impossible to implement
correct assignment rules for our TTypes.

Keys for unequal bindings from the same AST should not be equal.

import java.util.List;
public class Cap {
    List<?> list;
    {
        list.add(list.get(0));
    }
}
Comment 1 Philipe Mulet CLA 2005-04-22 12:07:37 EDT
Indeed, all captures of same param types look the same.
Need to improve. The difficulty is about making these binding keys convertible
into binding again.
Comment 2 Philipe Mulet CLA 2005-04-22 17:19:12 EDT
Jerome - I added 2 slots on CaptureBinding: outermostEnclosingType and position.
Please leverage this info into the bindingKey and binding re-creation (find)
Comment 3 Jerome Lanneluc CLA 2005-04-25 10:16:22 EDT
Changed binding key for CaptureBinding to include the outermostEnclosingType's
key, the wildcard's key and the capture's position.
Changed BindingKeyParser and its subclasses to handle this new format.
Updated test ASTConverterTest#test0089().
Added regression test BatchASTCreationTests#test059().
Comment 4 Frederic Fusier CLA 2005-05-12 07:57:06 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.
(using ASTView to verify that key binding is different for these two references
to 'list'...)