Pengyu Nie created COLLECTIONS-739:
--------------------------------------

             Summary: Wrong @throws comments in DefaultedMap
                 Key: COLLECTIONS-739
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-739
             Project: Commons Collections
          Issue Type: Improvement
          Components: Map
            Reporter: Pengyu Nie


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:
{code:java}
/** ... @throws NullPointerException if map or factory is null ... */
{code}
Line 112-114:
{code:java}
if (factory == null) {
    throw new IllegalArgumentException("Factory must not be null");
}
{code}

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

Line 135-137:
{code:java}
if (transformer == null) {
    throw new IllegalArgumentException("Transformer must not be null");
}
{code}

I suggest adding: 
{code:java}
@throws IllegalArgumentException if transformer is null.
{code}

I'll submit a PR for these suggested changes.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to