AS-IS
class Unchecked {
public static void throwChecked(Throwable t) {
SeqUtils.sneakyThrow(t);
}
}
public Object foo() {
if (condition) {
return bar();
} else {
Unchecked.throwChecked(new Exception());
return null;
}
}
TO-BE
class Unchecked {
public static <T> T throwChecked(Throwable t) {
SeqUtils.sneakyThrow(t);
return null;
}
}
public Object foo() {
if (condition) {
return bar();
} else {
return Unchecked.throwChecked(new Exception());
}
}
Versions:
- jOOλ: 0.9.12
- Java: 1.8.0.91