Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: can't throw Date: Sun, 16 Sep 2012 22:36:00 +0200 Lines: 27 Message-ID: References: <19af6b94-7a1e-4491-afb2-79782406f560@googlegroups.com> <504fe3a6$0$293$14726298@news.sunsite.dk> <4NmdnaSmEpADlMvNnZ2dnUVZ7oWdnZ2d@giganews.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net R+MIOVL9/OVZ4/Hgkr64SwnbjLHffLinGKas3PjHMsqei5IOEBLulr/UnyTiiKbA8= Cancel-Lock: sha1:IFP/LfR8XM/wD3zrRvGITJjzT68= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 In-Reply-To: <4NmdnaSmEpADlMvNnZ2dnUVZ7oWdnZ2d@giganews.com> Xref: csiph.com comp.lang.java.programmer:18793 On 16.09.2012 19:17, Leif Roar Moldskred wrote: > Plain catch statements, "catch ( SomeException ex )", only catches > checked exceptions and it's illegal to have a plain catch statement > for an exception that can not be thrown (checked) in the try > block. > > "Catch unchecked" catches both checked and unchecked versions of the > exception. Having only an unchecked catch for a given exception that > can be thrown checked in the try block is legal, but causes a compiler > warning: the preferred is to have two separate catch statements for > checked and unchecked versions of that exception. > > It's not foolproof (fools are just so darned clever at times), but it > strikes me as safe enough to be practical. My point was not that it can't be made "safe". I rather questioned whether the additional complexity introduced in the language would be beneficial (even if we let compatibility issues aside for the moment). Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/