You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Stephen Kestle (JIRA)" <ji...@apache.org> on 2006/07/19 01:18:13 UTC

[jira] Created: (COLLECTIONS-218) CollectionUtils.select() does not return passed in collection

CollectionUtils.select() does not return passed in collection
-------------------------------------------------------------

                 Key: COLLECTIONS-218
                 URL: http://issues.apache.org/jira/browse/COLLECTIONS-218
             Project: Commons Collections
          Issue Type: Improvement
          Components: Collection
    Affects Versions: 3.2, 3.1, 3.0, 2.1.1, 2.1, 2.0, 1.0, 3.3, Nightly Builds
            Reporter: Stephen Kestle


collect has the following methods: 

Collection collect(Collection inputCollection, final Transformer transformer)
Collection collect(Collection inputCollection, final Transformer transformer, final Collection outputCollection)

The first creates an ArrayList(), where the second takes an outputCollection and, for convenience, returns it.

Select (and selectReject) currently the following methods:

Collection select(Collection inputCollection, Predicate predicate)
void select(Collection inputCollection, Predicate predicate, Collection outputCollection)

I propose changing the bottom method to return the passed in outputCollection.  It would simplify calling code.

-- 
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] Commented: (COLLECTIONS-218) CollectionUtils.select() does not return passed in collection

Posted by "Simon Kitching (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/COLLECTIONS-218?page=comments#action_12422391 ] 
            
Simon Kitching commented on COLLECTIONS-218:
--------------------------------------------

I was a little surprised by the comment that changing void->non-void was binary incompatible, so I checked - and this is indeed the case. Thought I'd just add this comment to confirm it for anyone else wondering. It's a little odd, as method selection during compilation depends only on the parameter types, but my simple test shows it clearly:
   Exception in thread "main" java.lang.NoSuchMethodError: Target.process(Ljava/lang/String;)V
that V at the end indicates the void return type. There is no longer a  "Target.process" method taking String and returning void (because it was modified to return String) so..boom.

Therefore I have to agree with Steven that unfortunately this change can't be applied.


> CollectionUtils.select() does not return passed in collection
> -------------------------------------------------------------
>
>                 Key: COLLECTIONS-218
>                 URL: http://issues.apache.org/jira/browse/COLLECTIONS-218
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 3.2
>            Reporter: Stephen Kestle
>         Assigned To: Stephen Colebourne
>         Attachments: CollectionUtils select return.patch
>
>
> collect has the following methods: 
> Collection collect(Collection inputCollection, final Transformer transformer)
> Collection collect(Collection inputCollection, final Transformer transformer, final Collection outputCollection)
> The first creates an ArrayList(), where the second takes an outputCollection and, for convenience, returns it.
> Select (and selectReject) currently the following methods:
> Collection select(Collection inputCollection, Predicate predicate)
> void select(Collection inputCollection, Predicate predicate, Collection outputCollection)
> I propose changing the bottom method to return the passed in outputCollection.  It would simplify calling code.

-- 
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] Commented: (COLLECTIONS-218) CollectionUtils.select() does not return passed in collection

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/COLLECTIONS-218?page=comments#action_12422358 ] 
            
Stephen Colebourne commented on COLLECTIONS-218:
------------------------------------------------

Its not intuitive, but its not just serialized classes.

Our requirement is that other code compiled against collections will continue to work if the new jar is dropped in (without recompilation). Its just a 'feature' of Java that this can't be met.

See http://www.eclipse.org/eclipse/development/java-api-evolution.html

> CollectionUtils.select() does not return passed in collection
> -------------------------------------------------------------
>
>                 Key: COLLECTIONS-218
>                 URL: http://issues.apache.org/jira/browse/COLLECTIONS-218
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 3.2
>            Reporter: Stephen Kestle
>         Assigned To: Stephen Colebourne
>         Attachments: CollectionUtils select return.patch
>
>
> collect has the following methods: 
> Collection collect(Collection inputCollection, final Transformer transformer)
> Collection collect(Collection inputCollection, final Transformer transformer, final Collection outputCollection)
> The first creates an ArrayList(), where the second takes an outputCollection and, for convenience, returns it.
> Select (and selectReject) currently the following methods:
> Collection select(Collection inputCollection, Predicate predicate)
> void select(Collection inputCollection, Predicate predicate, Collection outputCollection)
> I propose changing the bottom method to return the passed in outputCollection.  It would simplify calling code.

