You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Neidhart (JIRA)" <ji...@apache.org> on 2013/02/28 20:59:16 UTC

[jira] [Resolved] (COLLECTIONS-318) CollectionUtils.size(Object object) has impossible null check

     [ https://issues.apache.org/jira/browse/COLLECTIONS-318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Neidhart resolved COLLECTIONS-318.
-----------------------------------------

    Resolution: Fixed
    
> CollectionUtils.size(Object object) has impossible null check
> -------------------------------------------------------------
>
>                 Key: COLLECTIONS-318
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-318
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Collection
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 4.0
>
>
> CollectionUtils.size(Object object) has impossible null check:
> {code}
>     public static int size(Object object) {
>         if (object == null) {
>             return 0;
>         }
> ...
>         } else if (object == null) {
>             throw new IllegalArgumentException("Unsupported object type: null");
> ...
> {code}
> The Javadoc specifically says that null is allowed, so I think the object == null clause needs to be removed - it can never be true, and is just confusing.

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