There is a post on DZone
today about having a return statement in a finally block. When I first read the code it thought it was odd that this was even allowed. Not to mention that any sane, rational developer would put a return in a finally block. I did not really believe the author when he explained the execution path either, so I thought I would give it a try.
I fired up my handy, dandy .Net IDE and threw down some code. At this point I noticed that .net DOES NOT ALLOW you to put a return (or break) inside a finally block. In fact you get a message that states ‘Cannot jump out of the finally block’. I thought this was odd that I got this but the author did not.
It was at this point that I noticed he was coding in Java. Wow, must suck that a language like Java allows for really shitty practices like allowing a return in a finally block. I was happy to find out that .net does NOT allow this.
06-29-2007 1:18 PM