1
1
package com .github .markusbernhardt .xmldoclet ;
2
2
3
3
import jdk .javadoc .doclet .Doclet ;
4
+
5
+ import java .util .ArrayList ;
6
+ import java .util .Collections ;
4
7
import java .util .List ;
5
8
6
9
/**
@@ -13,25 +16,25 @@ public class CustomOption implements Doclet.Option {
13
16
private final String parameters ;
14
17
15
18
/**
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
+ *
17
22
* @param cliOption Apache Commons CLI Option instance
18
23
* @return the created {@link CustomOption}
19
24
*/
20
- public static CustomOption of (org .apache .commons .cli .Option cliOption ){
25
+ public static CustomOption of (org .apache .commons .cli .Option cliOption ) {
21
26
return new CustomOption (
22
27
cliOption .getArgs (),
23
28
cliOption .getDescription (),
24
29
List .of (cliOption .getOpt ()),
25
30
cliOption .getArgName ());
26
31
}
27
32
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 ) {
32
35
this .argumentCount = argumentCount ;
33
36
this .description = description ;
34
- this .names = names ;
37
+ this .names = new ArrayList <>( names ) ;
35
38
this .parameters = parameters ;
36
39
}
37
40
@@ -52,8 +55,8 @@ public Kind getKind() {
52
55
53
56
@ Override
54
57
public List <String > getNames () {
55
- //return List.of("-customOption");
56
- return names ;
58
+ // return List.of("-customOption");
59
+ return Collections . unmodifiableList ( names ) ;
57
60
}
58
61
59
62
@ Override
0 commit comments