This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-cli.git
The following commit(s) were added to refs/heads/master by this push: new f45c430 Use final and {} notation for array declarations. f45c430 is described below commit f45c4301de8bbcb50227e0663f20c5f0870636d3 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Mon Oct 18 17:30:30 2021 -0400 Use final and {} notation for array declarations. --- src/main/java/org/apache/commons/cli/Option.java | 4 ++-- .../java/org/apache/commons/cli/DefaultParserTest.java | 16 ++++++++-------- src/test/java/org/apache/commons/cli/ParserTestCase.java | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/apache/commons/cli/Option.java b/src/main/java/org/apache/commons/cli/Option.java index 4595e45..4a85907 100644 --- a/src/main/java/org/apache/commons/cli/Option.java +++ b/src/main/java/org/apache/commons/cli/Option.java @@ -462,14 +462,14 @@ public class Option implements Cloneable, Serializable { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof Option)) { return false; } - Option other = (Option) obj; + final Option other = (Option) obj; return Objects.equals(longOption, other.longOption) && Objects.equals(option, other.option); } diff --git a/src/test/java/org/apache/commons/cli/DefaultParserTest.java b/src/test/java/org/apache/commons/cli/DefaultParserTest.java index d0ebe7b..a161cd6 100644 --- a/src/test/java/org/apache/commons/cli/DefaultParserTest.java +++ b/src/test/java/org/apache/commons/cli/DefaultParserTest.java @@ -34,7 +34,7 @@ public class DefaultParserTest extends ParserTestCase { @Override @Test public void testShortOptionConcatenatedQuoteHandling() throws Exception { - final String[] args = new String[] {"-b\"quoted string\""}; + final String[] args = {"-b\"quoted string\""}; final CommandLine cl = parser.parse(options, args); @@ -45,7 +45,7 @@ public class DefaultParserTest extends ParserTestCase { @Override @Test public void testLongOptionWithEqualsQuoteHandling() throws Exception { - final String[] args = new String[] {"--bfile=\"quoted string\""}; + final String[] args = {"--bfile=\"quoted string\""}; final CommandLine cl = parser.parse(options, args); @@ -55,7 +55,7 @@ public class DefaultParserTest extends ParserTestCase { @Test public void testShortOptionQuoteHandlingWithStrip() throws Exception { parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(true).build(); - final String[] args = new String[] {"-b", "\"quoted string\""}; + final String[] args = {"-b", "\"quoted string\""}; final CommandLine cl = parser.parse(options, args); @@ -65,7 +65,7 @@ public class DefaultParserTest extends ParserTestCase { @Test public void testShortOptionQuoteHandlingWithoutStrip() throws Exception { parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(false).build(); - final String[] args = new String[] {"-b", "\"quoted string\""}; + final String[] args = {"-b", "\"quoted string\""}; final CommandLine cl = parser.parse(options, args); @@ -75,7 +75,7 @@ public class DefaultParserTest extends ParserTestCase { @Test public void testLongOptionQuoteHandlingWithStrip() throws Exception { parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(true).build(); - final String[] args = new String[] {"--bfile", "\"quoted string\""}; + final String[] args = {"--bfile", "\"quoted string\""}; final CommandLine cl = parser.parse(options, args); @@ -85,7 +85,7 @@ public class DefaultParserTest extends ParserTestCase { @Test public void testLongOptionQuoteHandlingWithoutStrip() throws Exception { parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(false).build(); - final String[] args = new String[] {"--bfile", "\"quoted string\""}; + final String[] args = {"--bfile", "\"quoted string\""}; final CommandLine cl = parser.parse(options, args); @@ -95,7 +95,7 @@ public class DefaultParserTest extends ParserTestCase { @Test public void testLongOptionWithEqualsQuoteHandlingWithStrip() throws Exception { parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(true).build(); - final String[] args = new String[] {"--bfile=\"quoted string\""}; + final String[] args = {"--bfile=\"quoted string\""}; final CommandLine cl = parser.parse(options, args); @@ -105,7 +105,7 @@ public class DefaultParserTest extends ParserTestCase { @Test public void testLongOptionWithEqualsQuoteHandlingWithoutStrip() throws Exception { parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(false).build(); - final String[] args = new String[] {"--bfile=\"quoted string\""}; + final String[] args = {"--bfile=\"quoted string\""}; final CommandLine cl = parser.parse(options, args); diff --git a/src/test/java/org/apache/commons/cli/ParserTestCase.java b/src/test/java/org/apache/commons/cli/ParserTestCase.java index cae48a6..fbe0471 100644 --- a/src/test/java/org/apache/commons/cli/ParserTestCase.java +++ b/src/test/java/org/apache/commons/cli/ParserTestCase.java @@ -957,7 +957,7 @@ public abstract class ParserTestCase { @Test public void testShortOptionQuoteHandling() throws Exception { - final String[] args = new String[] {"-b", "\"quoted string\""}; + final String[] args = {"-b", "\"quoted string\""}; final CommandLine cl = parser.parse(options, args); @@ -966,7 +966,7 @@ public abstract class ParserTestCase { @Test public void testLongOptionQuoteHandling() throws Exception { - final String[] args = new String[] {"--bfile", "\"quoted string\""}; + final String[] args = {"--bfile", "\"quoted string\""}; final CommandLine cl = parser.parse(options, args); @@ -975,7 +975,7 @@ public abstract class ParserTestCase { @Test public void testLongOptionWithEqualsQuoteHandling() throws Exception { - final String[] args = new String[] {"--bfile=\"quoted string\""}; + final String[] args = {"--bfile=\"quoted string\""}; final CommandLine cl = parser.parse(options, args); @@ -984,7 +984,7 @@ public abstract class ParserTestCase { @Test public void testShortOptionConcatenatedQuoteHandling() throws Exception { - final String[] args = new String[] {"-b\"quoted string\""}; + final String[] args = {"-b\"quoted string\""}; final CommandLine cl = parser.parse(options, args);