Community
Participate
Working Groups
An iteration such as a->collect(b)->collect(c) is required to crash (return invalid) if any b is a null valued object, whereas the same traversal would just skip over the 'problem' wherever b is an empty collection. This is confusing to users since the failure is a data-dependent run-time phenomenon. The iteration should be rewritten as a->collect(b)->excluding(null)->collect(c). This hazard can be statically detected and so should provoke a compiler warning. However suppression of the warning is not so easy since for aCollection->collect(c) a warning may be required unless it can be statically determined that aCollection is null-free, which will not always be possible. Probably better to warn. User can put in a gratuitous excluding(null) particularly if we optimize it to execute in place or even cache non-nullness.