Code review: 7012540 (java.util.Objects.nonNull() incorrectly named)
jeffhain at rocketmail.com
Wed Jan 26 15:37:59 UTC 2011
As Ulf said, I think "requireNonNull" could be the name of a method that just
checks that the specified reference is not null, and would not return anything
(even though we could rather use "checkNonNull" in that case, and make it
return true if non null).
Though, "notNullChecked" or "nonNullChecked" might seem to suppose
that the non-nullity of the specified value has already being checked.
A more appropriate name would be "checkNonNullAndReturnIt", but it's too
I'm considering "beingNonNull" as an alternative, for "beingNonNull(x)" contains
the idea that it is still "x", i.e. that it normally returns "x", and that it
to be non null, i.e. that it checks it.
Also, the passive form "being" contains the idea that we don't change anything
An alternative to this alternative would be "notBeingNull", which would be more
pair with methods like "beingPrime"/"notBeingPrime" ("beingNonPrime" looking
weird to me).
Though, verbs in passive form in methods names might look strange to a lot of
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the core-libs-dev