Bug 92373 - [1.5] Can't distinguish capture ITypeBindings by #getKey() or #isEqualTo()
Summary: [1.5] Can't distinguish capture ITypeBindings by #getKey() or #isEqualTo()
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-22 10:25 EDT by Markus Keller CLA
Modified: 2005-05-12 07:57 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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'...)