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:21:04 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Reading http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html#usage
I have to withdraw my +1 and agree with Stefans objections

On 06/04/10 14:16, Felix Knecht wrote:
> 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/

iEYEARECAAYFAkwI77AACgkQ2lZVCB08qHGVDACfdHyhixrHw/gfZqQXxxiWdok7
3TEAn1o3pr6VinMwDhEt5/G/lNTbQMBK
=zjLR
-----END PGP SIGNATURE-----

Mime
View raw message