Reinier Zwitserloot wrote: > Concrete examples: > > Runnable does not let you throw Exceptions. Anyone up for defending > this grievous API design? The amount of annoyance that this is caused > me is almost limitless. > Well Runnable is really for cases where run() should eat any exceptions other than things like VirtualMachineErrors -- and should not be used for anything else.
That said, this is exactly where BGGA's exception transparency should come into play -- to allow you to define: public interface Callable<T,E> { public T call() throws E; } I will almost certainly get BGGA's proposed syntax muddled here, but the important thing here is that call() could throw a precise set of checked exceptions and this set would be bubbled up in generic algorithms (rather than Exception as in Callable<T> today), e.g. public <T,E> visit( Callable<T,E> visitor ) throws SQLException, E; or some such. The actual list of checked exceptions emanating from visit would be SQLException, IOException, MalformedURLException if E was IOException, MalformedURLException. One can still wrap the exception at any point along the way, of course, but one is not /forced /to arbitrarily do so at various points as one is today just because of the imprecision of a generic algorithm's declaration. -- Jess Holle --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javaposse@googlegroups.com To unsubscribe from this group, send email to javaposse+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---