Add final modifier to method parameters.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@1797674 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/cli/AlreadySelectedException.java b/src/main/java/org/apache/commons/cli/AlreadySelectedException.java
index 896ed41..864b981 100644
--- a/src/main/java/org/apache/commons/cli/AlreadySelectedException.java
+++ b/src/main/java/org/apache/commons/cli/AlreadySelectedException.java
@@ -42,7 +42,7 @@
*
* @param message the detail message
*/
- public AlreadySelectedException(String message)
+ public AlreadySelectedException(final String message)
{
super(message);
}
@@ -55,7 +55,7 @@
* @param option the option that triggered the exception
* @since 1.2
*/
- public AlreadySelectedException(OptionGroup group, Option option)
+ public AlreadySelectedException(final OptionGroup group, final Option option)
{
this("The option '" + option.getKey() + "' was specified but an option from this group "
+ "has already been selected: '" + group.getSelected() + "'");
diff --git a/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java b/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
index 151aa8f..266dc8e 100644
--- a/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
+++ b/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
@@ -42,7 +42,7 @@
* @param option the partial option name
* @param matchingOptions the options matching the name
*/
- public AmbiguousOptionException(String option, Collection<String> matchingOptions)
+ public AmbiguousOptionException(final String option, final Collection<String> matchingOptions)
{
super(createMessage(option, matchingOptions), option);
this.matchingOptions = matchingOptions;
@@ -64,7 +64,7 @@
* @param matchingOptions
* @return
*/
- private static String createMessage(String option, Collection<String> matchingOptions)
+ private static String createMessage(final String option, final Collection<String> matchingOptions)
{
final StringBuilder buf = new StringBuilder("Ambiguous option: '");
buf.append(option);
diff --git a/src/main/java/org/apache/commons/cli/BasicParser.java b/src/main/java/org/apache/commons/cli/BasicParser.java
index d42472e..4ffd073 100644
--- a/src/main/java/org/apache/commons/cli/BasicParser.java
+++ b/src/main/java/org/apache/commons/cli/BasicParser.java
@@ -41,9 +41,9 @@
* @return The <code>arguments</code> String array.
*/
@Override
- protected String[] flatten(@SuppressWarnings("unused") Options options,
- String[] arguments,
- @SuppressWarnings("unused") boolean stopAtNonOption)
+ protected String[] flatten(@SuppressWarnings("unused") final Options options,
+ final String[] arguments,
+ @SuppressWarnings("unused") final boolean stopAtNonOption)
{
// just echo the arguments
return arguments;
diff --git a/src/main/java/org/apache/commons/cli/CommandLine.java b/src/main/java/org/apache/commons/cli/CommandLine.java
index cca26f6..8b72aa3 100644
--- a/src/main/java/org/apache/commons/cli/CommandLine.java
+++ b/src/main/java/org/apache/commons/cli/CommandLine.java
@@ -63,7 +63,7 @@
* @return true if set, false if not
* @since 1.5
*/
- public boolean hasOption(Option opt)
+ public boolean hasOption(final Option opt)
{
return options.contains(opt);
}
@@ -74,7 +74,7 @@
* @param opt Short name of the option
* @return true if set, false if not
*/
- public boolean hasOption(String opt)
+ public boolean hasOption(final String opt)
{
return hasOption(resolveOption(opt));
}
@@ -85,7 +85,7 @@
* @param opt character name of the option
* @return true if set, false if not
*/
- public boolean hasOption(char opt)
+ public boolean hasOption(final char opt)
{
return hasOption(String.valueOf(opt));
}
@@ -98,7 +98,7 @@
* @deprecated due to System.err message. Instead use getParsedOptionValue(String)
*/
@Deprecated
- public Object getOptionObject(String opt)
+ public Object getOptionObject(final String opt)
{
try
{
@@ -120,7 +120,7 @@
* @see PatternOptionBuilder
* @since 1.5
*/
- public Object getParsedOptionValue(Option option) throws ParseException
+ public Object getParsedOptionValue(final Option option) throws ParseException
{
if (option == null)
{
@@ -143,7 +143,7 @@
* @see PatternOptionBuilder
* @since 1.2
*/
- public Object getParsedOptionValue(String opt) throws ParseException
+ public Object getParsedOptionValue(final String opt) throws ParseException
{
return getParsedOptionValue(resolveOption(opt));
}
@@ -157,7 +157,7 @@
* @see PatternOptionBuilder
* @since 1.5
*/
- public Object getParsedOptionValue(char opt) throws ParseException
+ public Object getParsedOptionValue(final char opt) throws ParseException
{
return getParsedOptionValue(String.valueOf(opt));
}
@@ -169,7 +169,7 @@
* @param opt the name of the option
* @return the type of opt
*/
- public Object getOptionObject(char opt)
+ public Object getOptionObject(final char opt)
{
return getOptionObject(String.valueOf(opt));
}
@@ -182,7 +182,7 @@
* otherwise null.
* @since 1.5
*/
- public String getOptionValue(Option option)
+ public String getOptionValue(final Option option)
{
if (option == null)
{
@@ -199,7 +199,7 @@
* @return Value of the argument if option is set, and has an argument,
* otherwise null.
*/
- public String getOptionValue(String opt)
+ public String getOptionValue(final String opt)
{
return getOptionValue(resolveOption(opt));
}
@@ -211,7 +211,7 @@
* @return Value of the argument if option is set, and has an argument,
* otherwise null.
*/
- public String getOptionValue(char opt)
+ public String getOptionValue(final char opt)
{
return getOptionValue(String.valueOf(opt));
}
@@ -224,7 +224,7 @@
* otherwise null.
* @since 1.5
*/
- public String[] getOptionValues(Option option)
+ public String[] getOptionValues(final Option option)
{
final List<String> values = new ArrayList<String>();
@@ -246,7 +246,7 @@
* @return Values of the argument if option is set, and has an argument,
* otherwise null.
*/
- public String[] getOptionValues(String opt)
+ public String[] getOptionValues(final String opt)
{
return getOptionValues(resolveOption(opt));
}
@@ -283,7 +283,7 @@
* @return Values of the argument if option is set, and has an argument,
* otherwise null.
*/
- public String[] getOptionValues(char opt)
+ public String[] getOptionValues(final char opt)
{
return getOptionValues(String.valueOf(opt));
}
@@ -298,7 +298,7 @@
* otherwise <code>defaultValue</code>.
* @since 1.5
*/
- public String getOptionValue(Option option, String defaultValue)
+ public String getOptionValue(final Option option, final String defaultValue)
{
final String answer = getOptionValue(option);
return (answer != null) ? answer : defaultValue;
@@ -313,7 +313,7 @@
* @return Value of the argument if option is set, and has an argument,
* otherwise <code>defaultValue</code>.
*/
- public String getOptionValue(String opt, String defaultValue)
+ public String getOptionValue(final String opt, final String defaultValue)
{
return getOptionValue(resolveOption(opt), defaultValue);
}
@@ -327,7 +327,7 @@
* @return Value of the argument if option is set, and has an argument,
* otherwise <code>defaultValue</code>.
*/
- public String getOptionValue(char opt, String defaultValue)
+ public String getOptionValue(final char opt, final String defaultValue)
{
return getOptionValue(String.valueOf(opt), defaultValue);
}
@@ -345,7 +345,7 @@
* even if the option doesn't exists
* @since 1.5
*/
- public Properties getOptionProperties(Option option)
+ public Properties getOptionProperties(final Option option)
{
final Properties props = new Properties();
@@ -383,7 +383,7 @@
* even if the option doesn't exists
* @since 1.2
*/
- public Properties getOptionProperties(String opt)
+ public Properties getOptionProperties(final String opt)
{
final Properties props = new Properties();
@@ -459,7 +459,7 @@
*
* @param arg the unrecognized option/argument.
*/
- protected void addArg(String arg)
+ protected void addArg(final String arg)
{
args.add(arg);
}
@@ -469,7 +469,7 @@
*
* @param opt the processed option
*/
- protected void addOption(Option opt)
+ protected void addOption(final Option opt)
{
options.add(opt);
}
@@ -521,7 +521,7 @@
*
* @return this Builder instance for method chaining.
*/
- public Builder addOption(Option opt)
+ public Builder addOption(final Option opt)
{
commandLine.addOption(opt);
return this;
@@ -534,7 +534,7 @@
*
* @return this Builder instance for method chaining.
*/
- public Builder addArg(String arg)
+ public Builder addArg(final String arg)
{
commandLine.addArg(arg);
return this;
diff --git a/src/main/java/org/apache/commons/cli/DefaultParser.java b/src/main/java/org/apache/commons/cli/DefaultParser.java
index 33d772e..87f3fda 100644
--- a/src/main/java/org/apache/commons/cli/DefaultParser.java
+++ b/src/main/java/org/apache/commons/cli/DefaultParser.java
@@ -55,7 +55,7 @@
/** The required options and groups expected to be found when parsing the command line. */
protected List expectedOpts;
- public CommandLine parse(Options options, String[] arguments) throws ParseException
+ public CommandLine parse(final Options options, final String[] arguments) throws ParseException
{
return parse(options, arguments, null);
}
@@ -71,12 +71,12 @@
* @throws ParseException if there are any problems encountered
* while parsing the command line tokens.
*/
- public CommandLine parse(Options options, String[] arguments, Properties properties) throws ParseException
+ public CommandLine parse(final Options options, final String[] arguments, final Properties properties) throws ParseException
{
return parse(options, arguments, properties, false);
}
- public CommandLine parse(Options options, String[] arguments, boolean stopAtNonOption) throws ParseException
+ public CommandLine parse(final Options options, final String[] arguments, final boolean stopAtNonOption) throws ParseException
{
return parse(options, arguments, null, stopAtNonOption);
}
@@ -96,7 +96,7 @@
* @throws ParseException if there are any problems encountered
* while parsing the command line tokens.
*/
- public CommandLine parse(Options options, String[] arguments, Properties properties, boolean stopAtNonOption)
+ public CommandLine parse(final Options options, final String[] arguments, final Properties properties, final boolean stopAtNonOption)
throws ParseException
{
this.options = options;
@@ -137,7 +137,7 @@
*
* @param properties The value properties to be processed.
*/
- private void handleProperties(Properties properties) throws ParseException
+ private void handleProperties(final Properties properties) throws ParseException
{
if (properties == null)
{
@@ -218,7 +218,7 @@
* @param token the command line token to handle
* @throws ParseException
*/
- private void handleToken(String token) throws ParseException
+ private void handleToken(final String token) throws ParseException
{
currentToken = token;
@@ -258,7 +258,7 @@
*
* @param token
*/
- private boolean isArgument(String token)
+ private boolean isArgument(final String token)
{
return !isOption(token) || isNegativeNumber(token);
}
@@ -268,7 +268,7 @@
*
* @param token
*/
- private boolean isNegativeNumber(String token)
+ private boolean isNegativeNumber(final String token)
{
try
{
@@ -286,7 +286,7 @@
*
* @param token
*/
- private boolean isOption(String token)
+ private boolean isOption(final String token)
{
return isLongOption(token) || isShortOption(token);
}
@@ -296,7 +296,7 @@
*
* @param token
*/
- private boolean isShortOption(String token)
+ private boolean isShortOption(final String token)
{
// short options (-S, -SV, -S=V, -SV1=V2, -S1S2)
if (!token.startsWith("-") || token.length() == 1)
@@ -320,7 +320,7 @@
*
* @param token
*/
- private boolean isLongOption(String token)
+ private boolean isLongOption(final String token)
{
if (!token.startsWith("-") || token.length() == 1)
{
@@ -353,7 +353,7 @@
*
* @param token the command line token to handle
*/
- private void handleUnknownToken(String token) throws ParseException
+ private void handleUnknownToken(final String token) throws ParseException
{
if (token.startsWith("-") && token.length() > 1 && !stopAtNonOption)
{
@@ -377,7 +377,7 @@
*
* @param token the command line token to handle
*/
- private void handleLongOption(String token) throws ParseException
+ private void handleLongOption(final String token) throws ParseException
{
if (token.indexOf('=') == -1)
{
@@ -399,7 +399,7 @@
*
* @param token the command line token to handle
*/
- private void handleLongOptionWithoutEqual(String token) throws ParseException
+ private void handleLongOptionWithoutEqual(final String token) throws ParseException
{
final List<String> matchingOpts = options.getMatchingOptions(token);
if (matchingOpts.isEmpty())
@@ -426,7 +426,7 @@
*
* @param token the command line token to handle
*/
- private void handleLongOptionWithEqual(String token) throws ParseException
+ private void handleLongOptionWithEqual(final String token) throws ParseException
{
final int pos = token.indexOf('=');
@@ -479,7 +479,7 @@
*
* @param token the command line token to handle
*/
- private void handleShortAndLongOption(String token) throws ParseException
+ private void handleShortAndLongOption(final String token) throws ParseException
{
final String t = Util.stripLeadingHyphens(token);
@@ -576,7 +576,7 @@
*
* @param token
*/
- private String getLongPrefix(String token)
+ private String getLongPrefix(final String token)
{
final String t = Util.stripLeadingHyphens(token);
@@ -598,7 +598,7 @@
/**
* Check if the specified token is a Java-like property (-Dkey=value).
*/
- private boolean isJavaProperty(String token)
+ private boolean isJavaProperty(final String token)
{
final String opt = token.substring(0, 1);
final Option option = options.getOption(opt);
@@ -632,7 +632,7 @@
*
* @param option
*/
- private void updateRequiredOptions(Option option) throws AlreadySelectedException
+ private void updateRequiredOptions(final Option option) throws AlreadySelectedException
{
if (option.isRequired())
{
@@ -680,7 +680,7 @@
* @throws ParseException if there are any problems encountered
* while parsing the command line token.
*/
- protected void handleConcatenatedOptions(String token) throws ParseException
+ protected void handleConcatenatedOptions(final String token) throws ParseException
{
for (int i = 1; i < token.length(); i++)
{
diff --git a/src/main/java/org/apache/commons/cli/GnuParser.java b/src/main/java/org/apache/commons/cli/GnuParser.java
index bb55940..8e8536e 100644
--- a/src/main/java/org/apache/commons/cli/GnuParser.java
+++ b/src/main/java/org/apache/commons/cli/GnuParser.java
@@ -48,7 +48,7 @@
* @return a String array of the flattened arguments
*/
@Override
- protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)
+ protected String[] flatten(final Options options, final String[] arguments, final boolean stopAtNonOption)
{
final List<String> tokens = new ArrayList<String>();
diff --git a/src/main/java/org/apache/commons/cli/HelpFormatter.java b/src/main/java/org/apache/commons/cli/HelpFormatter.java
index 46e48d9..789e592 100644
--- a/src/main/java/org/apache/commons/cli/HelpFormatter.java
+++ b/src/main/java/org/apache/commons/cli/HelpFormatter.java
@@ -192,7 +192,7 @@
*
* @param width the new value of 'width'
*/
- public void setWidth(int width)
+ public void setWidth(final int width)
{
this.defaultWidth = width;
}
@@ -212,7 +212,7 @@
*
* @param padding the new value of 'leftPadding'
*/
- public void setLeftPadding(int padding)
+ public void setLeftPadding(final int padding)
{
this.defaultLeftPad = padding;
}
@@ -232,7 +232,7 @@
*
* @param padding the new value of 'descPadding'
*/
- public void setDescPadding(int padding)
+ public void setDescPadding(final int padding)
{
this.defaultDescPad = padding;
}
@@ -252,7 +252,7 @@
*
* @param prefix the new value of 'syntaxPrefix'
*/
- public void setSyntaxPrefix(String prefix)
+ public void setSyntaxPrefix(final String prefix)
{
this.defaultSyntaxPrefix = prefix;
}
@@ -272,7 +272,7 @@
*
* @param newline the new value of 'newLine'
*/
- public void setNewLine(String newline)
+ public void setNewLine(final String newline)
{
this.defaultNewLine = newline;
}
@@ -292,7 +292,7 @@
*
* @param prefix the new value of 'optPrefix'
*/
- public void setOptPrefix(String prefix)
+ public void setOptPrefix(final String prefix)
{
this.defaultOptPrefix = prefix;
}
@@ -312,7 +312,7 @@
*
* @param prefix the new value of 'longOptPrefix'
*/
- public void setLongOptPrefix(String prefix)
+ public void setLongOptPrefix(final String prefix)
{
this.defaultLongOptPrefix = prefix;
}
@@ -335,7 +335,7 @@
* @param longOptSeparator the separator, typically ' ' or '='.
* @since 1.3
*/
- public void setLongOptSeparator(String longOptSeparator)
+ public void setLongOptSeparator(final String longOptSeparator)
{
this.longOptSeparator = longOptSeparator;
}
@@ -356,7 +356,7 @@
*
* @param name the new value of 'argName'
*/
- public void setArgName(String name)
+ public void setArgName(final String name)
{
this.defaultArgName = name;
}
@@ -390,7 +390,7 @@
* @param comparator the {@link Comparator} to use for sorting the options
* @since 1.2
*/
- public void setOptionComparator(Comparator<Option> comparator)
+ public void setOptionComparator(final Comparator<Option> comparator)
{
this.optionComparator = comparator;
}
@@ -403,7 +403,7 @@
* @param cmdLineSyntax the syntax for this application
* @param options the Options instance
*/
- public void printHelp(String cmdLineSyntax, Options options)
+ public void printHelp(final String cmdLineSyntax, final Options options)
{
printHelp(getWidth(), cmdLineSyntax, null, options, null, false);
}
@@ -418,7 +418,7 @@
* @param autoUsage whether to print an automatically generated
* usage statement
*/
- public void printHelp(String cmdLineSyntax, Options options, boolean autoUsage)
+ public void printHelp(final String cmdLineSyntax, final Options options, final boolean autoUsage)
{
printHelp(getWidth(), cmdLineSyntax, null, options, null, autoUsage);
}
@@ -433,7 +433,7 @@
* @param options the Options instance
* @param footer the banner to display at the end of the help
*/
- public void printHelp(String cmdLineSyntax, String header, Options options, String footer)
+ public void printHelp(final String cmdLineSyntax, final String header, final Options options, final String footer)
{
printHelp(cmdLineSyntax, header, options, footer, false);
}
@@ -450,7 +450,7 @@
* @param autoUsage whether to print an automatically generated
* usage statement
*/
- public void printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage)
+ public void printHelp(final String cmdLineSyntax, final String header, final Options options, final String footer, final boolean autoUsage)
{
printHelp(getWidth(), cmdLineSyntax, header, options, footer, autoUsage);
}
@@ -466,7 +466,7 @@
* @param options the Options instance
* @param footer the banner to display at the end of the help
*/
- public void printHelp(int width, String cmdLineSyntax, String header, Options options, String footer)
+ public void printHelp(final int width, final String cmdLineSyntax, final String header, final Options options, final String footer)
{
printHelp(width, cmdLineSyntax, header, options, footer, false);
}
@@ -484,8 +484,8 @@
* @param autoUsage whether to print an automatically generated
* usage statement
*/
- public void printHelp(int width, String cmdLineSyntax, String header,
- Options options, String footer, boolean autoUsage)
+ public void printHelp(final int width, final String cmdLineSyntax, final String header,
+ final Options options, final String footer, final boolean autoUsage)
{
final PrintWriter pw = new PrintWriter(System.out);
@@ -510,9 +510,9 @@
*
* @throws IllegalStateException if there is no room to print a line
*/
- public void printHelp(PrintWriter pw, int width, String cmdLineSyntax,
- String header, Options options, int leftPad,
- int descPad, String footer)
+ public void printHelp(final PrintWriter pw, final int width, final String cmdLineSyntax,
+ final String header, final Options options, final int leftPad,
+ final int descPad, final String footer)
{
printHelp(pw, width, cmdLineSyntax, header, options, leftPad, descPad, footer, false);
}
@@ -537,9 +537,9 @@
*
* @throws IllegalStateException if there is no room to print a line
*/
- public void printHelp(PrintWriter pw, int width, String cmdLineSyntax,
- String header, Options options, int leftPad,
- int descPad, String footer, boolean autoUsage)
+ public void printHelp(final PrintWriter pw, final int width, final String cmdLineSyntax,
+ final String header, final Options options, final int leftPad,
+ final int descPad, final String footer, final boolean autoUsage)
{
if (cmdLineSyntax == null || cmdLineSyntax.length() == 0)
{
@@ -576,7 +576,7 @@
* @param app The application name
* @param options The command line Options
*/
- public void printUsage(PrintWriter pw, int width, String app, Options options)
+ public void printUsage(final PrintWriter pw, final int width, final String app, final Options options)
{
// initialise the string buffer
final StringBuffer buff = new StringBuffer(getSyntaxPrefix()).append(app).append(" ");
@@ -641,7 +641,7 @@
* @param group the group to append
* @see #appendOption(StringBuffer,Option,boolean)
*/
- private void appendOptionGroup(StringBuffer buff, OptionGroup group)
+ private void appendOptionGroup(final StringBuffer buff, final OptionGroup group)
{
if (!group.isRequired())
{
@@ -678,7 +678,7 @@
* @param option the Option to append
* @param required whether the Option is required or not
*/
- private void appendOption(StringBuffer buff, Option option, boolean required)
+ private void appendOption(final StringBuffer buff, final Option option, final boolean required)
{
if (!required)
{
@@ -716,7 +716,7 @@
* @param width The number of characters per line for the usage statement.
* @param cmdLineSyntax The usage statement.
*/
- public void printUsage(PrintWriter pw, int width, String cmdLineSyntax)
+ public void printUsage(final PrintWriter pw, final int width, final String cmdLineSyntax)
{
final int argPos = cmdLineSyntax.indexOf(' ') + 1;
@@ -735,8 +735,8 @@
* @param descPad the number of characters of padding to be prefixed
* to each description line
*/
- public void printOptions(PrintWriter pw, int width, Options options,
- int leftPad, int descPad)
+ public void printOptions(final PrintWriter pw, final int width, final Options options,
+ final int leftPad, final int descPad)
{
final StringBuffer sb = new StringBuffer();
@@ -751,7 +751,7 @@
* @param width The number of characters to display per line
* @param text The text to be written to the PrintWriter
*/
- public void printWrapped(PrintWriter pw, int width, String text)
+ public void printWrapped(final PrintWriter pw, final int width, final String text)
{
printWrapped(pw, width, 0, text);
}
@@ -764,7 +764,7 @@
* @param nextLineTabStop The position on the next line for the first tab.
* @param text The text to be written to the PrintWriter
*/
- public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text)
+ public void printWrapped(final PrintWriter pw, final int width, final int nextLineTabStop, final String text)
{
final StringBuffer sb = new StringBuffer(text.length());
@@ -788,7 +788,7 @@
*
* @return the StringBuffer with the rendered Options contents.
*/
- protected StringBuffer renderOptions(StringBuffer sb, int width, Options options, int leftPad, int descPad)
+ protected StringBuffer renderOptions(final StringBuffer sb, final int width, final Options options, final int leftPad, final int descPad)
{
final String lpad = createPadding(leftPad);
final String dpad = createPadding(descPad);
@@ -887,7 +887,7 @@
*
* @return the StringBuffer with the rendered Options contents.
*/
- protected StringBuffer renderWrappedText(StringBuffer sb, int width,
+ protected StringBuffer renderWrappedText(final StringBuffer sb, final int width,
int nextLineTabStop, String text)
{
int pos = findWrapPos(text, width, 0);
@@ -939,7 +939,7 @@
* @param nextLineTabStop The position on the next line for the first tab.
* @param text The text to be rendered.
*/
- private Appendable renderWrappedTextBlock(StringBuffer sb, int width, int nextLineTabStop, String text)
+ private Appendable renderWrappedTextBlock(final StringBuffer sb, final int width, final int nextLineTabStop, final String text)
{
try
{
@@ -981,7 +981,7 @@
* @return position on which the text must be wrapped or -1 if the wrap
* position is at the end of the text
*/
- protected int findWrapPos(String text, int width, int startPos)
+ protected int findWrapPos(final String text, final int width, final int startPos)
{
// the line ends before the max wrap pos or a new line char found
int pos = text.indexOf('\n', startPos);
@@ -1030,7 +1030,7 @@
*
* @return The String of padding
*/
- protected String createPadding(int len)
+ protected String createPadding(final int len)
{
final char[] padding = new char[len];
Arrays.fill(padding, ' ');
@@ -1045,7 +1045,7 @@
*
* @return The String of without the trailing padding
*/
- protected String rtrim(String s)
+ protected String rtrim(final String s)
{
if (s == null || s.length() == 0)
{
@@ -1085,7 +1085,7 @@
* the first argument is less than, equal to, or greater than the
* second.
*/
- public int compare(Option opt1, Option opt2)
+ public int compare(final Option opt1, final Option opt2)
{
return opt1.getKey().compareToIgnoreCase(opt2.getKey());
}
diff --git a/src/main/java/org/apache/commons/cli/MissingArgumentException.java b/src/main/java/org/apache/commons/cli/MissingArgumentException.java
index 3ea5c36..4ca42b3 100644
--- a/src/main/java/org/apache/commons/cli/MissingArgumentException.java
+++ b/src/main/java/org/apache/commons/cli/MissingArgumentException.java
@@ -39,7 +39,7 @@
*
* @param message the detail message
*/
- public MissingArgumentException(String message)
+ public MissingArgumentException(final String message)
{
super(message);
}
@@ -51,7 +51,7 @@
* @param option the option requiring an argument
* @since 1.2
*/
- public MissingArgumentException(Option option)
+ public MissingArgumentException(final Option option)
{
this("Missing argument for option: " + option.getKey());
this.option = option;
diff --git a/src/main/java/org/apache/commons/cli/MissingOptionException.java b/src/main/java/org/apache/commons/cli/MissingOptionException.java
index f9cac0e..cd5b42d 100644
--- a/src/main/java/org/apache/commons/cli/MissingOptionException.java
+++ b/src/main/java/org/apache/commons/cli/MissingOptionException.java
@@ -39,7 +39,7 @@
*
* @param message the detail message
*/
- public MissingOptionException(String message)
+ public MissingOptionException(final String message)
{
super(message);
}
@@ -51,7 +51,7 @@
* @param missingOptions the list of missing options and groups
* @since 1.2
*/
- public MissingOptionException(List missingOptions)
+ public MissingOptionException(final List missingOptions)
{
this(createMessage(missingOptions));
this.missingOptions = missingOptions;
@@ -75,7 +75,7 @@
* @param missingOptions the list of missing options and groups
* @since 1.2
*/
- private static String createMessage(List<?> missingOptions)
+ private static String createMessage(final List<?> missingOptions)
{
final StringBuilder buf = new StringBuilder("Missing required option");
buf.append(missingOptions.size() == 1 ? "" : "s");
diff --git a/src/main/java/org/apache/commons/cli/Option.java b/src/main/java/org/apache/commons/cli/Option.java
index 35f2546..5242186 100644
--- a/src/main/java/org/apache/commons/cli/Option.java
+++ b/src/main/java/org/apache/commons/cli/Option.java
@@ -108,7 +108,7 @@
* @throws IllegalArgumentException if there are any non valid
* Option characters in <code>opt</code>.
*/
- public Option(String opt, String description) throws IllegalArgumentException
+ public Option(final String opt, final String description) throws IllegalArgumentException
{
this(opt, null, false, description);
}
@@ -123,7 +123,7 @@
* @throws IllegalArgumentException if there are any non valid
* Option characters in <code>opt</code>.
*/
- public Option(String opt, boolean hasArg, String description) throws IllegalArgumentException
+ public Option(final String opt, final boolean hasArg, final String description) throws IllegalArgumentException
{
this(opt, null, hasArg, description);
}
@@ -139,7 +139,7 @@
* @throws IllegalArgumentException if there are any non valid
* Option characters in <code>opt</code>.
*/
- public Option(String opt, String longOpt, boolean hasArg, String description)
+ public Option(final String opt, final String longOpt, final boolean hasArg, final String description)
throws IllegalArgumentException
{
// ensure that the option is valid
@@ -215,7 +215,7 @@
* @deprecated since 1.3, use {@link #setType(Class)} instead
*/
@Deprecated
- public void setType(Object type)
+ public void setType(final Object type)
{
setType((Class<?>) type);
}
@@ -226,7 +226,7 @@
* @param type the type of this Option
* @since 1.3
*/
- public void setType(Class<?> type)
+ public void setType(final Class<?> type)
{
this.type = type;
}
@@ -246,7 +246,7 @@
*
* @param longOpt the long name of this Option
*/
- public void setLongOpt(String longOpt)
+ public void setLongOpt(final String longOpt)
{
this.longOpt = longOpt;
}
@@ -257,7 +257,7 @@
* @param optionalArg specifies whether the Option can have
* an optional argument.
*/
- public void setOptionalArg(boolean optionalArg)
+ public void setOptionalArg(final boolean optionalArg)
{
this.optionalArg = optionalArg;
}
@@ -306,7 +306,7 @@
* @param description The description of this option
* @since 1.1
*/
- public void setDescription(String description)
+ public void setDescription(final String description)
{
this.description = description;
}
@@ -326,7 +326,7 @@
*
* @param required specifies whether this Option is mandatory
*/
- public void setRequired(boolean required)
+ public void setRequired(final boolean required)
{
this.required = required;
}
@@ -336,7 +336,7 @@
*
* @param argName the display name for the argument value.
*/
- public void setArgName(String argName)
+ public void setArgName(final String argName)
{
this.argName = argName;
}
@@ -376,7 +376,7 @@
*
* @param num the number of argument values
*/
- public void setArgs(int num)
+ public void setArgs(final int num)
{
this.numberOfArgs = num;
}
@@ -387,7 +387,7 @@
*
* @param sep The value separator.
*/
- public void setValueSeparator(char sep)
+ public void setValueSeparator(final char sep)
{
this.valuesep = sep;
}
@@ -437,7 +437,7 @@
*
* @param value is a/the value of this Option
*/
- void addValueForProcessing(String value)
+ void addValueForProcessing(final String value)
{
if (numberOfArgs == UNINITIALIZED)
{
@@ -501,7 +501,7 @@
*
* @since 1.0.1
*/
- private void add(String value)
+ private void add(final String value)
{
if (!acceptsArg())
{
@@ -536,7 +536,7 @@
* @throws IndexOutOfBoundsException if index is less than 1
* or greater than the number of the values for this Option.
*/
- public String getValue(int index) throws IndexOutOfBoundsException
+ public String getValue(final int index) throws IndexOutOfBoundsException
{
return hasNoValues() ? null : values.get(index);
}
@@ -551,7 +551,7 @@
* @return the value/first value of this Option or the
* <code>defaultValue</code> if there are no values.
*/
- public String getValue(String defaultValue)
+ public String getValue(final String defaultValue)
{
final String value = getValue();
@@ -630,7 +630,7 @@
}
@Override
- public boolean equals(Object o)
+ public boolean equals(final Object o)
{
if (this == o)
{
@@ -712,7 +712,7 @@
* @deprecated
*/
@Deprecated
- public boolean addValue(String value)
+ public boolean addValue(final String value)
{
throw new UnsupportedOperationException("The addValue method is not intended for client use. "
+ "Subclasses should use the addValueForProcessing method instead. ");
diff --git a/src/main/java/org/apache/commons/cli/OptionBuilder.java b/src/main/java/org/apache/commons/cli/OptionBuilder.java
index c0b0c69..ba04155 100644
--- a/src/main/java/org/apache/commons/cli/OptionBuilder.java
+++ b/src/main/java/org/apache/commons/cli/OptionBuilder.java
@@ -94,7 +94,7 @@
* @param newLongopt the long option value
* @return the OptionBuilder instance
*/
- public static OptionBuilder withLongOpt(String newLongopt)
+ public static OptionBuilder withLongOpt(final String newLongopt)
{
OptionBuilder.longopt = newLongopt;
@@ -120,7 +120,7 @@
* @param hasArg if true then the Option has an argument value
* @return the OptionBuilder instance
*/
- public static OptionBuilder hasArg(boolean hasArg)
+ public static OptionBuilder hasArg(final boolean hasArg)
{
OptionBuilder.numberOfArgs = hasArg ? 1 : Option.UNINITIALIZED;
@@ -133,7 +133,7 @@
* @param name the name for the argument value
* @return the OptionBuilder instance
*/
- public static OptionBuilder withArgName(String name)
+ public static OptionBuilder withArgName(final String name)
{
OptionBuilder.argName = name;
@@ -171,7 +171,7 @@
*
* @return the OptionBuilder instance
*/
- public static OptionBuilder withValueSeparator(char sep)
+ public static OptionBuilder withValueSeparator(final char sep)
{
OptionBuilder.valuesep = sep;
@@ -208,7 +208,7 @@
* @param newRequired if true then the Option is required
* @return the OptionBuilder instance
*/
- public static OptionBuilder isRequired(boolean newRequired)
+ public static OptionBuilder isRequired(final boolean newRequired)
{
OptionBuilder.required = newRequired;
@@ -233,7 +233,7 @@
* @param num the number of args that the option can have
* @return the OptionBuilder instance
*/
- public static OptionBuilder hasArgs(int num)
+ public static OptionBuilder hasArgs(final int num)
{
OptionBuilder.numberOfArgs = num;
@@ -273,7 +273,7 @@
* the next Option created can have.
* @return the OptionBuilder instance
*/
- public static OptionBuilder hasOptionalArgs(int numArgs)
+ public static OptionBuilder hasOptionalArgs(final int numArgs)
{
OptionBuilder.numberOfArgs = numArgs;
OptionBuilder.optionalArg = true;
@@ -293,7 +293,7 @@
* @deprecated since 1.3, use {@link #withType(Class)} instead
*/
@Deprecated
- public static OptionBuilder withType(Object newType)
+ public static OptionBuilder withType(final Object newType)
{
return withType((Class<?>) newType);
}
@@ -306,7 +306,7 @@
* @return the OptionBuilder instance
* @since 1.3
*/
- public static OptionBuilder withType(Class<?> newType)
+ public static OptionBuilder withType(final Class<?> newType)
{
OptionBuilder.type = newType;
@@ -319,7 +319,7 @@
* @param newDescription a description of the Option's purpose
* @return the OptionBuilder instance
*/
- public static OptionBuilder withDescription(String newDescription)
+ public static OptionBuilder withDescription(final String newDescription)
{
OptionBuilder.description = newDescription;
@@ -335,7 +335,7 @@
* @throws IllegalArgumentException if <code>opt</code> is not
* a valid character. See Option.
*/
- public static Option create(char opt) throws IllegalArgumentException
+ public static Option create(final char opt) throws IllegalArgumentException
{
return create(String.valueOf(opt));
}
@@ -367,7 +367,7 @@
* @throws IllegalArgumentException if <code>opt</code> is not
* a valid character. See Option.
*/
- public static Option create(String opt) throws IllegalArgumentException
+ public static Option create(final String opt) throws IllegalArgumentException
{
Option option = null;
try
diff --git a/src/main/java/org/apache/commons/cli/OptionGroup.java b/src/main/java/org/apache/commons/cli/OptionGroup.java
index 3f52ff7..126d928 100644
--- a/src/main/java/org/apache/commons/cli/OptionGroup.java
+++ b/src/main/java/org/apache/commons/cli/OptionGroup.java
@@ -48,7 +48,7 @@
* @param option the option to add to this group
* @return this option group with the option added
*/
- public OptionGroup addOption(Option option)
+ public OptionGroup addOption(final Option option)
{
// key - option name
// value - the option
@@ -83,7 +83,7 @@
* @throws AlreadySelectedException if an option from this group has
* already been selected.
*/
- public void setSelected(Option option) throws AlreadySelectedException
+ public void setSelected(final Option option) throws AlreadySelectedException
{
if (option == null)
{
@@ -116,7 +116,7 @@
/**
* @param required specifies if this group is required
*/
- public void setRequired(boolean required)
+ public void setRequired(final boolean required)
{
this.required = required;
}
diff --git a/src/main/java/org/apache/commons/cli/OptionValidator.java b/src/main/java/org/apache/commons/cli/OptionValidator.java
index f761f12..98f22e5 100644
--- a/src/main/java/org/apache/commons/cli/OptionValidator.java
+++ b/src/main/java/org/apache/commons/cli/OptionValidator.java
@@ -42,7 +42,7 @@
* @param opt The option string to validate, may be null
* @throws IllegalArgumentException if the Option is not valid.
*/
- static void validateOption(String opt) throws IllegalArgumentException
+ static void validateOption(final String opt) throws IllegalArgumentException
{
// if opt is NULL do not check further
if (opt == null)
@@ -81,7 +81,7 @@
* @param c the option to validate
* @return true if <code>c</code> is a letter, '?' or '@', otherwise false.
*/
- private static boolean isValidOpt(char c)
+ private static boolean isValidOpt(final char c)
{
return isValidChar(c) || c == '?' || c == '@';
}
@@ -92,7 +92,7 @@
* @param c the character to validate
* @return true if <code>c</code> is a letter.
*/
- private static boolean isValidChar(char c)
+ private static boolean isValidChar(final char c)
{
return Character.isJavaIdentifierPart(c);
}
diff --git a/src/main/java/org/apache/commons/cli/Options.java b/src/main/java/org/apache/commons/cli/Options.java
index 056d647..41373cc 100644
--- a/src/main/java/org/apache/commons/cli/Options.java
+++ b/src/main/java/org/apache/commons/cli/Options.java
@@ -65,7 +65,7 @@
* @param group the OptionGroup that is to be added
* @return the resulting Options instance
*/
- public Options addOptionGroup(OptionGroup group)
+ public Options addOptionGroup(final OptionGroup group)
{
if (group.isRequired())
{
@@ -108,7 +108,7 @@
* @return the resulting Options instance
* @since 1.3
*/
- public Options addOption(String opt, String description)
+ public Options addOption(final String opt, final String description)
{
addOption(opt, null, false, description);
return this;
@@ -126,7 +126,7 @@
* @param description Self-documenting description
* @return the resulting Options instance
*/
- public Options addOption(String opt, boolean hasArg, String description)
+ public Options addOption(final String opt, final boolean hasArg, final String description)
{
addOption(opt, null, hasArg, description);
return this;
@@ -145,7 +145,7 @@
* @param description Self-documenting description
* @return the resulting Options instance
*/
- public Options addOption(String opt, String longOpt, boolean hasArg, String description)
+ public Options addOption(final String opt, final String longOpt, final boolean hasArg, final String description)
{
addOption(new Option(opt, longOpt, hasArg, description));
return this;
@@ -173,7 +173,7 @@
* @return the resulting Options instance
* @since 1.4
*/
- public Options addRequiredOption(String opt, String longOpt, boolean hasArg, String description)
+ public Options addRequiredOption(final String opt, final String longOpt, final boolean hasArg, final String description)
{
final Option option = new Option(opt, longOpt, hasArg, description);
option.setRequired(true);
@@ -187,7 +187,7 @@
* @param opt the option that is to be added
* @return the resulting Options instance
*/
- public Options addOption(Option opt)
+ public Options addOption(final Option opt)
{
final String key = opt.getKey();
@@ -341,7 +341,7 @@
* @param opt the option whose OptionGroup is being queried.
* @return the OptionGroup if <code>opt</code> is part of an OptionGroup, otherwise return null
*/
- public OptionGroup getOptionGroup(Option opt)
+ public OptionGroup getOptionGroup(final Option opt)
{
return optionGroups.get(opt.getKey());
}
diff --git a/src/main/java/org/apache/commons/cli/ParseException.java b/src/main/java/org/apache/commons/cli/ParseException.java
index c07089c..dba1d5d 100644
--- a/src/main/java/org/apache/commons/cli/ParseException.java
+++ b/src/main/java/org/apache/commons/cli/ParseException.java
@@ -35,7 +35,7 @@
*
* @param message the detail message
*/
- public ParseException(String message)
+ public ParseException(final String message)
{
super(message);
}
diff --git a/src/main/java/org/apache/commons/cli/Parser.java b/src/main/java/org/apache/commons/cli/Parser.java
index 8fd0b5f..0fe5984 100644
--- a/src/main/java/org/apache/commons/cli/Parser.java
+++ b/src/main/java/org/apache/commons/cli/Parser.java
@@ -42,7 +42,7 @@
/** list of required options strings */
private List requiredOptions;
- protected void setOptions(Options options)
+ protected void setOptions(final Options options)
{
this.options = options;
this.requiredOptions = new ArrayList(options.getRequiredOptions());
@@ -83,7 +83,7 @@
* @throws ParseException if there are any problems encountered
* while parsing the command line tokens.
*/
- public CommandLine parse(Options options, String[] arguments) throws ParseException
+ public CommandLine parse(final Options options, final String[] arguments) throws ParseException
{
return parse(options, arguments, null, false);
}
@@ -100,7 +100,7 @@
*
* @since 1.1
*/
- public CommandLine parse(Options options, String[] arguments, Properties properties) throws ParseException
+ public CommandLine parse(final Options options, final String[] arguments, final Properties properties) throws ParseException
{
return parse(options, arguments, properties, false);
}
@@ -118,7 +118,7 @@
* @return the <code>CommandLine</code>
* @throws ParseException if an error occurs when parsing the arguments.
*/
- public CommandLine parse(Options options, String[] arguments, boolean stopAtNonOption) throws ParseException
+ public CommandLine parse(final Options options, final String[] arguments, final boolean stopAtNonOption) throws ParseException
{
return parse(options, arguments, null, stopAtNonOption);
}
@@ -142,7 +142,7 @@
*
* @since 1.1
*/
- public CommandLine parse(Options options, String[] arguments, Properties properties, boolean stopAtNonOption)
+ public CommandLine parse(final Options options, String[] arguments, final Properties properties, final boolean stopAtNonOption)
throws ParseException
{
// clear out the data in options in case it's been used before (CLI-71)
@@ -251,7 +251,7 @@
* @throws ParseException if there are any problems encountered
* while processing the properties.
*/
- protected void processProperties(Properties properties) throws ParseException
+ protected void processProperties(final Properties properties) throws ParseException
{
if (properties == null)
{
@@ -332,7 +332,7 @@
* @throws ParseException if an argument value is required
* and it is has not been found.
*/
- public void processArgs(Option opt, ListIterator<String> iter) throws ParseException
+ public void processArgs(final Option opt, final ListIterator<String> iter) throws ParseException
{
// loop until an option is found
while (iter.hasNext())
@@ -373,7 +373,7 @@
*
* @throws ParseException if <code>arg</code> does not represent an Option
*/
- protected void processOption(String arg, ListIterator<String> iter) throws ParseException
+ protected void processOption(final String arg, final ListIterator<String> iter) throws ParseException
{
final boolean hasOption = getOptions().hasOption(arg);
@@ -404,7 +404,7 @@
*
* @param opt
*/
- private void updateRequiredOptions(Option opt) throws ParseException
+ private void updateRequiredOptions(final Option opt) throws ParseException
{
// if the option is a required option remove the option from
// the requiredOptions list
diff --git a/src/main/java/org/apache/commons/cli/PatternOptionBuilder.java b/src/main/java/org/apache/commons/cli/PatternOptionBuilder.java
index 69002b5..90ca7d5 100644
--- a/src/main/java/org/apache/commons/cli/PatternOptionBuilder.java
+++ b/src/main/java/org/apache/commons/cli/PatternOptionBuilder.java
@@ -93,7 +93,7 @@
* @param ch the specified character
* @return The class that <code>ch</code> represents
*/
- public static Object getValueClass(char ch)
+ public static Object getValueClass(final char ch)
{
switch (ch)
{
@@ -127,7 +127,7 @@
* @param ch the specified character
* @return true if <code>ch</code> is a value code, otherwise false.
*/
- public static boolean isValueCode(char ch)
+ public static boolean isValueCode(final char ch)
{
return ch == '@'
|| ch == ':'
@@ -147,7 +147,7 @@
* @param pattern the pattern string
* @return The {@link Options} instance
*/
- public static Options parsePattern(String pattern)
+ public static Options parsePattern(final String pattern)
{
char opt = ' ';
boolean required = false;
diff --git a/src/main/java/org/apache/commons/cli/PosixParser.java b/src/main/java/org/apache/commons/cli/PosixParser.java
index 53ceb51..9a2408e 100644
--- a/src/main/java/org/apache/commons/cli/PosixParser.java
+++ b/src/main/java/org/apache/commons/cli/PosixParser.java
@@ -93,7 +93,7 @@
* @return The flattened <code>arguments</code> String array.
*/
@Override
- protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption) throws ParseException
+ protected String[] flatten(final Options options, final String[] arguments, final boolean stopAtNonOption) throws ParseException
{
init();
this.options = options;
@@ -179,7 +179,7 @@
*
* @param iter An iterator over the remaining tokens
*/
- private void gobble(Iterator<String> iter)
+ private void gobble(final Iterator<String> iter)
{
if (eatTheRest)
{
@@ -197,7 +197,7 @@
*
* @param value The current token
*/
- private void processNonOptionToken(String value, boolean stopAtNonOption)
+ private void processNonOptionToken(final String value, final boolean stopAtNonOption)
{
if (stopAtNonOption && (currentOption == null || !currentOption.hasArg()))
{
@@ -220,7 +220,7 @@
* @param stopAtNonOption Specifies whether flattening should halt
* at the first non option.
*/
- private void processOptionToken(String token, boolean stopAtNonOption)
+ private void processOptionToken(final String token, final boolean stopAtNonOption)
{
if (stopAtNonOption && !options.hasOption(token))
{
@@ -261,7 +261,7 @@
* @param stopAtNonOption Specifies whether to stop processing
* at the first non-Option encountered.
*/
- protected void burstToken(String token, boolean stopAtNonOption)
+ protected void burstToken(final String token, final boolean stopAtNonOption)
{
for (int i = 1; i < token.length(); i++)
{
diff --git a/src/main/java/org/apache/commons/cli/TypeHandler.java b/src/main/java/org/apache/commons/cli/TypeHandler.java
index f27a587..f9c14dd 100644
--- a/src/main/java/org/apache/commons/cli/TypeHandler.java
+++ b/src/main/java/org/apache/commons/cli/TypeHandler.java
@@ -44,7 +44,7 @@
* the value of <code>str</code>.
* @throws ParseException if the value creation for the given object type failed
*/
- public static Object createValue(String str, Object obj) throws ParseException
+ public static Object createValue(final String str, final Object obj) throws ParseException
{
return createValue(str, (Class<?>) obj);
}
@@ -59,7 +59,7 @@
* the value of <code>str</code>.
* @throws ParseException if the value creation for the given class failed
*/
- public static Object createValue(String str, Class<?> clazz) throws ParseException
+ public static Object createValue(final String str, final Class<?> clazz) throws ParseException
{
if (PatternOptionBuilder.STRING_VALUE == clazz)
{
@@ -110,7 +110,7 @@
* @return the initialised object
* @throws ParseException if the class could not be found or the object could not be created
*/
- public static Object createObject(String classname) throws ParseException
+ public static Object createObject(final String classname) throws ParseException
{
Class<?> cl;
@@ -141,7 +141,7 @@
* @return the number represented by <code>str</code>
* @throws ParseException if <code>str</code> is not a number
*/
- public static Number createNumber(String str) throws ParseException
+ public static Number createNumber(final String str) throws ParseException
{
try
{
@@ -164,7 +164,7 @@
* @return The class if it is found
* @throws ParseException if the class could not be found
*/
- public static Class<?> createClass(String classname) throws ParseException
+ public static Class<?> createClass(final String classname) throws ParseException
{
try
{
@@ -187,7 +187,7 @@
* otherwise return null.
* @throws UnsupportedOperationException always
*/
- public static Date createDate(String str)
+ public static Date createDate(final String str)
{
throw new UnsupportedOperationException("Not yet implemented");
}
@@ -199,7 +199,7 @@
* @return The URL in <code>str</code> is well-formed
* @throws ParseException if the URL in <code>str</code> is not well-formed
*/
- public static URL createURL(String str) throws ParseException
+ public static URL createURL(final String str) throws ParseException
{
try
{
@@ -217,7 +217,7 @@
* @param str the File location
* @return The file represented by <code>str</code>.
*/
- public static File createFile(String str)
+ public static File createFile(final String str)
{
return new File(str);
}
@@ -232,7 +232,7 @@
* @return The File[] represented by <code>str</code>.
* @throws UnsupportedOperationException always
*/
- public static File[] createFiles(String str)
+ public static File[] createFiles(final String str)
{
// to implement/port:
// return FileW.findFiles(str);
diff --git a/src/main/java/org/apache/commons/cli/UnrecognizedOptionException.java b/src/main/java/org/apache/commons/cli/UnrecognizedOptionException.java
index d6a718e..988d869 100644
--- a/src/main/java/org/apache/commons/cli/UnrecognizedOptionException.java
+++ b/src/main/java/org/apache/commons/cli/UnrecognizedOptionException.java
@@ -39,7 +39,7 @@
*
* @param message the detail message
*/
- public UnrecognizedOptionException(String message)
+ public UnrecognizedOptionException(final String message)
{
super(message);
}
@@ -52,7 +52,7 @@
* @param option the unrecognized option
* @since 1.2
*/
- public UnrecognizedOptionException(String message, String option)
+ public UnrecognizedOptionException(final String message, final String option)
{
this(message);
this.option = option;
diff --git a/src/main/java/org/apache/commons/cli/Util.java b/src/main/java/org/apache/commons/cli/Util.java
index fe22d6c..f83f45e 100644
--- a/src/main/java/org/apache/commons/cli/Util.java
+++ b/src/main/java/org/apache/commons/cli/Util.java
@@ -32,7 +32,7 @@
*
* @return the new String.
*/
- static String stripLeadingHyphens(String str)
+ static String stripLeadingHyphens(final String str)
{
if (str == null)
{
diff --git a/src/test/java/org/apache/commons/cli/HelpFormatterTest.java b/src/test/java/org/apache/commons/cli/HelpFormatterTest.java
index 6036d97..0df8d62 100644
--- a/src/test/java/org/apache/commons/cli/HelpFormatterTest.java
+++ b/src/test/java/org/apache/commons/cli/HelpFormatterTest.java
@@ -287,7 +287,7 @@
final HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.setOptionComparator(new Comparator<Option>()
{
- public int compare(Option opt1, Option opt2)
+ public int compare(final Option opt1, final Option opt2)
{
// reverses the functionality of the default comparator
return opt2.getKey().compareToIgnoreCase(opt1.getKey());
diff --git a/src/test/java/org/apache/commons/cli/OptionTest.java b/src/test/java/org/apache/commons/cli/OptionTest.java
index 66cb11d..70e50a2 100644
--- a/src/test/java/org/apache/commons/cli/OptionTest.java
+++ b/src/test/java/org/apache/commons/cli/OptionTest.java
@@ -31,13 +31,13 @@
{
private static final long serialVersionUID = 1L;
- public TestOption(String opt, boolean hasArg, String description) throws IllegalArgumentException
+ public TestOption(final String opt, final boolean hasArg, final String description) throws IllegalArgumentException
{
super(opt, hasArg, description);
}
@Override
- public boolean addValue(String value)
+ public boolean addValue(final String value)
{
addValueForProcessing(value);
return true;
@@ -86,7 +86,7 @@
private final String defaultValue;
- public DefaultOption(String opt, String description, String defaultValue) throws IllegalArgumentException
+ public DefaultOption(final String opt, final String description, final String defaultValue) throws IllegalArgumentException
{
super(opt, true, description);
this.defaultValue = defaultValue;
@@ -208,9 +208,9 @@
Option.builder(null).desc("desc").build();
}
- private static void checkOption(Option option, String opt, String description, String longOpt, int numArgs,
- String argName, boolean required, boolean optionalArg,
- char valueSeparator, Class<?> cls)
+ private static void checkOption(final Option option, final String opt, final String description, final String longOpt, final int numArgs,
+ final String argName, final boolean required, final boolean optionalArg,
+ final char valueSeparator, final Class<?> cls)
{
assertEquals(opt, option.getOpt());
assertEquals(description, option.getDescription());
diff --git a/src/test/java/org/apache/commons/cli/ParserTestCase.java b/src/test/java/org/apache/commons/cli/ParserTestCase.java
index 31aa2b3..8755e0b 100644
--- a/src/test/java/org/apache/commons/cli/ParserTestCase.java
+++ b/src/test/java/org/apache/commons/cli/ParserTestCase.java
@@ -927,7 +927,7 @@
}
@SuppressWarnings("deprecation")
- private CommandLine parse(CommandLineParser parser, Options opts, String[] args, Properties properties) throws ParseException {
+ private CommandLine parse(final CommandLineParser parser, final Options opts, final String[] args, final Properties properties) throws ParseException {
if (parser instanceof Parser) {
return ((Parser) parser).parse(opts, args, properties);
} else if (parser instanceof DefaultParser) {
diff --git a/src/test/java/org/apache/commons/cli/bug/BugCLI266Test.java b/src/test/java/org/apache/commons/cli/bug/BugCLI266Test.java
index 694252f..705b818 100644
--- a/src/test/java/org/apache/commons/cli/bug/BugCLI266Test.java
+++ b/src/test/java/org/apache/commons/cli/bug/BugCLI266Test.java
@@ -88,7 +88,7 @@
return options;
}
- private void buildOptionsGroup(Options options) {
+ private void buildOptionsGroup(final Options options) {
final OptionGroup firstGroup = new OptionGroup();
final OptionGroup secondGroup = new OptionGroup();
firstGroup.setRequired(true);