tag:blogger.com,1999:blog-6136151974836877051.post5483868410864281634..comments2024-03-23T06:21:32.833-04:00Comments on Raja Kannappan's Blog: New Features in Java 7 (Dolphin)Rajahttp://www.blogger.com/profile/07749555177730926480noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-6136151974836877051.post-60117635500518748042011-02-23T18:14:34.040-05:002011-02-23T18:14:34.040-05:00Hey thanks for your valuable information.Defintely...Hey thanks for your valuable information.Defintely found informational.<br />NaiveGeek.Unknownhttps://www.blogger.com/profile/13888169503732932499noreply@blogger.comtag:blogger.com,1999:blog-6136151974836877051.post-37044127681903130372010-05-31T19:12:43.834-04:002010-05-31T19:12:43.834-04:00@Mark - I corrected the final rethrow explanation ...@Mark - I corrected the final rethrow explanation in this post. It was confusing initially and after playing with it some more I can see how it works. Thanks for pointing out the problem.Rajahttps://www.blogger.com/profile/07749555177730926480noreply@blogger.comtag:blogger.com,1999:blog-6136151974836877051.post-81713091129828478582010-05-26T09:17:34.243-04:002010-05-26T09:17:34.243-04:00Anton, it's not new semantics. It's effec...Anton, it's not new semantics. It's effectively a new optimization of an existing semantic. Java has always supported final in a catch (the try catch block with final will compile in java 6). <br /><br />The new part is that if I catch 3 different exceptions by using a single generic catch (i.e., catch final Exception ex) and then rethrow it, the compiler will now be smart enough to check if any of the original exceptions need to be caught (i.e. not declared on the method signature). If not it'll let me throw "ex" even though the signature doesn't actually have "Exception" as a declared exception. Basically this is handy if the signature declares several checked exceptions that extend a common base class, that I want to handle the same way. <br /><br />It's a little confusing if you're only familiar with it from this post, Raja got it very wrong.Unknownhttps://www.blogger.com/profile/05078034126654549126noreply@blogger.comtag:blogger.com,1999:blog-6136151974836877051.post-91854460204582509602010-05-24T11:35:09.187-04:002010-05-24T11:35:09.187-04:00@RIM - Fixed braces in the code. That was a typo. ...@RIM - Fixed braces in the code. That was a typo. Thanks.Rajahttps://www.blogger.com/profile/07749555177730926480noreply@blogger.comtag:blogger.com,1999:blog-6136151974836877051.post-23355035329631487442010-05-24T11:34:05.827-04:002010-05-24T11:34:05.827-04:00@veggen - Also, look at this post - http://www.bap...@veggen - Also, look at this post - http://www.baptiste-wicht.com/2010/05/better-exception-handling-in-java-7-multicatch-and-final-rethrow/<br /><br />@Anton - I agree that using final for this purpose is not correct. <br /><br />Anyway, I see little value in this feature and it comes with complexity also.Rajahttps://www.blogger.com/profile/07749555177730926480noreply@blogger.comtag:blogger.com,1999:blog-6136151974836877051.post-58124980828045701472010-05-24T11:09:26.598-04:002010-05-24T11:09:26.598-04:00@Flash - It seems like closures will make it to Ja...@Flash - It seems like closures will make it to Java 7. Look at this post from Stephen Colebourne - http://www.jroller.com/scolebourne/entry/closures_in_jdk_7Rajahttps://www.blogger.com/profile/07749555177730926480noreply@blogger.comtag:blogger.com,1999:blog-6136151974836877051.post-10469658156359519402010-05-24T03:34:56.736-04:002010-05-24T03:34:56.736-04:00"Underscores are ignored by compiler
int resu..."Underscores are ignored by compiler<br />int result = 1_2 + 23_8 / 5_0 (Result would be 5)"<br /><br />Maybe so?<br /><br />int result = (1_2 + 23_8) / 5_0 (Result would be 5)Nenahovhttps://www.blogger.com/profile/00442643810339883955noreply@blogger.comtag:blogger.com,1999:blog-6136151974836877051.post-12693600191616861682010-05-24T03:05:55.543-04:002010-05-24T03:05:55.543-04:00"final rethrow" could rather look someth..."final rethrow" could rather look something like this:<br /><br />try {<br />} catch (rethrow Exception e){<br />}<br /><br />i.e. with a new keyword. Adding new keywords would do better than adding semantics to the existing keywords...Anonymoushttps://www.blogger.com/profile/11951065633319406772noreply@blogger.comtag:blogger.com,1999:blog-6136151974836877051.post-18374274972455304662010-05-24T02:20:47.969-04:002010-05-24T02:20:47.969-04:00What about closures?What about closures?Flashhttps://www.blogger.com/profile/13671873881215103125noreply@blogger.comtag:blogger.com,1999:blog-6136151974836877051.post-74173360330290289962010-05-23T15:50:15.684-04:002010-05-23T15:50:15.684-04:00I don't think "final rethrow" does w...I don't think "final rethrow" does what you described here. Check <a href="http://blogs.sun.com/darcy/entry/project_coin_multi_catch_rethrow" rel="nofollow">this post</a>.kaqqaohttps://www.blogger.com/profile/05515187432098285483noreply@blogger.com