You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Trustin Lee <tr...@gmail.com> on 2007/07/16 05:11:12 UTC

Re: svn commit: r556316 - /mina/trunk/core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java

On 7/15/07, mheath@apache.org <mh...@apache.org> wrote:
> Author: mheath
> Date: Sat Jul 14 11:15:52 2007
> New Revision: 556316
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=556316
> Log:
> Fixed parameterized types on Class.
> Fixed parameterized types on MessageHandler to be <? extends E> and not <? super E> since E is not implenting MessageHandler.

<snip/>

> @@ -95,8 +97,8 @@
>      *         the specified <tt>type</tt>.  <tt>null</tt> otherwise.
>      */
>     @SuppressWarnings("unchecked")
> -    public <E> MessageHandler<? super E> addMessageHandler(Class<E> type,
> -            MessageHandler<? super E> handler) {
> +    public <E> MessageHandler<? extends E> addMessageHandler(Class<E> type,
> +            MessageHandler<? extends E> handler) {
>         findHandlerCache.clear();
>         return type2handler.put(type, handler);
>     }

Super is correct here IMO.  For example, assume that there's a message
class A and B that extends A.  Unless super is used here, a user
cannot call addMessageHandler(B.class, new AMessageHandler()); nor
addMessageHandler(A.class, new ObjectMessageHandler());

Please revert this change if it's correct.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6