Skip to content

Conversation

magicprinc
Copy link
Contributor

@magicprinc magicprinc commented Nov 19, 2023

  1. NPE
} catch (InterruptedException e) {
      Utils.throwAsUnchecked(e.getCause());

could cause NPE

  1. if Future.isComplete() simply return result

  2. ugly 2 lines

Utils.throwAsUnchecked(cause());
return null;

looks ugly, can be easily optimized

@magicprinc
Copy link
Contributor Author

@vietj NPE is real. There is a test in PR

@vietj
Copy link
Member

vietj commented Nov 26, 2023

thanks for reporting the NPE @magicprinc

@magicprinc
Copy link
Contributor Author

magicprinc commented Nov 26, 2023

@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 🤦‍♂️

@magicprinc
Copy link
Contributor Author

@vietj and "happy path" for already completed Futures

default T await() {
   if (isComplete()) {
      return ...
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants