Community
Participate
Working Groups
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.
Would IType#getResolvedSignature() and IMethod#getResolvedSignature() work for you ?
I had a quick look at our usages, and I think that would work. We still keep getKey and BindingKey, right?
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.
Except in the tests, I don't see any usage of ImportRewrite#addImportFromSignature(String, AST) in I20060110. Did I miss anything ?
Forget comment 4. I was not looking at the right ImportRewrite.
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 ?
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.
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.
Added BindingKey#toSignature() and deprecated internalToSignature(). internalToSignature() will be removed before 3.2 M5. Updated tests to use toSignature().
Code verified for 3.2 M5 using build I20060214-0010.