From b96bd7e9265c1e4b9849f151667404767c241694 Mon Sep 17 00:00:00 2001
From: Reinier Zwitserloot throws
clause of your methods, which is why this works.
- CAREFUL: Unlike other lombok transformations, you need to put lombok.jar on your classpath when + CAREFUL: Unlike other lombok transformations, you need to put lombok.jar on your classpath when you run your program.
- Common use cases for when you want to opt out of the checked exception mechanism center around 2 situations:
Runnable
- whatever exception propagates out of your run()
method,
+ Common use cases for when you want to opt out of the checked exception mechanism center around 2 situations:Runnable
- whatever exception propagates out of your run()
method,
checked or not, it will be passed to the Thread
's unhandled exception handler. Catching a checked exception and wrapping it
- in some sort of RuntimeException
is only obscuring the real cause of the issue.new String(someByteArray, "UTF-8");
declares that it can throw an
+ in some sort of RuntimeException
is only obscuring the real cause of the issue.new String(someByteArray, "UTF-8");
declares that it can throw an
UnsupportedEncodingException
but according to the JVM specification, UTF-8 must always be available. An
UnsupportedEncodingException
here is about as likely as a ClassNotFoundError
when you use a String object,
- and you don't catch those either!
+ and you don't catch those either!Be aware that it is impossible to catch sneakily thrown checked types directly, as javac will not let you write a catch block for an exception type that no method call in the try body declares as thrown. This problem is not relevant in either of the use cases listed -- cgit