Re: Use of AssertionError
- From: Lew <lew@xxxxxxxxxxxxx>
- Date: Mon, 31 Dec 2007 10:37:13 -0500
Patricia Shanahan wrote:
Eric Sosman wrote:Daniel Pitts wrote:[...]
You'll get a compiler error if you use assert false; Left up as an exercise for the reader.
Okay, I've exercised until I got cramps in my thinking
muscle, but I got no compiler errors. Could you elucidate?
If you simply replaced the throw with an assertion, with no other
changes, there would be a fall-through path to the end of the method,
not permitted in a method that returns a result.
That's why there's an exception toss after the 'assert' in the example I provided.
--
Lew
.
- References:
- Use of AssertionError
- From: Joshua Cranmer
- Re: Use of AssertionError
- From: Lew
- Re: Use of AssertionError
- From: Daniel Pitts
- Re: Use of AssertionError
- From: Daniel Pitts
- Re: Use of AssertionError
- From: Eric Sosman
- Use of AssertionError
- Prev by Date: Re: the MI 5 spammer
- Next by Date: Re: the MI 5 spammer
- Previous by thread: Re: Use of AssertionError
- Next by thread: Re: Use of AssertionError
- Index(es):
Relevant Pages
|
|