Emmanuel Lecharny-3 wrote:
>
> While looking at the abstract class, I found some methods with this kind
> of code :
>
> public final WriteFuture write(Object message, SocketAddress
> remoteAddress) {
> if (message == null) {
> throw new NullPointerException("message");
> }
> ...
>
> 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!
There are recommendations from SUN, which tells you where to use assert and
where not. Method arguments checking per assert is definitive a no-go!
http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html#usage
http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html#usage
(See first point!)
regards and a happy new year,
Steve
--
View this message in context:
http://www.nabble.com/AbstractIoSession-and-final-qualifiers-tp14507695s16868p14574728.html
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.