Bug 149590 - [model] bindings for duplicate local variables share same key
Summary: [model] bindings for duplicate local variables share same key
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 155858 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-07-04 11:30 EDT by Markus Keller CLA
Modified: 2007-08-03 10:59 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix and regression tests (13.46 KB, patch)
2007-06-19 12:31 EDT, Jerome Lanneluc CLA
no flags Details | Diff
New proposed fix and regression test (5.61 KB, patch)
2007-07-02 09:48 EDT, Jerome Lanneluc CLA
no flags Details | Diff
Fix *and* tests (previous patch did not contain the tests (11.62 KB, patch)
2007-07-03 05:10 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2006-07-04 11:30:54 EDT
I20060628-1135

The fix for bug 144858 has introduced improved bindings for duplicate local variables. However, there are now cases where bindings share the same key although they are not identical and not isEqualTo(..) each other, e.g. the two 'local' here:

class Try {
    void m() {
        int local;
        System.out.println(local);
        String local;
        System.out.println(local);
    }
}

See also bug 110976 for similar problems inside duplicate methods.
Comment 1 Frederic Fusier CLA 2006-09-25 12:30:50 EDT
*** Bug 155858 has been marked as a duplicate of this bug. ***
Comment 2 Olivier Thomann CLA 2006-11-23 12:18:43 EST
Once fixed, tests org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2#test0660/0663 need to be updated.
Comment 3 Frederic Fusier CLA 2007-06-19 07:53:58 EDT
Reproduced with 3.3 RC4
Comment 4 Jerome Lanneluc CLA 2007-06-19 12:31:47 EDT
Created attachment 71771 [details]
Proposed fix and regression tests

The existing tests have been updated, and the corresponding assertion in test660/663 have been uncommented.
Comment 5 Jerome Lanneluc CLA 2007-06-28 05:49:42 EDT
Fix and tests released for 3.4M1 in HEAD
Comment 6 Jerome Lanneluc CLA 2007-06-28 11:05:43 EDT
Reverted the fix as it breaks the invariant that says that a key can be used to compare bindings from different clusters.
Comment 7 Jerome Lanneluc CLA 2007-07-02 09:48:21 EDT
Created attachment 72870 [details]
New proposed fix and regression test

This fix doesn't use source position, but it uses the occurrence count of the variable in the block.
Comment 8 Jerome Lanneluc CLA 2007-07-03 05:10:02 EDT
Created attachment 72935 [details]
Fix *and* tests (previous patch did not contain the tests
Comment 9 Jerome Lanneluc CLA 2007-07-03 05:15:25 EDT
Fix and tests released for 3.4M1 in HEAD.
Comment 10 Frederic Fusier CLA 2007-08-03 10:59:30 EDT
Verified for 3.4M1 using build I20070802-0800.