-- 
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-218) CollectionUtils.select() does not return passed in collection

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/COLLECTIONS-218?page=all ]

Stephen Colebourne updated COLLECTIONS-218:
-------------------------------------------

          Component/s: Core
                           (was: Collection)
    Affects Version/s:     (was: 3.1)
                           (was: 3.0)
                           (was: 2.1.1)
                           (was: 2.1)
                           (was: 2.0)
                           (was: 1.0)
                           (was: 3.3)
                           (was: Nightly Builds)
             Assignee: Stephen Colebourne

> CollectionUtils.select() does not return passed in collection
> -------------------------------------------------------------
>
>                 Key: COLLECTIONS-218
>                 URL: http://issues.apache.org/jira/browse/COLLECTIONS-218
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 3.2
>            Reporter: Stephen Kestle
>         Assigned To: Stephen Colebourne
>         Attachments: CollectionUtils select return.patch
>
>
> collect has the following methods: 
> Collection collect(Collection inputCollection, final Transformer transformer)
> Collection collect(Collection inputCollection, final Transformer transformer, final Collection outputCollection)
> The first creates an ArrayList(), where the second takes an outputCollection and, for convenience, returns it.
> Select (and selectReject) currently the following methods:
> Collection select(Collection inputCollection, Predicate predicate)
> void select(Collection inputCollection, Predicate predicate, Collection outputCollection)
> I propose changing the bottom method to return the passed in outputCollection.  It would simplify calling code.

-- 
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] Reopened: (COLLECTIONS-218) CollectionUtils.select() does not return passed in collection

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/COLLECTIONS-218?page=all ]

Stephen Colebourne reopened COLLECTIONS-218:
--------------------------------------------

             
Implement for Generics

> CollectionUtils.select() does not return passed in collection
> -------------------------------------------------------------
>
>                 Key: COLLECTIONS-218
>                 URL: http://issues.apache.org/jira/browse/COLLECTIONS-218
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 3.2
>            Reporter: Stephen Kestle
>         Assigned To: Stephen Colebourne
>             Fix For: Generics
>
>         Attachments: CollectionUtils select return.patch
>
>
> collect has the following methods: 
> Collection collect(Collection inputCollection, final Transformer transformer)
> Collection collect(Collection inputCollection, final Transformer transformer, final Collection outputCollection)
> The first creates an ArrayList(), where the second takes an outputCollection and, for convenience, returns it.
> Select (and selectReject) currently the following methods:
> Collection select(Collection inputCollection, Predicate predicate)
> void select(Collection inputCollection, Predicate predicate, Collection outputCollection)
> I propose changing the bottom method to return the passed in outputCollection.  It would simplify calling code.

-- 
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-218) CollectionUtils.select() does not return passed in collection

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/COLLECTIONS-218?page=all ]

Stephen Colebourne updated COLLECTIONS-218:
-------------------------------------------

    Fix Version/s: Generics

> CollectionUtils.select() does not return passed in collection
> -------------------------------------------------------------
>
>                 Key: COLLECTIONS-218
>                 URL: http://issues.apache.org/jira/browse/COLLECTIONS-218
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 3.2
>            Reporter: Stephen Kestle
>         Assigned To: Stephen Colebourne
>             Fix For: Generics
>
>         Attachments: CollectionUtils select return.patch
>
>
> collect has the following methods: 
> Collection collect(Collection inputCollection, final Transformer transformer)
> Collection collect(Collection inputCollection, final Transformer transformer, final Collection outputCollection)
> The first creates an ArrayList(), where the second takes an outputCollection and, for convenience, returns it.
> Select (and selectReject) currently the following methods:
> Collection select(Collection inputCollection, Predicate predicate)
> void select(Collection inputCollection, Predicate predicate, Collection outputCollection)
> I propose changing the bottom method to return the passed in outputCollection.  It would simplify calling code.

-- 
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] Commented: (COLLECTIONS-218) CollectionUtils.select() does not return passed in collection

Posted by "Stephen Kestle (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/COLLECTIONS-218?page=comments#action_12422290 ] 
            
Stephen Kestle commented on COLLECTIONS-218:
--------------------------------------------

