Re: JSR311: exception mapping of wrapper exceptions

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 26 Jun 2008 09:50:58 +0200

On Jun 26, 2008, at 9:12 AM, Paul Sandoz wrote:

>> Also I think that, strictly speaking, getExceptionMapper should
>> return ExceptionMapper<? super T> rather than ExceptionMapper<T>
>> since getExceptionMapper(FooException.class) could actually return
>> an ExcpetionMapper<Exception.class> if that is provider whose
>> generic type is the nearest superclass of Foo. Not sure it
>> particularly matters though, is it worth being explicit ?
> I think it is worth using the type system where possible to be more
> accurate.

 From the advice of Josh Bloch using wildcards should be avoided for
return types because it makes things hard and exposes such things on
the user (namely they start having to declare the wildcard type)
where as wildcards should be used to accept or reject things.