Bug 120082 - Signature is missing capture
Summary: Signature is missing capture
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.5 M1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-09 04:39 EST by Martin Aeschlimann CLA
Modified: 2008-08-06 13:44 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix (913 bytes, patch)
2006-10-10 19:27 EDT, Olivier Thomann CLA
no flags Details | Diff
Regression tests (3.34 KB, patch)
2006-10-10 19:28 EDT, Olivier Thomann CLA
no flags Details | Diff
Same fix and updated tests (5.14 KB, patch)
2008-06-09 12:20 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 Martin Aeschlimann CLA 2005-12-09 04:39:07 EST
20051209

1. create an AST of the following example
package pack1;
public class E<X> {
    public static <T> E<T> bar(T t) { return null; }
    public void foo(E<?> e) {
        bar(e);
    }
}
2. look at the type binding of 'bar(e)'. It is E<E<capture-of-?>>.
3. use String signature= new BindingKey(binding.getKey()).internalToSignature();
  -> signature is Lpack1.E<Lpack1.E<*>;>;
  should probably be
                  Lpack1.E<Lpack1.E<!*>;>;
Comment 1 Olivier Thomann CLA 2006-10-10 14:31:25 EDT
Reproduce with HEAD using toSignature() instead of internalToSignature().
Comment 2 Olivier Thomann CLA 2006-10-10 14:32:52 EDT
The key used for toSignature() is Lpack1/E<Lpack1/E<!Lpack1/E;*122;>;>;.
Comment 3 Olivier Thomann CLA 2006-10-10 19:27:50 EDT
Created attachment 51732 [details]
Proposed fix
Comment 4 Olivier Thomann CLA 2006-10-10 19:28:19 EDT
Created attachment 51733 [details]
Regression tests
Comment 5 Olivier Thomann CLA 2006-10-10 19:30:02 EDT
Jerome,

If the '!' is expected, then we have some boggus regression tests.
See the attached patch for the regression tests.
Please review the patch.
Thanks.
Comment 6 Jerome Lanneluc CLA 2008-05-07 09:33:41 EDT
Need to think more about it. Deferring post 3.4
Comment 7 Jerome Lanneluc CLA 2008-06-09 12:20:08 EDT
Created attachment 104181 [details]
Same fix and updated tests

Fix was correct. My confusion came from the existing BindingKeyTests for wildcard and capture that used an impossible to get binding key. The patch fixes those tests and it adds new test for Signature#toString(...) for captures.
Comment 8 Jerome Lanneluc CLA 2008-06-24 10:37:38 EDT
Fix and tests released for 3.5M1
Comment 9 Olivier Thomann CLA 2008-08-06 13:44:08 EDT
Verified for 3.5M1 using I20080805-1307