Bug 120079 - [api] need solution for BindingKey#internalToSignature()
Summary: [api] need solution for BindingKey#internalToSignature()
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.2 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-09 04:18 EST by Martin Aeschlimann CLA
Modified: 2006-02-14 07:30 EST (History)
2 users (show)

See Also:


Attachments

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:18:22 EST
20051209

We should still have an alternative to BindingKey#internalToSignature() which is marked as internal and not to be used outside jdt.core.

The decition to mark the API as internal was done in bug 93105.

In JDT.UI we have to use internalToSignature to access information about 'resolved' Java elements, mainly to show hovers containing type arguments in the hover, type hierarchy and search view.
Comment 1 Jerome Lanneluc CLA 2006-01-17 12:04:10 EST
Would IType#getResolvedSignature() and IMethod#getResolvedSignature() work for you ?
Comment 2 Martin Aeschlimann CLA 2006-01-17 12:41:03 EST
I had a quick look at our usages, and I think that would work. We still keep getKey and BindingKey, right?
Comment 3 Markus Keller CLA 2006-01-17 13:59:40 EST
Sorry, I fear IType/IMember#getResolvedSignature() is not enough for us. Our TypeEnvironment (a lightweight, workspace-wide layer over TypeBindings) only stores type bindings keys and later we use
    ImportRewrite#addImportFromSignature(bindingKey.internalToSignature(), ast)
at a time where the corresponding ITypeBindings are not available any more.

The types we deal with can be complex and they originate from ITypeBindings, not from ITypes. Without a conversion BindingKey -> Signature, we would have to
- ASTParser#createBindings(..) again, which is prohibitively expensive,
or
- store all signatures upfront, which would give a perfomance/memory hit and would be quite tedious for non-trivial bindings, such as wildcards, captures, etc.
Comment 4 Jerome Lanneluc CLA 2006-01-18 04:51:11 EST
Except in the tests, I don't see any usage of ImportRewrite#addImportFromSignature(String, AST) in I20060110. Did I miss anything ?
Comment 5 Jerome Lanneluc CLA 2006-01-18 04:54:21 EST
Forget comment 4. I was not looking at the right ImportRewrite.
Comment 6 Jerome Lanneluc CLA 2006-01-18 05:53:00 EST
I re-read bug 93105, and I don't get why we decided to remove the API that converts a binding key to a signature. Dirk, since you were part of this decision I believe, do you remember the exact reason ?
Comment 7 Dirk Baeumer CLA 2006-01-18 10:09:31 EST
Jerome, I am not sure but what I remember is as follows:

- binding key is a sort of snap shot. You don't have any change to check if
  it still exists, ...

- their was the idea to use binding keys instead of IJavaElement where a more
  light-weight alternative was needed to render them in the UI. Currently 
  we resolve a Java element in some scenarios to render some information.

- we then decided that BindingKey isn't the right ways to go to replace 
  IJavaElements in the UI in a light-weight fashion.

- as a result of this we decided to remove API we added to support this usage
  to not put us into a position where we have to keep this API if we come up
  with a better story in 3.2. All API expect of internalToSignature got removed

But I am not 100% sure about this.
Comment 8 Jerome Lanneluc CLA 2006-01-19 10:17:19 EST
Thanks Dirk. So it looks like we are already in a position where we have to keep this API (see comment 3).

I guess this forces us to make it an official API.
Comment 9 Jerome Lanneluc CLA 2006-01-25 09:57:13 EST
Added BindingKey#toSignature() and deprecated internalToSignature(). 
internalToSignature() will be removed before 3.2 M5.

Updated tests to use toSignature().
Comment 10 Frederic Fusier CLA 2006-02-14 07:30:28 EST
Code verified for 3.2 M5 using build I20060214-0010.