Community
Participate
Working Groups
Due to the limitation of isAssignmentCompatible being limited to bindings form the same compiler context, JDT/UI implemented some helper class to do this checks accross compiler contexts. To provide a efficient implementation I had to hardcode the binding key for the following types: - all primitives, including void and null - all "box" primitives (e.g. Integer, Double, ...) - Object, Serializable, Cloneable Could this key somewhere be specified or could the key in general be specified so that I will not be tricked by key changes. I would be OK for me to know that the keys for these types will not change in the future.
A loose spec is preferrable until we have consolidated our implementation (as we may discover further issues). However, how about helper methods on Signature to decode them ?
Having methods on Signature to create them would be fine as well. For the primitive types I already use class Singnature.
Having API to create binding keys is getting more important. We need this for the type implementation we did for refactoring to not hold onto bindings (memory consumption). The API to create keys has to support type parameters, wildcards, arrays and parameterized types as well.
Dirk, do you have the signatures of these types in your hand ? Or do you want to create the binding keys from a fully qualified name ?
[Dirk is not here today, so I'd like to jump in.] Comment 3 requests API to make new binding keys out of existing binding keys. The use case is like this: 1. I have a type binding for type XY and store its binding key -> xyKey 2. I'd like to have a binding key for the type XY[] -> xyArrayKey (the new API should allow to add the array dimensions to the key) 3. I compare xyArrayKey with other binding keys, and I may eventually convert the key back to an ITypeBinding in a compiler loop. The same should be possible for e.g. parameterized types: I have a base type (as key) and type arguments (keys, too) and I want to combine them into a key for BaseType<TypeArg1, TypeArg2, ..>.
I also need to create binding keys from fully qualified names at least for Object, Serializable, Clonaeble, the base types and the corresponding boxed types.
Added API BindingKey#createTypeBindingKey(String typeName). Added tests BindingKeyTests#test015() to testo17().
Added API BindingKey#createParameterizedTypeBindingKey(String genericTypeKey, String[] argumentTypeKeys) to create a parameterized or raw type binding key. Added tests BindingKeyTests#test018() to testo19().
Added API BindingKey#createArrayTypeBindingKey(String typeKey, int arrayDimension) to create an array type binding key. Added tests BindingKeyTests#test020() to test021().
Added API BindingKey#createWildcardTypeBindingKey(String typeKey, char kind) to create a wildcard type binding key. Added tests BindingKeyTests#test022() to test024().
Do you need to create type variable binding keys ?
> Do you need to create type variable binding keys ? Yes, please. I think that would be convenient too. And from looking at your pace, that shouldn't be too complicated to add, right ;-).
The pace is high because the implementation is very naive. I certainly will have to go back to those when you enter bugs in the future :-)
Added API BindingKey#createTypeVariableBindingKey(String typeVariableName, String declaringKey) to create a type variable binding key. Added tests BindingKeyTests#test025() to test026().
Verified in I20050330-0500
*** Bug 87725 has been marked as a duplicate of this bug. ***