commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COLLECTIONS-231) Not return the base interface on decorate
Date Sat, 23 Jun 2012 15:33:42 GMT

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

Hudson commented on COLLECTIONS-231:
------------------------------------

Integrated in commons-collections #34 (See [https://builds.apache.org/job/commons-collections/34/])
    [COLLECTIONS-231] return specific type rather than base type in factory methods, javadoc
cleanup. (Revision 1353139)

     Result = SUCCESS
tn : http://svn.apache.org/viewvc/?view=rev&rev=1353139
Files : 
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BlockingBuffer.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedBuffer.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/TransformedBuffer.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java

                
> Not return the base interface on decorate
> -----------------------------------------
>
>                 Key: COLLECTIONS-231
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-231
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Map
>    Affects Versions: 3.2
>            Reporter: Torsten Curdt
>             Fix For: 4.0-beta-1
>
>
> At the moment I don't see a reason why the static "decorate" method does not return ListOrderedMap
but just the base interface OrderedMap.
> I want to decorate a Map to be a ListOrderedMap but due to the fact that the constructor
is not visible and decorate only returns the base interface OrderedMap an unnecessary cast
is required.
>  ListOrderedMap map = (ListOrderedMap)ListOrderedMap.decorate(new MyMap());
> As the decorate method is static and not part of any interface it should be fine to return
the real type instead of the base. Otherwise I'd suggest to make the constructor visible.
From the API POV It is not really understandable why this
>  ListOrderedMap map = new ListOrderedMap();
> is fine and creates a HashMap under the hood while this
>  ListOrderedMap map = new ListOrderedMap(new MyMap()));
> is not ok.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message