You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Matt Benson (JIRA)" <ji...@apache.org> on 2013/05/14 21:21:16 UTC
[jira] [Comment Edited] (COLLECTIONS-461) splitmap.TransformedMap
is not really a Map
[ https://issues.apache.org/jira/browse/COLLECTIONS-461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13657403#comment-13657403 ]
Matt Benson edited comment on COLLECTIONS-461 at 5/14/13 7:20 PM:
------------------------------------------------------------------
Hrm... close, what about:
{noformat}
* NOTE: in the original {@link Map} interface, {@link Map#put(Object, Object)} is known to have the same
* return type as {@link Map#get(Object)}, namely {@code V}. {@link Put} makes no assumptions in this
* regard (there is no association with, nor even knowledge of, a "reading" interface) and thus defines
* {@link #put(Object, Object)} as returning {@link Object}.
{noformat}
was (Author: mbenson):
Hrm... close, what about:
{noformat}
* NOTE: in the original {@link Map} interface, {@link Map#put(Object, Object)} is known to have the same
* return type as {@link Map#get(Object)}, namely {@code V}. {@link Put} makes no assumptions in this regard
* (there is no association with, nor even knowledge of, a "reading" interface) and thus defines
* {@link #put(Object, Object)} as returning {@link Object}.
{noformat}
> splitmap.TransformedMap is not really a Map
> -------------------------------------------
>
> Key: COLLECTIONS-461
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-461
> Project: Commons Collections
> Issue Type: Bug
> Reporter: Sebb
> Fix For: 4.x
>
>
> splitmap.TransformedMap is part of the Get/Put hierarchy, but it does not behave like a proper Java Map.
> In particular, java.util.Map.put(K, V) returns V.
> However the collections Put interface returns Object.
> As far as I can tell, this was done in order to be able to include TransformedMap in the hiearchy. But the side effect is to break the generics for all the non-transformer maps in the hierarchy.
> Maybe there should be a separate PutTransformed interface which has the appropriate generic types, i.e.
> public T put(K key, V value)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira