Skip to content

Commit 5fb9e50

Browse files
committed
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
1 parent 357a8b0 commit 5fb9e50

25 files changed

Lines changed: 176 additions & 176 deletions

src/main/java/org/apache/commons/cli/AlreadySelectedException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class AlreadySelectedException extends ParseException
4242
*
4343
* @param message the detail message
4444
*/
45-
public AlreadySelectedException(String message)
45+
public AlreadySelectedException(final String message)
4646
{
4747
super(message);
4848
}
@@ -55,7 +55,7 @@ public AlreadySelectedException(String message)
5555
* @param option the option that triggered the exception
5656
* @since 1.2
5757
*/
58-
public AlreadySelectedException(OptionGroup group, Option option)
58+
public AlreadySelectedException(final OptionGroup group, final Option option)
5959
{
6060
this("The option '" + option.getKey() + "' was specified but an option from this group "
6161
+ "has already been selected: '" + group.getSelected() + "'");

src/main/java/org/apache/commons/cli/AmbiguousOptionException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class AmbiguousOptionException extends UnrecognizedOptionException
4242
* @param option the partial option name
4343
* @param matchingOptions the options matching the name
4444
*/
45-
public AmbiguousOptionException(String option, Collection<String> matchingOptions)
45+
public AmbiguousOptionException(final String option, final Collection<String> matchingOptions)
4646
{
4747
super(createMessage(option, matchingOptions), option);
4848
this.matchingOptions = matchingOptions;
@@ -64,7 +64,7 @@ public Collection<String> getMatchingOptions()
6464
* @param matchingOptions
6565
* @return
6666
*/
67-
private static String createMessage(String option, Collection<String> matchingOptions)
67+
private static String createMessage(final String option, final Collection<String> matchingOptions)
6868
{
6969
final StringBuilder buf = new StringBuilder("Ambiguous option: '");
7070
buf.append(option);

src/main/java/org/apache/commons/cli/BasicParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public class BasicParser extends Parser
4141
* @return The <code>arguments</code> String array.
4242
*/
4343
@Override
44-
protected String[] flatten(@SuppressWarnings("unused") Options options,
45-
String[] arguments,
46-
@SuppressWarnings("unused") boolean stopAtNonOption)
44+
protected String[] flatten(@SuppressWarnings("unused") final Options options,
45+
final String[] arguments,
46+
@SuppressWarnings("unused") final boolean stopAtNonOption)
4747
{
4848
// just echo the arguments
4949
return arguments;

src/main/java/org/apache/commons/cli/CommandLine.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected CommandLine()
6363
* @return true if set, false if not
6464
* @since 1.5
6565
*/
66-
public boolean hasOption(Option opt)
66+
public boolean hasOption(final Option opt)
6767
{
6868
return options.contains(opt);
6969
}
@@ -74,7 +74,7 @@ public boolean hasOption(Option opt)
7474
* @param opt Short name of the option
7575
* @return true if set, false if not
7676
*/
77-
public boolean hasOption(String opt)
77+
public boolean hasOption(final String opt)
7878
{
7979
return hasOption(resolveOption(opt));
8080
}
@@ -85,7 +85,7 @@ public boolean hasOption(String opt)
8585
* @param opt character name of the option
8686
* @return true if set, false if not
8787
*/
88-
public boolean hasOption(char opt)
88+
public boolean hasOption(final char opt)
8989
{
9090
return hasOption(String.valueOf(opt));
9191
}
@@ -98,7 +98,7 @@ public boolean hasOption(char opt)
9898
* @deprecated due to System.err message. Instead use getParsedOptionValue(String)
9999
*/
100100
@Deprecated
101-
public Object getOptionObject(String opt)
101+
public Object getOptionObject(final String opt)
102102
{
103103
try
104104
{
@@ -120,7 +120,7 @@ public Object getOptionObject(String opt)
120120
* @see PatternOptionBuilder
121121
* @since 1.5
122122
*/
123-
public Object getParsedOptionValue(Option option) throws ParseException
123+
public Object getParsedOptionValue(final Option option) throws ParseException
124124
{
125125
if (option == null)
126126
{
@@ -143,7 +143,7 @@ public Object getParsedOptionValue(Option option) throws ParseException
143143
* @see PatternOptionBuilder
144144
* @since 1.2
145145
*/
146-
public Object getParsedOptionValue(String opt) throws ParseException
146+
public Object getParsedOptionValue(final String opt) throws ParseException
147147
{
148148
return getParsedOptionValue(resolveOption(opt));
149149
}
@@ -157,7 +157,7 @@ public Object getParsedOptionValue(String opt) throws ParseException
157157
* @see PatternOptionBuilder
158158
* @since 1.5
159159
*/
160-
public Object getParsedOptionValue(char opt) throws ParseException
160+
public Object getParsedOptionValue(final char opt) throws ParseException
161161
{
162162
return getParsedOptionValue(String.valueOf(opt));
163163
}
@@ -169,7 +169,7 @@ public Object getParsedOptionValue(char opt) throws ParseException
169169
* @param opt the name of the option
170170
* @return the type of opt
171171
*/
172-
public Object getOptionObject(char opt)
172+
public Object getOptionObject(final char opt)
173173
{
174174
return getOptionObject(String.valueOf(opt));
175175
}
@@ -182,7 +182,7 @@ public Object getOptionObject(char opt)
182182
* otherwise null.
183183
* @since 1.5
184184
*/
185-
public String getOptionValue(Option option)
185+
public String getOptionValue(final Option option)
186186
{
187187
if (option == null)
188188
{
@@ -199,7 +199,7 @@ public String getOptionValue(Option option)
199199
* @return Value of the argument if option is set, and has an argument,
200200
* otherwise null.
201201
*/
202-
public String getOptionValue(String opt)
202+
public String getOptionValue(final String opt)
203203
{
204204
return getOptionValue(resolveOption(opt));
205205
}
@@ -211,7 +211,7 @@ public String getOptionValue(String opt)
211211
* @return Value of the argument if option is set, and has an argument,
212212
* otherwise null.
213213
*/
214-
public String getOptionValue(char opt)
214+
public String getOptionValue(final char opt)
215215
{
216216
return getOptionValue(String.valueOf(opt));
217217
}
@@ -224,7 +224,7 @@ public String getOptionValue(char opt)
224224
* otherwise null.
225225
* @since 1.5
226226
*/
227-
public String[] getOptionValues(Option option)
227+
public String[] getOptionValues(final Option option)
228228
{
229229
final List<String> values = new ArrayList<String>();
230230

@@ -246,7 +246,7 @@ public String[] getOptionValues(Option option)
246246
* @return Values of the argument if option is set, and has an argument,
247247
* otherwise null.
248248
*/
249-
public String[] getOptionValues(String opt)
249+
public String[] getOptionValues(final String opt)
250250
{
251251
return getOptionValues(resolveOption(opt));
252252
}
@@ -283,7 +283,7 @@ private Option resolveOption(String opt)
283283
* @return Values of the argument if option is set, and has an argument,
284284
* otherwise null.
285285
*/
286-
public String[] getOptionValues(char opt)
286+
public String[] getOptionValues(final char opt)
287287
{
288288
return getOptionValues(String.valueOf(opt));
289289
}
@@ -298,7 +298,7 @@ public String[] getOptionValues(char opt)
298298
* otherwise <code>defaultValue</code>.
299299
* @since 1.5
300300
*/
301-
public String getOptionValue(Option option, String defaultValue)
301+
public String getOptionValue(final Option option, final String defaultValue)
302302
{
303303
final String answer = getOptionValue(option);
304304
return (answer != null) ? answer : defaultValue;
@@ -313,7 +313,7 @@ public String getOptionValue(Option option, String defaultValue)
313313
* @return Value of the argument if option is set, and has an argument,
314314
* otherwise <code>defaultValue</code>.
315315
*/
316-
public String getOptionValue(String opt, String defaultValue)
316+
public String getOptionValue(final String opt, final String defaultValue)
317317
{
318318
return getOptionValue(resolveOption(opt), defaultValue);
319319
}
@@ -327,7 +327,7 @@ public String getOptionValue(String opt, String defaultValue)
327327
* @return Value of the argument if option is set, and has an argument,
328328
* otherwise <code>defaultValue</code>.
329329
*/
330-
public String getOptionValue(char opt, String defaultValue)
330+
public String getOptionValue(final char opt, final String defaultValue)
331331
{
332332
return getOptionValue(String.valueOf(opt), defaultValue);
333333
}
@@ -345,7 +345,7 @@ public String getOptionValue(char opt, String defaultValue)
345345
* even if the option doesn't exists
346346
* @since 1.5
347347
*/
348-
public Properties getOptionProperties(Option option)
348+
public Properties getOptionProperties(final Option option)
349349
{
350350
final Properties props = new Properties();
351351

@@ -383,7 +383,7 @@ else if (values.size() == 1)
383383
* even if the option doesn't exists
384384
* @since 1.2
385385
*/
386-
public Properties getOptionProperties(String opt)
386+
public Properties getOptionProperties(final String opt)
387387
{
388388
final Properties props = new Properties();
389389

@@ -459,7 +459,7 @@ public String toString() {
459459
*
460460
* @param arg the unrecognized option/argument.
461461
*/
462-
protected void addArg(String arg)
462+
protected void addArg(final String arg)
463463
{
464464
args.add(arg);
465465
}
@@ -469,7 +469,7 @@ protected void addArg(String arg)
469469
*
470470
* @param opt the processed option
471471
*/
472-
protected void addOption(Option opt)
472+
protected void addOption(final Option opt)
473473
{
474474
options.add(opt);
475475
}
@@ -521,7 +521,7 @@ public static final class Builder
521521
*
522522
* @return this Builder instance for method chaining.
523523
*/
524-
public Builder addOption(Option opt)
524+
public Builder addOption(final Option opt)
525525
{
526526
commandLine.addOption(opt);
527527
return this;
@@ -534,7 +534,7 @@ public Builder addOption(Option opt)
534534
*
535535
* @return this Builder instance for method chaining.
536536
*/
537-
public Builder addArg(String arg)
537+
public Builder addArg(final String arg)
538538
{
539539
commandLine.addArg(arg);
540540
return this;

0 commit comments

Comments
 (0)