[ 
https://issues.apache.org/jira/browse/IO-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12665995#action_12665995
 ] 

Jukka Zitting commented on IO-191:
----------------------------------

It would be easier to review and apply this patch if it was broken down to 
pieces based on the different types of changes.

See below for a list of the changes I'd rather not apply. Other changes seem 
reasonable enough, though it's debatable whether changing working code for no 
functional reason is wise as there's always the chance of accidentally 
introducing an error. Note that the use of foreach loops needs to wait until we 
switch to Java 5.

> Changing single character string literals to character literals in string 
> concatenations.

The benefit is insignificant and the drawback is added conceptual complexity 
(why are some parts of the expression strings and other characters). Also, in 
expressions where other parts are variables, there is no syntactical hint that 
it's a string concatenation expression instead of an integer sum.

> Introducing an initial size constant to collection constructors where the 
> expected size is known.

The benefit is in most cases insignificant and the drawback is the introduction 
of magic numbers in the code. Note that in specific cases this might give 
real-world performance or memory improvements, but those cases are better 
covered in separate issues with more detailed analysis.

> Clearing an existing collection instead of replacing it with a newly 
> allocated one.

Again, the benefit is typically insignificant, but as a drawback an immutable 
collection may become mutable. What if some other code is still concurrently 
iterating the collection? Perhaps the static analyzer has taken this into 
account, but will a future programmer that wants to modify the class?


> Possible improvements using static analysis.
> --------------------------------------------
>
>                 Key: IO-191
>                 URL: https://issues.apache.org/jira/browse/IO-191
>             Project: Commons IO
>          Issue Type: Improvement
>            Reporter: Peter Lawrey
>            Priority: Trivial
>         Attachments: commons-io-static-analysis.patch
>
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to