Binary compatibility only matters if the type is Serializable right?  Is there something I'm missing?  If someone is Serializing a static class, then it's a bit up the wall IMO.

It's not going to break any client code, as they won't bu using a void return type.

Is this just a business policy?

> CollectionUtils.select() does not return passed in collection
> -------------------------------------------------------------
>
>                 Key: COLLECTIONS-218
>                 URL: http://issues.apache.org/jira/browse/COLLECTIONS-218
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 3.2
>            Reporter: Stephen Kestle
>         Assigned To: Stephen Colebourne
>         Attachments: CollectionUtils select return.patch
>
>
> collect has the following methods: 
> Collection collect(Collection inputCollection, final Transformer transformer)
> Collection collect(Collection inputCollection, final Transformer transformer, final Collection outputCollection)
> The first creates an ArrayList(), where the second takes an outputCollection and, for convenience, returns it.
> Select (and selectReject) currently the following methods:
> Collection select(Collection inputCollection, Predicate predicate)
> void select(Collection inputCollection, Predicate predicate, Collection outputCollection)
> I propose changing the bottom method to return the passed in outputCollection.  It would simplify calling code.

-- 
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] Closed: (COLLECTIONS-218) CollectionUtils.select() does not return passed in collection

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/COLLECTIONS-218?page=all ]

Stephen Colebourne closed COLLECTIONS-218.
------------------------------------------

    Resolution: Won't Fix

This change is logically sensible. However, it is backwards incompatible (changing a return type is binary incompatible). As such e cannot incorporate this proposal. Sorry.

> CollectionUtils.select() does not return passed in collection
> -------------------------------------------------------------
>
>                 Key: COLLECTIONS-218
>                 URL: http://issues.apache.org/jira/browse/COLLECTIONS-218
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 3.2
>            Reporter: Stephen Kestle
>         Assigned To: Stephen Colebourne
>         Attachments: CollectionUtils select return.patch
>
>
> collect has the following methods: 
> Collection collect(Collection inputCollection, final Transformer transformer)
> Collection collect(Collection inputCollection, final Transformer transformer, final Collection outputCollection)
> The first creates an ArrayList(), where the second takes an outputCollection and, for convenience, returns it.
> Select (and selectReject) currently the following methods:
> Collection select(Collection inputCollection, Predicate predicate)
> void select(Collection inputCollection, Predicate predicate, Collection outputCollection)
> I propose changing the bottom method to return the passed in outputCollection.  It would simplify calling code.

-- 
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-218) CollectionUtils.select() does not return passed in collection

Posted by "Stephen Kestle (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/COLLECTIONS-218?page=all ]

Stephen Kestle updated COLLECTIONS-218:
---------------------------------------

    Attachment: CollectionUtils select return.patch

Uploaded patch file for proposed changes.

I have also made changes to the two argument methods of select(), selectReject() and collect() to be simple one-liners:

from:
   public static Collection collect(Collection inputCollection, Transformer transformer) {
        ArrayList answer = new ArrayList(inputCollection.size());
        collect(inputCollection, transformer, answer);
        return answer;
    }

to:
   public static Collection collect(Collection inputCollection, Transformer transformer) {
        return collect(inputCollection, transformer, new ArrayList(inputCollection.size()));
    }

I'll leave it up to you developers to figure out if that's a good or a bad thing...

> CollectionUtils.select() does not return passed in collection
> -------------------------------------------------------------
>
>                 Key: COLLECTIONS-218
>                 URL: http://issues.apache.org/jira/browse/COLLECTIONS-218
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Collection
>    Affects Versions: 3.2, 3.1, 3.0, 2.1.1, 2.1, 2.0, 1.0, 3.3, Nightly Builds
>            Reporter: Stephen Kestle
>         Attachments: CollectionUtils select return.patch
>
>
> collect has the following methods: 
> Collection collect(Collection inputCollection, final Transformer transformer)
> Collection collect(Collection inputCollection, final Transformer transformer, final Collection outputCollection)
> The first creates an ArrayList(), where the second takes an outputCollection and, for convenience, returns it.
> Select (and selectReject) currently the following methods:
> Collection select(Collection inputCollection, Predicate predicate)
> void select(Collection inputCollection, Predicate predicate, Collection outputCollection)
> I propose changing the bottom method to return the passed in outputCollection.  It would simplify calling code.

-- 
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