Steve Ulrich (proemion) wrote:
Emmanuel Lecharny-3 wrote:
Wouldn't be a perfect case for an assert ? Like :

public final WriteFuture write(Object message, SocketAddress remoteAddress) {
        assert message != null : "Null messages are not allowed";
        ...

wdyt ?


NO!
You are right, I'm wrong, and we already discussed that with Trustin. I just picked the wrong example from the code.

The fact that this method is public just slipped oiut of my attention : public method must NOT use assertion to check for arguments. And in this very case, Trustin said that the user may want to get a NPE which will be more easy to manage from the user perspective.

Consider this thread as a dead end and my suggestion as wrong practice.

Thanks for the heads up, Steave, and Happy New Year too !

btw,
wishes += "Do not work too late and post stupid proposals to the mailing list at 1 AM..."



--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to