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

Wrong @throws comments in DefaultedMap

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.5
    • Component/s: Map
    • Labels:
      None

      Description

      I found some @throws comments in DefaultedMap are inconsistent with the code or missing. For examples:

      1. The comment for defaultedMap(Map<K,V>, Factory<? extends V>) has wrong exception type:

      Line 108:

      /** ... @throws NullPointerException if map or factory is null ... */
      

      Line 112-114:

      if (factory == null) {
          throw new IllegalArgumentException("Factory must not be null");
      }
      

      2. For defaultMap(Map<K, V>, Transformer<? super K, ? extends V>, this null checking does not have corresponding @throws comment:

      Line 135-137:

      if (transformer == null) {
          throw new IllegalArgumentException("Transformer must not be null");
      }
      

      I suggest adding:

      @throws IllegalArgumentException if transformer is null.
      

      I'll submit a PR for these suggested changes.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                prodigysov Pengyu Nie
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h