Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 7
    SomeStupidExceptionOmgWhoCares well someone cared enough to throw it. So either it never should have been thrown (bad design) or you should really handle it. The same is true of the bad implementation of a pre-1.0 class (the byte array output stream) where the design was, unfortunately bad. Commented Nov 27, 2013 at 3:22
  • 2
    The proper idiom would have been a directive that would catch any specified exceptions thrown by nested subroutine calls and rethrow them wrapped in a RuntimeException. Note that a routine could simultaneously be declared as throws IOException and yet also specify that any IOException thrown from a nested call should be considered unexpected and wrapped. Commented Dec 26, 2013 at 3:13
  • 21
    I'm a professional C# developer with some Java experience who stumbled on this post. I'm baffled as to why anyone would support this bizarre behavior. In .NET if I want to catch a specific type of exception, I can catch that. If I want to just let it get thrown up the stack, there's nothing to do. I wish Java wasn't so quirky. :) Commented Mar 15, 2014 at 4:38
  • 1
    Concerning "sometimes I'll comment out a method call temporarily" - I learnt to use if (false) for this. It avoids the throw clause problem and the warning helps me to navigate back faster. +++ That said, I agree with everything you wrote. Checked exceptions have some value, but this value is negligible when compared to their cost. Nearly always they just get in the way. Commented May 25, 2017 at 4:03
  • 2
    When there doesn't seem to be anything useful to do with an exception, it is a huge red flag telling you have a bad design. Checked exceptions are making that visible to you rather than letting you ignore the problem. Commented Dec 4, 2023 at 16:36