Skip to content
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

Stop special-casing UndeclaredThrowableException in Futures.transform() #1548

Closed
gissuebot opened this issue Oct 31, 2014 · 4 comments
Closed
Labels
Milestone

Comments

@gissuebot
Copy link

Original issue created by cpovirk@google.com on 2013-09-30 at 04:19 PM


For historical reasons, people have been using the non-standard practice of wrapping checked exceptions in UTE from inside a Function implementation. We can change these existing users to using AsyncFunction which allows checked exceptions to be thrown.

Earlier discussion:

Where is it specified that Function implementations should wrap checked exceptions in UTE? UTE is from java.lang.reflect package, so it's surprising to me to see us special-casing UTE in Future utility.
I think that this is the specification here :) Probably it applies only to this method and not to Function in general, and likely it was intended to be somewhere more... visible :)

People do appear to be taking advantage of the feature, as demonstrated by a search for files containing both "new UndeclaredThrowableException" and "com.google.common.util.concurrent.Futures."

It's an odd feature, though, and it might be wise to convert them to AsyncFunctions. Their computations won't necessarily be asynchronous, but AsyncFunction is allowed to throw any kind of exception, making UndeclaredThrowableException unnecessary.

@gkdn
Copy link
Member

gkdn commented Sep 26, 2017

@cpovirk Are you planning to pursue this?

@cpovirk
Copy link
Member

cpovirk commented Sep 26, 2017

It's something that I would like to see happen but never have been able to justify. I assume that you're interested because it lets you remove the GWT emulation of UndeclaredThrowableException? If nothing else, I can float this in front of future 20%ers (and add it to my ever-growing list of "quick tasks" for myself, but that probably won't accomplish much :)).

How much does removing the type buy you? I could try to bump it up if there's a big win.

@gkdn
Copy link
Member

gkdn commented Sep 27, 2017

Yes, that's why I'm interested :)

I think I can either move or delete all JDK emulation under Guava except this one though it is not critical.

@cpovirk cpovirk added this to the NEXT milestone Jun 18, 2018
@cpovirk
Copy link
Member

cpovirk commented Jun 18, 2018

Fixed in a change that will be mirrored out shortly.

@cpovirk cpovirk closed this as completed Jun 18, 2018
@cgdecker cgdecker modified the milestones: NEXT, 26.0 Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants