I have question about @SneakyThrows can be used to sneakily throw checked exceptions without actually declaring this in your method's throws clause.
public class Demo {
public static void main(String[] args) {
}
private void throwE() throws ClassNotFoundException {
}
@SneakyThrows
private void t() {
throwE();
}
}
Here is generate by lombok.
public class Demo {
public Demo() {
}
public static void main(String[] args) throws IOException {
}
private void throwE() throws ClassNotFoundException {
}
private void t() {
try {
this.throwE();
} catch (Throwable var2) {
throw var2;
}
}
}
Why the code generate by lombok can fakes out the compiler without declaring throws clause.