On Mon, 21 Oct 2002, Paul Cantrell wrote:
> JDK 1.4's assertion facilities make most of Ola's examples too trivial > to warrant helper methods, IMO -- the following all seem quite clear > and concise : > > assert object != null; Yeah, one reason for Ola's suggestion would be to offer similar functionality to JDK 1.3 and before users. > However, the Java version has a big advantage: In the latter example, > the code will *always* call elements.toString() -- even if the > assertion succeeds, and even if assertions are turned off! The Java > native version doesn't evalutate the condition unless assertions are > enabled, and doesn't evaluate the message unless the assertion fails. Yeah, I think it'd be accepted that people would gain better performance using 1.4. When Lang becomes 1.4 dependent, thigns could be deprecated and/or refactored. > > The only one of the examples in Ola's message that isn't trivial with > 1.4's assert is "noNullElements". If there is actually a need for > assert utilities, it's for deeper structural checks like that. A good thing to focus on then. We'd need to have a good mental separation between things that would deprecate obviously at 1.4 and things that would refactor at 1.4. > Henri: Java assertions throw AssertionError. JUnit does provide some > basic assertion facilities, but only for test classes. > Then rather than throwing IllegalArgumentException I would suggest we throw something closer to that. Either AssertionError, or more likely AssertError or something. Close enough to feel the same, but not enough to clash. Hen -- To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:commons-dev-help@;jakarta.apache.org>
