Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31597
| From | j4n bur53 <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Abuse of AssertionError? |
| Date | 2015-04-21 16:59 +0200 |
| Organization | albasani.net |
| Message-ID | <mh5okk$jsi$1@news.albasani.net> (permalink) |
| References | <mh5gl0$96t$1@dont-email.me> |
Eric Sosman schrieb:
> My solution has been to write
>
> throw new AssertionError("BUG!");
1) It depends on the context that runs the code.
For example sometimes I throw:
throw new RuntimeException()
In such situation, and in my particular case
I know that the context will not catch it,
resulting probably in an application abort.
2) On the other hand sometimes I throw:
throw new IllegalArgumentException();
But I don't need to declare this exception
either in the method signature. But it
could be that the context catches this.
3) Or sometimes I use an exception that is
clearly visible in the method signature,
and forces the context to act.
I guess you want scenario 1) ?
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Abuse of AssertionError? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-04-21 08:44 -0400
Re: Abuse of AssertionError? Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-21 10:21 -0400
Re: Abuse of AssertionError? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-04-21 11:21 -0400
Re: Abuse of AssertionError? Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-21 11:31 -0400
Re: Abuse of AssertionError? j4n bur53 <janburse@fastmail.fm> - 2015-04-21 16:59 +0200
Re: Abuse of AssertionError? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-04-21 11:26 -0400
Re: Abuse of AssertionError? Thomas Richter <thor@math.tu-berlin.de> - 2015-04-21 17:05 +0200
csiph-web