On 23 Mar 2011 21:43, "phil swenson" <[email protected]> wrote: > > I never thought I'd see anything useful on an OSGi blog, but today I saw this: > > http://www.osgi.org/blog/2011/03/exception-hygiene.html > > So if you accept that CheckedExceptions are a bad idea... read the comments on this post. There is a debate as to how to handle the atrocity that the CheckedException. There are two approaches that are debated: > > 1) > void foo() { > try { > bar(); > } catch( Exception e) { > throw new RuntimeException(e); > } > } > > 2) > void foo() throws Exception { > bar(); > } > > I used to be in the #1 camp. But after reading the thread, I'm thinking that just putting throws Exception everywhere might be easier/more pragmatic. It's uglier, but it does make the stack dump more readable I think. In reality I hate both solutions as I'd really rather just turn them off. But that isn't doable. > > Any thoughts on the pros/cons of #1 vs #2? Or other options? >
Don't throw, chuck! http://james-iry.blogspot.com/2010/08/on-removing-java-checked-exceptions-by.html Or simply use Scala... take your pick :) > > -- > You received this message because you are subscribed to the Google Groups "The Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to [email protected]. > For more options, visit this group at http://groups.google.com/group/javaposse?hl=en. -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
