Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-318

CollectionUtils.size(Object object) has impossible null check

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0-alpha1, 4.0
    • Collection
    • None

    Description

      CollectionUtils.size(Object object) has impossible null check:

          public static int size(Object object) {
              if (object == null) {
                  return 0;
              }
      ...
              } else if (object == null) {
                  throw new IllegalArgumentException("Unsupported object type: null");
      ...
      

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: