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

Inconsistent Javadoc comment and code for mapTransformer(Map<? super I, ? extends O>) in org.apache.commons.collections.TransformerUtils

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0, 4.x
    • 4.0-alpha1, 4.0
    • Collection
    • Platform Independent

    Description

      The Javadoc comment below states that the method "throws IllegalArgumentException if the map is null":
      /**
      ....

      • @param map the map to use to transform the objects
      • @return the transformer
      • @throws IllegalArgumentException if the map is null
        */
        public static <I, O> Transformer<I, O> mapTransformer(Map<? super I, ? extends O> map) { return MapTransformer.mapTransformer(map); }

        However, the method returns a NULL_INSTANCE object instead of throwing IllegalArgumentException when called with null.

      Suggested Fixes:
      1. Change "@throws IllegalArgumentException if the map is null" and "@return" to "@return NULL_INSTANCE if the map is null".
      or
      2. Remove the entire "throws IllegalArgumentException if the map is null".

      Attachments

        Activity

          People

            Unassigned Unassigned
            shinhwei SHIN HWEI TAN
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2m
                2m
                Remaining:
                Remaining Estimate - 2m
                2m
                Logged:
                Time Spent - Not Specified
                Not Specified