directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Knecht <fel...@apache.org>
Subject Re: Should we use assert ?
Date Fri, 04 Jun 2010 12:16:53 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/04/10 12:15, Emmanuel Lecharny wrote:
> Hi guys,
> 
> currently (and probably because nobody uses them, due to some Java 1.3
> habits we have), we don't use asserts to do simple things like checking
> methods parameters (pre-conditions).
> 
> Should we start using them ?

+1
Just make sure, that assert isn't used in places where it's
shared/apacheds/... specific as an AssertationError is thrown in case.
What about error messages? Do we need them here? If so it can blow up
the code, just imagine something like
assert ( ( value instanceof String ) || ( value instanceof byte[] ) ) :
"String or byte[] expected instead of " + value.getClass()


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwI7rUACgkQ2lZVCB08qHEFLQCfSzuVCIOGenudn7TExxLO/2EL
7JIAoIOuHtV2fqafEsVQLnkTjo+mFEpZ
=QAuM
-----END PGP SIGNATURE-----

Mime
View raw message