commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1214691 - in /commons/proper/cli/trunk/src/main/java/org/apache/commons/cli: HelpFormatter.java Parser.java
Date Thu, 15 Dec 2011 10:36:42 GMT
On 15 December 2011 10:30,  <ebourg@apache.org> wrote:
> Author: ebourg
> Date: Thu Dec 15 10:30:01 2011
> New Revision: 1214691
>
> URL: http://svn.apache.org/viewvc?rev=1214691&view=rev
> Log:
> Removed unnecessary final modifiers

Why?

> Modified:
>    commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/HelpFormatter.java
>    commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Parser.java
>
> Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/HelpFormatter.java
> URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/HelpFormatter.java?rev=1214691&r1=1214690&r2=1214691&view=diff
> ==============================================================================
> --- commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/HelpFormatter.java
(original)
> +++ commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/HelpFormatter.java
Thu Dec 15 10:30:01 2011
> @@ -537,7 +537,7 @@ public class HelpFormatter
>         StringBuffer buff = new StringBuffer(getSyntaxPrefix()).append(app).append("
");
>
>         // create a list for processed option groups
> -        final Collection<OptionGroup> processedGroups = new ArrayList<OptionGroup>();
> +        Collection<OptionGroup> processedGroups = new ArrayList<OptionGroup>();

-1

final should always be used where possible on fields.

Both to document that the field is not intended to be entirely
replaced, and also to help with safe data publication across threads.

>
>         List<Option> optList = new ArrayList<Option>(options.getOptions());
>         if (getOptionComparator() != null)
> @@ -596,7 +596,7 @@ public class HelpFormatter
>      * @param group the group to append
>      * @see #appendOption(StringBuffer,Option,boolean)
>      */
> -    private void appendOptionGroup(final StringBuffer buff, final OptionGroup group)
> +    private void appendOptionGroup(StringBuffer buff, OptionGroup group)

It's not as essential for parameters, but again is useful as documentation.

>     {
>         if (!group.isRequired())
>         {
> @@ -633,7 +633,7 @@ public class HelpFormatter
>      * @param option the Option to append
>      * @param required whether the Option is required or not
>      */
> -    private void appendOption(final StringBuffer buff, final Option option, final
boolean required)
> +    private void appendOption(StringBuffer buff, Option option, boolean required)
>     {
>         if (!required)
>         {
>
> Modified: commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Parser.java
> URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Parser.java?rev=1214691&r1=1214690&r2=1214691&view=diff
> ==============================================================================
> --- commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Parser.java (original)
> +++ commons/proper/cli/trunk/src/main/java/org/apache/commons/cli/Parser.java Thu Dec
15 10:30:01 2011
> @@ -43,7 +43,7 @@ public abstract class Parser implements
>     /** list of required options strings */
>     private List requiredOptions;
>
> -    protected void setOptions(final Options options)
> +    protected void setOptions(Options options)
>     {
>         this.options = options;
>         this.requiredOptions = new ArrayList(options.getRequiredOptions());
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message