Skip to content

Override resultNow and exceptionNow in AbstractFuture.#8249

Merged
copybara-service[bot] merged 1 commit intomasterfrom
test_879645641
Mar 7, 2026
Merged

Override resultNow and exceptionNow in AbstractFuture.#8249
copybara-service[bot] merged 1 commit intomasterfrom
test_879645641

Conversation

@copybara-service
Copy link
Copy Markdown
Contributor

Override resultNow and exceptionNow in AbstractFuture.

For users on Java 19+ who could already call those methods on any Future, this CL just means that they'll get a faster implementation.

For users before Java 19, this adds the methods to the API—but only to the API of AbstractFuture and its subclasses, SettableFuture and FluentFuture, not to ListenableFuture in general.

I'm going to tentatively say that this fixes #8245, but anyone is free to let us know if you'd like to see more in that area, whether by reopening the issue or opening a new one.

As an additional step toward handling resultNow, exceptionNow, and even state, I've also copied our standard warnings about forwarding objects (including default methods) into the Forwarding*Future family, including the package-private ForwardingFluentFuture.

RELNOTES=n/a

For users on Java 19+ who could already call those methods on any `Future`, this CL just means that they'll get a faster implementation.

For users before Java 19, this adds the methods to the API—but only to the API of `AbstractFuture` and its subclasses, `SettableFuture` and `FluentFuture`, not to `ListenableFuture` in general.

I'm going to tentatively say that this fixes #8245, but anyone is free to let us know if you'd like to see more in that area, whether by reopening the issue or opening a new one.

As an additional step toward handling `resultNow`, `exceptionNow`, and even `state`, I've also copied our standard warnings about forwarding objects (including `default` methods) into the `Forwarding*Future` family, including the package-private `ForwardingFluentFuture`.

RELNOTES=n/a
PiperOrigin-RevId: 880109858
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.

Future.exceptionNow and Future.resultNow

1 participant