Mike. J. Thompson wrote:Personally I've never had a problem with checked Exceptions
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Stephan van Hulst wrote:That wouldn't work Rob, because it's never guaranteed when the lambda will be run. Cases in point: passing a lambda to ExecutorService.submit() or SwingUtilities.invokeLater().
I don't really see the problem. You can still pass lambdas that throw a checked exception to methods that accept such an interface. Using a lambda would still be nicer than passing an anonymous class instance. I don't think lambdas make checked exceptions more or less problematic than they already were.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
The problem with checked exceptions is that people don't use them correctly. Most 'lazy' programmers just add the throws declaration to all their method signatures, effectively turning checked exceptions into unchecked ones, or creating confusing APIs.
Or maybeStephan van Hulst wrote: . . . wrap the call to drive() in a try-catch statement, and then throw a new AccidentWhileMovingException that wraps the original exception.
I'm doing laundry! Look how clean this tiny ad is:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|