Re: [collections] Java5.0 - Runtime exceptions or assertion errors. What's your preference?

2004-11-06 Thread Stephen Colebourne
I think that Sun have got this wrong. They should have mandated IAE, not NPE. In parctice, however, I don't think it makes much difference to client code, since both are unchecked. I intend to throw IAEs throughout collections15, except where the Java Collections interfaces mandate NPEs

Re: [collections] Java5.0 - Runtime exceptions or assertion errors. What's your preference?

2004-11-05 Thread Stephen Colebourne
[EMAIL PROTECTED] To: Jakarta Commons Developers List [EMAIL PROTECTED] Sent: Friday, November 05, 2004 3:54 AM Subject: Re: [collections] Java5.0 - Runtime exceptions or assertion errors. What's your preference? David Graham wrote: The main reason not to use assertions is that they can be disabled

Re: [collections] Java5.0 - Runtime exceptions or assertion errors. What's your preference?

2004-11-05 Thread Chris Lambrou
Hi, As much as I'd like to replace all of the existing parameter checks with assertions, I think that the current method of having explicit parameter checking on all public methods will have to stand. Many thanks to you all for your useful input. I thought that for the sake of completeness,

[collections] Java5.0 - Runtime exceptions or assertion errors. What's your preference?

2004-11-04 Thread Chris Lambrou
Hi, Although I've marked the subject with [collections], I guess this is targeted at anyone who has an interest in a Java 5.0 port of any jakarta project. I'm slowly chipping away at a Java 5.0 port of commons-collections. As I've been generifying the original collections classes, I've found

Re: [collections] Java5.0 - Runtime exceptions or assertion errors. What's your preference?

2004-11-04 Thread Frank W. Zammetti
It is an accepted usage pattern that assertions are not to be used to validate method parameters if they are part of the public interface. They are properly used to check parameters passed to private members though, but nothing a calling client might send in (where a client isn't another part

Re: [collections] Java5.0 - Runtime exceptions or assertion errors. What's your preference?

2004-11-04 Thread David Graham
The main reason not to use assertions is that they can be disabled at runtime, rendering them fairly useless IMO. Personally, I would remove the null parameter checking entirely and let the code throw a NPE. The caller will see their offending method in the stack trace. David --- Chris Lambrou

Re: [collections] Java5.0 - Runtime exceptions or assertion errors. What's your preference?

2004-11-04 Thread Martin Cooper
On Thu, 4 Nov 2004 18:19:32 -0800 (PST), David Graham [EMAIL PROTECTED] wrote: The main reason not to use assertions is that they can be disabled at runtime, rendering them fairly useless IMO. Personally, I would remove the null parameter checking entirely and let the code throw a NPE. The

Re: [collections] Java5.0 - Runtime exceptions or assertion errors. What's your preference?

2004-11-04 Thread matthew.hawthorne
David Graham wrote: The main reason not to use assertions is that they can be disabled at runtime, rendering them fairly useless IMO. I think this was a fundamental goal of assertions. I imagine that the idea is to enable assertions during heavy development time, and disable them once the code