Exception Transparency
Joshua Bloch
jjb at google.com
Fri Feb 26 12:27:59 PST 2010
I too agree that exception transparency is a good thing -- "throws X" is an
empty promise without it.I tried (unsuccessfully) to convince the generics
EG to support this feature when generics were first added to the language:(
Sadly, many APIs have already been written in a fashion that probably won't
be able to take advantage of exception transparency if we add it to the
language. Exhibit A is java.util.concurrent.Callable, which has pervasive
effects on the Executor framework:
public interface Callable<V> {
public abstract V call() throws Exception;
}
Might it be possible to add exception transparency in some fashion that
allows us to retrofit Callable, or is that asking too much? Either way, I
believe it's not too late to add this feature to the language and I hope
that we can do it.
Josh
P.S. I'd be curious to know if the term exception transparency was used
before '97. John Rose and I used the term when anonymous classes were added
to Java.
On Thu, Feb 25, 2010 at 11:22 PM, Paulo Levi <i30817 at gmail.com> wrote:
> Agree completely. The syntax is a extension of the parametric type
> inference
> that already exists in methods (so people already use it), so this is just
> the removal of a limitation -> exceptions can be parametric too.
>
>
More information about the lambda-dev
mailing list