Skip to content

Conversation

@kitschen
Copy link

…(notably in allOf), as this was breaking GWT)

@kitschen
Copy link
Author

More precisely, the issue appears in this situation:
Code in compiling with GWT:


        CompletableFuture<String> ft1 = new CompletableFuture<>();
        CompletableFuture<String> ft2 = new CompletableFuture<>();
        CompletableFuture<Void> all = CompletableFuture.allOf(ft1, ft2);
        all.whenComplete((value,reason) -> {
            logger.log(Level.SEVERE, "Received " + value + " " + reason);
        });
        ft1.complete("Hello");
        ft2.complete("World");
        // expecting the whenComplete to print "Received null null"

Instead of prrint, we get a stacktrace in the Javascript console

Uncaught (in promise) Error: java.lang.ClassCastException
    at ClassCastException_2_g$.createError_0_g$ [as createError_2_g$] (Throwable.java:117)
    at ClassCastException_2_g$.initializeBackingError_0_g$ [as initializeBackingError_1_g$] (Throwable.java:109)
    at ClassCastException_2_g$.Throwable_3_g$ (Throwable.java:69)
    at ClassCastException_2_g$.Exception_3_g$ (Exception.java:29)
    at ClassCastException_2_g$.RuntimeException_3_g$ (RuntimeException.java:29)
    at new ClassCastException_2_g$ (ClassCastException.java:27)
    at checkCriticalType_1_g$ (InternalPreconditions.java:154)
    at checkType_1_g$ (InternalPreconditions.java:138)
    at checkType_0_g$ (InternalPreconditions.java:133)
    at castTo_0_g$ (Cast.java:75)
    at CompletableFuture$lambda$2$Type_1_g$.accept_25_g$ [as accept_120_g$] (CompletableFuture.java:94)
    at lambda$1_3_g$ (NativePromiseImpl.java:57)
    at Function.onSettled_0_g$ (NativePromiseImpl.java:57)
    at lambda_0_g$ (Runtime.java:166)```

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.

1 participant