You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Torsten Curdt (JIRA)" <ji...@apache.org> on 2006/10/30 11:45:16 UTC

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

Not return the base interface on decorate
-----------------------------------------

                 Key: COLLECTIONS-231
                 URL: http://issues.apache.org/jira/browse/COLLECTIONS-231
             Project: Commons Collections
          Issue Type: Improvement
          Components: Map
    Affects Versions: 3.2
            Reporter: Torsten Curdt


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 contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


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

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COLLECTIONS-231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated COLLECTIONS-231:
--------------------------------------

    Fix Version/s: 3.3

Makes sense to me.

> 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: 3.3
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


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

Posted by "Stephen Kestle (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COLLECTIONS-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493527 ] 

Stephen Kestle commented on COLLECTIONS-231:
--------------------------------------------

So - fix for generics?

> 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: 3.3
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


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

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COLLECTIONS-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493501 ] 

Stephen Colebourne commented on COLLECTIONS-231:
------------------------------------------------

This change cannot be made as changing the return type is binary incompatible.

The constructor is not public as it has a different meaning to a constructor taking a map on a HashMap (decorate vs copy).

> 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: 3.3
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org