Viewer, ISelection, and non-null-element contract [message #721646] |
Fri, 02 September 2011 12:12 |
Eclipse User |
|
|
|
Originally posted by:
Several parts of the Viewer API seem to assume that the contained
elements (in a selection or in the Viewer) cannot be null values. E.g.
the StructuredSelection constructor requires this for it's input or
StructuredViewer#getRawChildren does validate this. But these are either
internal checks or documentation for some very specific implementation
(StructuredSelection) and what I'm missing is a more general contract
that applies to e.g. for IStructuredSelection and
IStructuredContentProvider (or at least on a viewer level) and the like
to return elements that are not null. The lack of this contract has the
effect that third-party implementations of Viewers or selection
providers can easily lead to NPE that are produce deep within some
internal Eclipse machinery (my last example: The object contribution
evaluation) and which is hard to track down to the actual root of the
problem.
Is my assumption correct in regard to this implied contract?
If so, I would strongly argue in favour for a documentation of this
contract as part of the interfaces or abstract types, not only for some
specific implementations.
Thanks & Greetings from Bremen,
Daniel Krügler
|
|
|
Powered by
FUDForum. Page generated in 0.02522 seconds