[ 
https://issues.apache.org/jira/browse/LANG-1070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14328904#comment-14328904
 ] 

Duncan Jones edited comment on LANG-1070 at 2/20/15 1:25 PM:
-------------------------------------------------------------

The Javadoc is inconsistent. It gives the example of {{ArrayUtils.add(null, 
null) = \[null\]}} and states that {{array}} and {{element}} can both be null. 
But later it describes the behaviour differently:

bq. [The method returns] a new array containing the existing elements plus the 
new element The returned array type will be that of the input array (unless 
null), in which case it will have the same type as the element. _If both are 
null, an IllegalArgumentException is thrown_

It's not clear to me whether we can adjust the behaviour under the 
justification that it's a bug (versus documented behaviour).


was (Author: dmjones500):
The Javadoc is inconsistent. It gives the example of {{ArrayUtils.add(null, 
null) = \[null\]}} and states that {{array}} and {{element}} can both be null. 
But later it describes the behaviour differently:

bq. [The method returns] a new array containing the existing elements plus the 
new element The returned array type will be that of the input array (unless 
null), in which case it will have the same type as the element. _If both are 
null, an IllegalArgumentException is thrown_



> confusing example in ArrayUtils.add()
> -------------------------------------
>
>                 Key: LANG-1070
>                 URL: https://issues.apache.org/jira/browse/LANG-1070
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.3.2
>            Reporter: Paul Pogonyshev
>            Priority: Trivial
>
> Method documentation claims that
>     ArrayUtils.add(null, null)     = null
> However, this is not true since this parameter combination leads to an 
> exception.
> Either remove this line from documentation, or rewrite it to explicitly 
> mention the exception. Maybe there are other related methods with similar 
> problem in the docs.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to