Skip to content

Commit f45c430

Browse files
committed
Use final and {} notation for array declarations.
1 parent e3bafac commit f45c430

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,14 +462,14 @@ public Object clone() {
462462
}
463463

464464
@Override
465-
public boolean equals(Object obj) {
465+
public boolean equals(final Object obj) {
466466
if (this == obj) {
467467
return true;
468468
}
469469
if (!(obj instanceof Option)) {
470470
return false;
471471
}
472-
Option other = (Option) obj;
472+
final Option other = (Option) obj;
473473
return Objects.equals(longOption, other.longOption) && Objects.equals(option, other.option);
474474
}
475475

src/test/java/org/apache/commons/cli/DefaultParserTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void setUp() {
3434
@Override
3535
@Test
3636
public void testShortOptionConcatenatedQuoteHandling() throws Exception {
37-
final String[] args = new String[] {"-b\"quoted string\""};
37+
final String[] args = {"-b\"quoted string\""};
3838

3939
final CommandLine cl = parser.parse(options, args);
4040

@@ -45,7 +45,7 @@ public void testShortOptionConcatenatedQuoteHandling() throws Exception {
4545
@Override
4646
@Test
4747
public void testLongOptionWithEqualsQuoteHandling() throws Exception {
48-
final String[] args = new String[] {"--bfile=\"quoted string\""};
48+
final String[] args = {"--bfile=\"quoted string\""};
4949

5050
final CommandLine cl = parser.parse(options, args);
5151

@@ -55,7 +55,7 @@ public void testLongOptionWithEqualsQuoteHandling() throws Exception {
5555
@Test
5656
public void testShortOptionQuoteHandlingWithStrip() throws Exception {
5757
parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(true).build();
58-
final String[] args = new String[] {"-b", "\"quoted string\""};
58+
final String[] args = {"-b", "\"quoted string\""};
5959

6060
final CommandLine cl = parser.parse(options, args);
6161

@@ -65,7 +65,7 @@ public void testShortOptionQuoteHandlingWithStrip() throws Exception {
6565
@Test
6666
public void testShortOptionQuoteHandlingWithoutStrip() throws Exception {
6767
parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(false).build();
68-
final String[] args = new String[] {"-b", "\"quoted string\""};
68+
final String[] args = {"-b", "\"quoted string\""};
6969

7070
final CommandLine cl = parser.parse(options, args);
7171

@@ -75,7 +75,7 @@ public void testShortOptionQuoteHandlingWithoutStrip() throws Exception {
7575
@Test
7676
public void testLongOptionQuoteHandlingWithStrip() throws Exception {
7777
parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(true).build();
78-
final String[] args = new String[] {"--bfile", "\"quoted string\""};
78+
final String[] args = {"--bfile", "\"quoted string\""};
7979

8080
final CommandLine cl = parser.parse(options, args);
8181

@@ -85,7 +85,7 @@ public void testLongOptionQuoteHandlingWithStrip() throws Exception {
8585
@Test
8686
public void testLongOptionQuoteHandlingWithoutStrip() throws Exception {
8787
parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(false).build();
88-
final String[] args = new String[] {"--bfile", "\"quoted string\""};
88+
final String[] args = {"--bfile", "\"quoted string\""};
8989

9090
final CommandLine cl = parser.parse(options, args);
9191

@@ -95,7 +95,7 @@ public void testLongOptionQuoteHandlingWithoutStrip() throws Exception {
9595
@Test
9696
public void testLongOptionWithEqualsQuoteHandlingWithStrip() throws Exception {
9797
parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(true).build();
98-
final String[] args = new String[] {"--bfile=\"quoted string\""};
98+
final String[] args = {"--bfile=\"quoted string\""};
9999

100100
final CommandLine cl = parser.parse(options, args);
101101

@@ -105,7 +105,7 @@ public void testLongOptionWithEqualsQuoteHandlingWithStrip() throws Exception {
105105
@Test
106106
public void testLongOptionWithEqualsQuoteHandlingWithoutStrip() throws Exception {
107107
parser = DefaultParser.builder().setStripLeadingAndTrailingQuotes(false).build();
108-
final String[] args = new String[] {"--bfile=\"quoted string\""};
108+
final String[] args = {"--bfile=\"quoted string\""};
109109

110110
final CommandLine cl = parser.parse(options, args);
111111

src/test/java/org/apache/commons/cli/ParserTestCase.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ public void testUnrecognizedOptionWithBursting() throws Exception {
957957

958958
@Test
959959
public void testShortOptionQuoteHandling() throws Exception {
960-
final String[] args = new String[] {"-b", "\"quoted string\""};
960+
final String[] args = {"-b", "\"quoted string\""};
961961

962962
final CommandLine cl = parser.parse(options, args);
963963

@@ -966,7 +966,7 @@ public void testShortOptionQuoteHandling() throws Exception {
966966

967967
@Test
968968
public void testLongOptionQuoteHandling() throws Exception {
969-
final String[] args = new String[] {"--bfile", "\"quoted string\""};
969+
final String[] args = {"--bfile", "\"quoted string\""};
970970

971971
final CommandLine cl = parser.parse(options, args);
972972

@@ -975,7 +975,7 @@ public void testLongOptionQuoteHandling() throws Exception {
975975

976976
@Test
977977
public void testLongOptionWithEqualsQuoteHandling() throws Exception {
978-
final String[] args = new String[] {"--bfile=\"quoted string\""};
978+
final String[] args = {"--bfile=\"quoted string\""};
979979

980980
final CommandLine cl = parser.parse(options, args);
981981

@@ -984,7 +984,7 @@ public void testLongOptionWithEqualsQuoteHandling() throws Exception {
984984

985985
@Test
986986
public void testShortOptionConcatenatedQuoteHandling() throws Exception {
987-
final String[] args = new String[] {"-b\"quoted string\""};
987+
final String[] args = {"-b\"quoted string\""};
988988

989989
final CommandLine cl = parser.parse(options, args);
990990

0 commit comments

Comments
 (0)