Skip to content

Commit 777c51e

Browse files
committed
Refactor and format CustomOption to fix spotbugs reported issues.
Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
1 parent 91e7ab7 commit 777c51e

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/main/java/com/github/markusbernhardt/xmldoclet/CustomOption.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package com.github.markusbernhardt.xmldoclet;
22

33
import jdk.javadoc.doclet.Doclet;
4+
5+
import java.util.ArrayList;
6+
import java.util.Collections;
47
import java.util.List;
58

69
/**
@@ -13,25 +16,25 @@ public class CustomOption implements Doclet.Option {
1316
private final String parameters;
1417

1518
/**
16-
* Creates a Custom {@link Doclet.Option} based on a {@link org.apache.commons.cli.Option} instance.
19+
* Creates a Custom {@link Doclet.Option} based on a {@link org.apache.commons.cli.Option}
20+
* instance.
21+
*
1722
* @param cliOption Apache Commons CLI Option instance
1823
* @return the created {@link CustomOption}
1924
*/
20-
public static CustomOption of(org.apache.commons.cli.Option cliOption){
25+
public static CustomOption of(org.apache.commons.cli.Option cliOption) {
2126
return new CustomOption(
2227
cliOption.getArgs(),
2328
cliOption.getDescription(),
2429
List.of(cliOption.getOpt()),
2530
cliOption.getArgName());
2631
}
2732

28-
public CustomOption(
29-
final int argumentCount, final String description,
30-
final List<String> names, final String parameters)
31-
{
33+
public CustomOption(final int argumentCount, final String description,
34+
final List<String> names, final String parameters) {
3235
this.argumentCount = argumentCount;
3336
this.description = description;
34-
this.names = names;
37+
this.names = new ArrayList<>(names);
3538
this.parameters = parameters;
3639
}
3740

@@ -52,8 +55,8 @@ public Kind getKind() {
5255

5356
@Override
5457
public List<String> getNames() {
55-
//return List.of("-customOption");
56-
return names;
58+
// return List.of("-customOption");
59+
return Collections.unmodifiableList(names);
5760
}
5861

5962
@Override

0 commit comments

Comments
 (0)