DaveAKing / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by cpov...@google.com on 30 Sep 2013 at 4:19

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:12

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08