commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COLLECTIONS-461) splitmap.TransformedMap is not really a Map
Date Tue, 14 May 2013 15:09:16 GMT

    [ https://issues.apache.org/jira/browse/COLLECTIONS-461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13657116#comment-13657116
] 

Sebb commented on COLLECTIONS-461:
----------------------------------

Sorry, I cannot seem to find the problem myself either now. Not sure what triggered the original
issue anymore.
As you write above, the fact that IterableMap extends Map as well as Put solves the problem
of the return type (RT) from put().

However, it is still the case that Put is not exactly a subset of Map. 
Using Put rather than Map means that the RT of put() is Object and may have to be cast. 
It would be better if this could be avoided.

If Put cannot be fixed, then I think the Put#put() Javadoc needs to make this difference clear.
[Maybe the best would be to fix the Javadoc now, and adjust as necessary later.]
                
> 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

Mime
View raw message