Following on from my previous post about Java Lambdas and checked exceptions, I did some more research.
There’s a revealing analysis of what GitHub programmers actually do when handling exceptions: Exception Handling Practices in Java. It goes a long way to demonstrating the failure of Java’s approach to checked exceptions.
Well worth a read. Most developers, it turns out, don’t respect checked exceptions at all — they’re either ignored entirely or met with nothing more than a log statement and a swallow.
Look at figures 7 and 8 in particular. A lot of catch blocks are entirely empty. But even the ones that do some printing or logging? When the researchers looked more closely, logging or printing was typically the only operation — barely better than an empty block.
It’s hard to believe that in the vast majority of cases it’s actually acceptable for a program to carry on without taking any meaningful action. But that’s what the data shows across GitHub.
Quality software.