Community
Participate
Working Groups
see related bug 102206 in revision 1.9 of CompletionProposalLabelProvider, this logic was added: case CompletionProposal.TYPE_REF: switch (Signature.getTypeSignatureKind(proposal.getSignature())) { but according to the doc, the signature for a proposal can be null. This is especially true if the proposal is created through this API: CompletionProposal.create(CompletionProposal.TYPE_REF, offset); CompletionProposalLabelProvider should probably default to some generic image for a TYPE_REF that has a null signature.
Hm, CompletionProposal.getSignature says: > For kinds of completion proposals, this method returns null But also states that the signature is available for proposals of kind TYPE_REF: > This field is available for the following kinds of completion proposals: > * TYPE_REF - type signature of the type that is referenced I would expect that the signature is always non-null for proposals of the kinds listed. However, we could probably add a guard for this situation. David (Audel), what is your view on this as the maintainer of this API?
The spec of CompletionProposal#create(int, int) says: > Creates a basic completion proposal. All instance > field have plausible default values unless otherwise noted Currently all default values are 'null' or 0. But the spec of CompletionProposal#getSignature() says: > This field is available for the following kinds of completion proposals: > TYPE_REF - type signature of the type that is referenced My understanding of the spec is that the caller of CompletionProposal#create() must also add all the required values to the proposal. So the signature of a TYPE_REF is always non-null for clients. But i am not totally convinced that my understanding is the correct one. Jim, could you comment this as designer of this API? By reading the spec i also found that my implementation of the spec is not safe. If a CompletionProposal is not created by CompletionEngine then a call to 'findParameterNames' or 'getCompletion' could throw an NPE (see bug 102346).
David, You're correct in your reading. The (internal) party that creates CompletionProposal instances must fill in all the required values.
Then I close this PR - the creator of the proposal must provide a non-null signature for TYPE_REF proposals.