You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Chen Guoping (Jira)" <ji...@apache.org> on 2019/12/05 01:26:00 UTC
[jira] [Commented] (COLLECTIONS-739) Wrong @throws comments in
DefaultedMap
[ https://issues.apache.org/jira/browse/COLLECTIONS-739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16988368#comment-16988368 ]
Chen Guoping commented on COLLECTIONS-739:
------------------------------------------
Hi Pengyu Nie:
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:
{code:java}
if (factory == null) {
throw new NullPointerException("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 NullPointerException("Transformer must not be null");
}{code}
I suggest that updating IllegalArgumentException to NullPointerException .
Best wishes and regards,
Chen
> 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
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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)