Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
You are certain the listed exception can't actually ever happen, or only in vanishingly rare situations.
* You don't try to catch OutOfMemoryError on every statement either. Examples:
* {@code IOException} in {@code ByteArrayOutputStream}
* {@code UnsupportedEncodingException} in new String(byteArray, "UTF-8").
*
You know for certain the caller can handle the exception (for example, because the caller is
* an app manager that will handle all throwables that fall out of your method the same way), but due
* to interface restrictions you can't just add these exceptions to your 'throws' clause.
*
* Note that, as SneakyThrow is an implementation detail and NOT part of your method signature, it is
* a compile time error if none of the statements in your method body can throw a listed exception.
*
* WARNING: You must have lombok.jar available at the runtime of your app if you use SneakyThrows,
* because your code is rewritten to use {@link Lombok#sneakyThrow(Throwable)}.
*
*
* Example:
*
* @SneakyThrows(UnsupportedEncodingException.class)
* public void utf8ToString(byte[] bytes) {
* return new String(bytes, "UTF-8");
* }
*
*
* {@code @SneakyThrows} without a parameter defaults to allowing every checked exception.
* (The default is {@code Throwable.class}).
*
* @see Lombok#sneakyThrow(Throwable)
*/
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
@Retention(RetentionPolicy.SOURCE)
public @interface SneakyThrows {
/**
* The exception type(s) you want to sneakily throw onward.
*/
Class extends Throwable>[] value() default Throwable.class;
//The package is mentioned in java.lang due to a bug in javac (presence of an annotation processor throws off the type resolver for some reason).
}