[jira] [Commented] (COLLECTIONS-231) Not return the base interface on decorate

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (COLLECTIONS-231) Not return the base interface on decorate

ASF GitHub Bot (Jira)

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

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

Integrated in commons-collections #44 (See [https://builds.apache.org/job/commons-collections/44/])
    [COLLECTIONS-231] apply signature change to factory method. (Revision 1353169)
[COLLECTIONS-231] apply signature change to factory method. (Revision 1353166)
[COLLECTIONS-231] apply signature change to factory method. (Revision 1353165)

     Result = FAILURE
tn : http://svn.apache.org/viewvc/?view=rev&rev=1353169
Files :
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/MapBackedSet.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/PredicatedSet.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/PredicatedSortedSet.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/SynchronizedSet.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/SynchronizedSortedSet.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSet.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSortedSet.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/UnmodifiableSet.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java

tn : http://svn.apache.org/viewvc/?view=rev&rev=1353166
Files :
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/FixedSizeList.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/GrowthList.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/LazyList.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/PredicatedList.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/SynchronizedList.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/TransformedList.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/UnmodifiableList.java

tn : http://svn.apache.org/viewvc/?view=rev&rev=1353165
Files :
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/PredicatedCollection.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/SynchronizedCollection.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/TransformedCollection.java
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.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