-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ExecutorService.close in ForwardingExecutorService #6296
Comments
It's not hard to implement that -- I can file a PR -- but obviously not without reflection. i searched through https://github.com/google/guava/wiki and https://github.com/google/guava/wiki/CollectionHelpersExplained to understand what's the project policy on such cases, but didn't find an answer (apologies, if i just overlooked it!). @cpovirk is there a project policy on how to update |
Our approach so far has been not to forward In the case of This is definitely a wart, but it's probably our best option, given that From your linked PR (thanks!), I gather that you filed this issue at least partially because of a failing test (which maybe could be changed to ignore In any case, we should document this behavior, as we did for |
Thanks @cpovirk for your detailed explanation. It makes total sense.
Yes, the test found out the issue, but at least on our side the fix is simple -- we expect a certain class to implement all interface methods explicitly, so we specifically disallow inheriting default methods. It's not a generic
I am sure I have seen this warning there at some point, but forgot about it. For |
Thanks, we'll get #6299 merged. As for the wiki, it's mostly been focused on information for end users, rather than for information about the design of Guava. Now, to be fair, the question of how our forwarding classes behave is of interest to end users :) But I think users are significantly more likely to find it in the Javadoc than on the wiki, so I think it falls to us to notice things like this and document them. (I would imagine we could write a test, similar to the one your project has, to notify us of new That still leaves a further question, which is whether it would be good for us to share more of the internal design notes that we have with the public. It's one of those things that we periodically talk about doing. It might still happen one of these days.... |
Currently, Guava is built with Java 9 and `ExecutorService` has no default methods. This changes in Java 19, where `ExecutorService.close` is added. Ensure users have right expectations about future evolution of the `ForwardingExecutorService` and its compatibility with newer Java versions. Fixes #6296 Fixes #6299 RELNOTES=n/a PiperOrigin-RevId: 502827344
JDK's
ExecutorService
isAutoCloseable
since Java 19.ForwardingExecutorService
does not forward theclose
method.Forward close too, when running on Java 19.
The text was updated successfully, but these errors were encountered: