users@jsr311.java.net

Re: Questions on Providers interface

From: Reto Bachmann-Gmür <reto_at_gmuer.ch>
Date: Fri, 22 Aug 2008 13:08:32 +0200

Marc Hadley wrote:

>
>> 2. If I understand things right the method may return the
>> ExceptionMapper for a superclass of type, so shouldn't either the
>> return value be ExceptionMapper<? super T> or the argument Class<?
>> extends T> type?
>>
> I don't think that is really necessary. An ExceptionMapper<Exception>
> will handle Exception or any subclass so changing the signature to:
>
> <T extends Throwable> ExceptionMapper<? super T>
> getExceptionMapper(Class<T> type);
>
> just makes the signature look more complex without adding any real value.
Not sure. If we call getExceptionMapper with SomeException.class as
argument, the current method signature seems to promise an
ExceptionMapper<SomeException> as result, but the method could just
return an ExceptionMapper<Exception>.

Reto