Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: can't throw Date: Tue, 11 Sep 2012 13:34:52 -0700 Organization: A noiseless patient Spider Lines: 15 Message-ID: References: <19af6b94-7a1e-4491-afb2-79782406f560@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 11 Sep 2012 20:34:53 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="20754"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GeHUKAZ9yoIZLPzgKP11IBJI6nidfzsI=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0 In-Reply-To: <19af6b94-7a1e-4491-afb2-79782406f560@googlegroups.com> Cancel-Lock: sha1:EZ/gAqLmtjG4ZCB8UI1bGxp8UwM= Xref: csiph.com comp.lang.java.programmer:18648 On 9/11/2012 1:16 PM, bob smith wrote: > Am I the only one who wanted to throw an Exception but couldn't > because I was overriding a method that threw nothing? > > In particular, I'm subclassing Thread and can't throw an Exception in > the run method. I suspect this is a more general issue though. > Not really. Either modify the signature of the parent class, or throw a subclass of RuntimeException. Easy-peasy. Never throw RuntimeException directly; it'll mean nothing to you or anyone else reading a stack trace. Always throw some subclass with a meaningful type.