vert.x
vert.x copied to clipboard
Future fix NPE, fast path for completed, fewer lines
- NPE
} catch (InterruptedException e) {
Utils.throwAsUnchecked(e.getCause());
could cause NPE
-
if Future.isComplete() simply return result
-
ugly 2 lines
Utils.throwAsUnchecked(cause());
return null;
looks ugly, can be easily optimized
@vietj NPE is real. There is a test in PR
thanks for reporting the NPE @magicprinc
@vietj Any chance to have in addition
public static <E extends Throwable> RuntimeException throwAsUnchecked(Throwable t) throws E {
instead of
public static <E extends Throwable> void throwAsUnchecked(Throwable t) throws E {
Please… 🙏😅
The Pain Of Perfectionism, you know 🤦♂️
@vietj and "happy path" for already completed Futures
default T await() {
if (isComplete()) {
return ...
}