Community
Participate
Working Groups
3.1m6 Given some information is cached on certain elements, this info should be transparently used to answer questions from clients; instead of requiring clients to check for resolution. (where it makes sense)
if (getFlag(flags, T_TYPE_PARAMETERS)) { BindingKey key= new BindingKey(type.getKey()); if (getFlag(flags, USE_RESOLVED) && type.isResolved() && key.isParameterizedType()) { String[] typeArguments= key.getTypeArguments(); getTypeArgumentSignaturesLabel(typeArguments, flags, buf); } else { try { getTypeParametersLabel(type.getTypeParameters(), flags, buf); } catch (JavaModelException e) { // ignore } } } Here is a code snippet how we would then render ITypes. One additional question I have is: what would isResolved answer in the case where the key has only information "identical" to the type itself (e.g. no type argument information).
Re your code snippet: it looks weird to me that if you ask for type parameters, your return type arguments. Once this bug is fixed, you should be able to ask for IType#getTypeArguments() without opening the type (if the type is resolved). If the key has has only information "identical" to the type itself, it would answer true anyway, but getTypeParameters() would return an empty array.
Agree that T_TYPE_PARAMETERS is misleading. What the constant means is type parameters for generic types and type arguments for parameterized types. We don't distinguish between them in the UI (rendering wise).
The information in the binding key becomes obsolete as soon as the underlying source changes. If we transparently use this binding key, we will return obsolete information. A client that is aware of the binding key can use it to get the resolved information (using the BindingKey's helper methods). Other clients should not be affected and see the updated information.