langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java
author jjg
Thu, 16 Feb 2017 12:49:44 -0800
changeset 43878 4b0a3bda61d3
parent 43875 d0e60aa1f18b
child 44287 829205b133d4
permissions -rw-r--r--
8175048: javadoc does not decode options containing '=' and ':' correctly Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
     1
/*
43875
d0e60aa1f18b 8175047: javadoc should support --help-extra as a synonym for -X
jjg
parents: 43772
diff changeset
     2
 * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
     4
 *
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    10
 *
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    15
 * accompanied this code).
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    16
 *
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    20
 *
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    23
 * questions.
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    24
 */
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    25
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31936
diff changeset
    26
package jdk.javadoc.internal.tool;
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    27
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31936
diff changeset
    28
import java.util.ArrayList;
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
    29
import java.util.Arrays;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
    30
import java.util.EnumMap;
24897
655b72d7b96e 7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents: 22163
diff changeset
    31
import java.util.LinkedHashMap;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31936
diff changeset
    32
import java.util.List;
24897
655b72d7b96e 7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents: 22163
diff changeset
    33
import java.util.Map;
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
    34
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
    35
import javax.lang.model.element.ElementKind;
24897
655b72d7b96e 7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents: 22163
diff changeset
    36
655b72d7b96e 7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents: 22163
diff changeset
    37
import com.sun.tools.javac.main.Option;
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
    38
import com.sun.tools.javac.main.Option.InvalidValueException;
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
    39
import com.sun.tools.javac.main.Option.OptionKind;
37393
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
    40
import com.sun.tools.javac.main.OptionHelper;
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    41
import com.sun.tools.javac.util.Options;
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    42
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
    43
import static com.sun.tools.javac.main.Option.OptionKind.*;
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
    44
import static jdk.javadoc.internal.tool.Main.Result.*;
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
    45
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    46
/**
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    47
 * javadoc tool options.
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    48
 *
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    49
 *  <p><b>This is NOT part of any supported API.
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    50
 *  If you write code that depends on this, you do so at your own risk.
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    51
 *  This code and its internal interfaces are subject to change or
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    52
 *  deletion without notice.</b>
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    53
 */
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    54
public enum ToolOption {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
    55
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    56
    // ----- options for underlying compiler -----
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    57
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
    58
    BOOTCLASSPATH("-bootclasspath", STANDARD, true) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    59
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
    60
        public void process(Helper helper, String arg) throws InvalidValueException {
41990
ffaf4e59538a 8166379: IAE while invoking javadoc with --patch-module
ksrini
parents: 41451
diff changeset
    61
            Option.BOOT_CLASS_PATH.process(helper.getOptionHelper(), primaryName, arg);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    62
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    63
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    64
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
    65
    CLASS_PATH("--class-path -classpath -cp", STANDARD, true) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    66
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
    67
        public void process(Helper helper, String arg) throws InvalidValueException {
41990
ffaf4e59538a 8166379: IAE while invoking javadoc with --patch-module
ksrini
parents: 41451
diff changeset
    68
            Option.CLASS_PATH.process(helper.getOptionHelper(), primaryName, arg);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    69
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    70
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    71
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
    72
    EXTDIRS("-extdirs", STANDARD, true) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    73
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
    74
        public void process(Helper helper, String arg) throws InvalidValueException {
41990
ffaf4e59538a 8166379: IAE while invoking javadoc with --patch-module
ksrini
parents: 41451
diff changeset
    75
            Option.EXTDIRS.process(helper.getOptionHelper(), primaryName, arg);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    76
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    77
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    78
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
    79
    SOURCE_PATH("--source-path -sourcepath", STANDARD, true) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    80
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
    81
        public void process(Helper helper, String arg) throws InvalidValueException {
41990
ffaf4e59538a 8166379: IAE while invoking javadoc with --patch-module
ksrini
parents: 41451
diff changeset
    82
            Option.SOURCE_PATH.process(helper.getOptionHelper(), primaryName, arg);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    83
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    84
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
    85
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
    86
    MODULE_SOURCE_PATH("--module-source-path", STANDARD, true) {
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
    87
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
    88
        public void process(Helper helper, String arg) throws InvalidValueException {
41990
ffaf4e59538a 8166379: IAE while invoking javadoc with --patch-module
ksrini
parents: 41451
diff changeset
    89
            Option.MODULE_SOURCE_PATH.process(helper.getOptionHelper(), primaryName, arg);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    90
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    91
    },
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    92
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
    93
    UPGRADE_MODULE_PATH("--upgrade-module-path", STANDARD, true) {
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
    94
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
    95
        public void process(Helper helper, String arg) throws InvalidValueException {
41990
ffaf4e59538a 8166379: IAE while invoking javadoc with --patch-module
ksrini
parents: 41451
diff changeset
    96
            Option.UPGRADE_MODULE_PATH.process(helper.getOptionHelper(), primaryName, arg);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    97
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    98
    },
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    99
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   100
    SYSTEM("--system", STANDARD, true) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   101
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   102
        public void process(Helper helper, String arg) throws InvalidValueException {
41990
ffaf4e59538a 8166379: IAE while invoking javadoc with --patch-module
ksrini
parents: 41451
diff changeset
   103
            Option.SYSTEM.process(helper.getOptionHelper(), primaryName, arg);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   104
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   105
    },
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   106
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   107
    MODULE_PATH("--module-path -p", STANDARD, true) {
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   108
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   109
        public void process(Helper helper, String arg) throws InvalidValueException {
41990
ffaf4e59538a 8166379: IAE while invoking javadoc with --patch-module
ksrini
parents: 41451
diff changeset
   110
            Option.MODULE_PATH.process(helper.getOptionHelper(), primaryName, arg);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   111
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   112
    },
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   113
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   114
    ADD_MODULES("--add-modules", STANDARD, true) {
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   115
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   116
        public void process(Helper helper, String arg) throws InvalidValueException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   117
            Option.ADD_MODULES.process(helper.getOptionHelper(), primaryName, arg);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   118
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   119
    },
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   120
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   121
    LIMIT_MODULES("--limit-modules", STANDARD, true) {
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   122
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   123
        public void process(Helper helper, String arg) throws InvalidValueException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   124
            Option.LIMIT_MODULES.process(helper.getOptionHelper(), primaryName, arg);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   125
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   126
    },
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   127
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   128
    MODULE("--module", STANDARD, true) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   129
        @Override
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   130
        public void process(Helper helper, String arg) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   131
            helper.addToList(this, ",", arg);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   132
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   133
    },
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   134
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   135
    ENCODING("-encoding", STANDARD, true) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   136
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   137
        public void process(Helper helper, String arg) throws InvalidValueException {
41990
ffaf4e59538a 8166379: IAE while invoking javadoc with --patch-module
ksrini
parents: 41451
diff changeset
   138
            Option.ENCODING.process(helper.getOptionHelper(), primaryName, arg);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   139
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   140
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   141
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   142
    RELEASE("--release", STANDARD, true) {
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   143
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   144
        public void process(Helper helper, String arg) throws InvalidValueException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   145
            Option.RELEASE.process(helper.getOptionHelper(), primaryName, arg);
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   146
        }
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   147
    },
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   148
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   149
    SOURCE("-source", STANDARD, true) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   150
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   151
        public void process(Helper helper, String arg) throws InvalidValueException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   152
            Option.SOURCE.process(helper.getOptionHelper(), primaryName, arg);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   153
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   154
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   155
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   156
    XMAXERRS("-Xmaxerrs", EXTENDED, true) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   157
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   158
        public void process(Helper helper, String arg) throws InvalidValueException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   159
            Option.XMAXERRS.process(helper.getOptionHelper(), primaryName, arg);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   160
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   161
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   162
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   163
    XMAXWARNS("-Xmaxwarns", EXTENDED, true) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   164
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   165
        public void process(Helper helper, String arg) throws InvalidValueException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   166
            Option.XMAXWARNS.process(helper.getOptionHelper(), primaryName, arg);
37393
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   167
        }
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   168
    },
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   169
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   170
    ADD_READS("--add-reads", EXTENDED, true) {
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   171
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   172
        public void process(Helper helper, String arg) throws InvalidValueException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   173
            Option.ADD_READS.process(helper.getOptionHelper(), primaryName, arg);
37393
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   174
        }
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   175
    },
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   176
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   177
    ADD_EXPORTS("--add-exports", EXTENDED, true) {
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   178
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   179
        public void process(Helper helper, String arg) throws InvalidValueException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   180
            Option.ADD_EXPORTS.process(helper.getOptionHelper(), primaryName, arg);
37393
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   181
        }
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   182
    },
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   183
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   184
    PATCH_MODULE("--patch-module", EXTENDED, true) {
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   185
        @Override
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   186
        public void process(Helper helper, String arg) throws InvalidValueException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   187
            Option.PATCH_MODULE.process(helper.getOptionHelper(), primaryName, arg);
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   188
        }
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   189
    },
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37393
diff changeset
   190
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   191
    // ----- doclet options -----
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   192
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   193
    DOCLET("-doclet", STANDARD, true), // handled in setDocletInvoker
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   194
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   195
    DOCLETPATH("-docletpath", STANDARD, true), // handled in setDocletInvoker
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   196
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   197
    // ----- selection options -----
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   198
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   199
    SUBPACKAGES("-subpackages", STANDARD, true) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   200
        @Override
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   201
        public void process(Helper helper, String arg) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   202
            helper.addToList(this, ":", arg);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   203
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   204
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   205
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   206
    EXCLUDE("-exclude", STANDARD, true) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   207
        @Override
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   208
        public void process(Helper helper, String arg) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   209
            helper.addToList(this, ":", arg);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   210
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   211
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   212
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   213
    // ----- filtering options -----
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   214
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   215
    PACKAGE("-package", STANDARD) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   216
        @Override
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   217
        public void process(Helper helper) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   218
            helper.setSimpleFilter("package");
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   219
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   220
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   221
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   222
    PRIVATE("-private", STANDARD) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   223
        @Override
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   224
        public void process(Helper helper) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   225
            helper.setSimpleFilter("private");
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   226
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   227
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   228
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   229
    PROTECTED("-protected", STANDARD) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   230
        @Override
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   231
        public void process(Helper helper) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   232
            helper.setSimpleFilter("protected");
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   233
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   234
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   235
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   236
    PUBLIC("-public", STANDARD) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   237
        @Override
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   238
        public void process(Helper helper) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   239
            helper.setSimpleFilter("public");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   240
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   241
    },
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   242
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   243
    SHOW_MEMBERS("--show-members", STANDARD, true) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   244
        @Override
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   245
        public void process(Helper helper, String arg) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   246
            helper.setFilter(this, arg);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   247
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   248
    },
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   249
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   250
    SHOW_TYPES("--show-types", STANDARD, true) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   251
        @Override
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   252
        public void process(Helper helper, String arg) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   253
            helper.setFilter(this, arg);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   254
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   255
    },
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   256
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   257
    SHOW_PACKAGES("--show-packages", STANDARD, true) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   258
        @Override
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   259
        public void process(Helper helper, String arg) throws OptionException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   260
            helper.setShowPackageAccess(SHOW_PACKAGES, arg);
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   261
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   262
    },
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   263
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   264
    SHOW_MODULE_CONTENTS("--show-module-contents", STANDARD, true) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   265
        @Override
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   266
        public void process(Helper helper, String arg) throws OptionException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   267
            helper.setShowModuleContents(SHOW_MODULE_CONTENTS, arg);
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   268
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   269
    },
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   270
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   271
    EXPAND_REQUIRES("--expand-requires", STANDARD, true) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   272
        @Override
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   273
        public void process(Helper helper, String arg) throws OptionException {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   274
            helper.setExpandRequires(EXPAND_REQUIRES, arg);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   275
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   276
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   277
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   278
    // ----- output control options -----
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   279
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   280
    QUIET("-quiet", STANDARD) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   281
        @Override
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   282
        public void process(Helper helper) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   283
            helper.jdtoolOpts.put(QUIET, true);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   284
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   285
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   286
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   287
    VERBOSE("-verbose", STANDARD) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   288
        @Override
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   289
        public void process(Helper helper) {
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   290
            helper.compOpts.put("-verbose", "");
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   291
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   292
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   293
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   294
    XWERROR("-Xwerror", HIDDEN) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   295
        @Override
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   296
        public void process(Helper helper) {
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   297
            helper.rejectWarnings = true;
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   298
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   299
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   300
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   301
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   302
    // ----- other options -----
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   303
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   304
    BREAKITERATOR("-breakiterator", STANDARD) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   305
        @Override
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   306
        public void process(Helper helper) {
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   307
            helper.breakiterator = true;
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   308
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   309
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   310
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   311
    LOCALE("-locale", STANDARD, true) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   312
        @Override
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   313
        public void process(Helper helper, String arg) {
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   314
            helper.docLocale = arg;
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   315
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   316
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   317
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   318
    XCLASSES("-Xclasses", HIDDEN) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   319
        @Override
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   320
        public void process(Helper helper) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   321
            helper.jdtoolOpts.put(XCLASSES, true);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   322
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   323
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   324
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   325
    DUMPONERROR("--dump-on-error", HIDDEN) {
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   326
        @Override
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   327
        public void process(Helper helper) {
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   328
            helper.dumpOnError = true;
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   329
        }
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   330
    },
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   331
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   332
    // ----- help options -----
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   333
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   334
    HELP("--help -help", STANDARD) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   335
        @Override
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   336
        public void process(Helper helper) throws OptionException {
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   337
            throw new OptionException(OK, helper::usage);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   338
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   339
    },
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   340
43875
d0e60aa1f18b 8175047: javadoc should support --help-extra as a synonym for -X
jjg
parents: 43772
diff changeset
   341
    HELP_EXTRA("--help-extra -X", STANDARD) {
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   342
        @Override
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   343
        public void process(Helper helper) throws OptionException {
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   344
           throw new OptionException(OK, helper::Xusage);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   345
        }
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   346
    },
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   347
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   348
    // This option exists only for the purpose of documenting itself.
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   349
    // It's actually implemented by the launcher.
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   350
    J("-J", STANDARD, true) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   351
        @Override
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   352
        public void process(Helper helper) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   353
            throw new AssertionError("the -J flag should be caught by the launcher.");
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   354
        }
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   355
    },
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   356
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   357
    // This option exists only for the purpose of documenting itself.
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   358
    // It's actually implemented ahead of the normal option decoding loop.
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   359
    Xold("-Xold", EXTENDED) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   360
        @Override
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   361
        public void process(Helper helper) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   362
            throw new AssertionError("the -Xold flag should be handled earlier.");
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   363
        }
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   364
    };
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   365
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   366
    public final String primaryName;
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   367
    public final List<String> names;
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   368
    public final OptionKind kind;
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   369
    public final boolean hasArg;
37393
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   370
    public final boolean hasSuffix; // ex: foo:bar or -foo=bar
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   371
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   372
    ToolOption(String opt, OptionKind kind) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   373
        this(opt, kind, false);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   374
    }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   375
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   376
    ToolOption(String names, OptionKind kind, boolean hasArg) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   377
        this.names = Arrays.asList(names.split("\\s+"));
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   378
        this.primaryName = this.names.get(0);
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   379
        this.kind = kind;
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   380
        this.hasArg = hasArg;
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   381
        char lastChar = names.charAt(names.length() - 1);
37393
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   382
        this.hasSuffix = lastChar == ':' || lastChar == '=';
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   383
    }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   384
42260
2b4da2bf6660 8169676: boolean result of Option.process is often ignored
jjg
parents: 41990
diff changeset
   385
    void process(Helper helper, String arg) throws OptionException, Option.InvalidValueException { }
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   386
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   387
    void process(Helper helper) throws OptionException { }
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   388
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   389
    List<String> getNames() {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   390
        return names;
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   391
    }
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   392
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   393
    String getParameters(Messager messager) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   394
        return (hasArg || primaryName.endsWith(":"))
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   395
                ? messager.getText(getKey(primaryName, ".arg"))
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   396
                : null;
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   397
    }
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   398
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   399
    String getDescription(Messager messager) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   400
        return messager.getText(getKey(primaryName, ".desc"));
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   401
    }
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   402
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   403
    private String getKey(String optionName, String suffix) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   404
        return "main.opt."
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   405
                + optionName
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   406
                .replaceAll("^-*", "")              // remove leading '-'
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   407
                .replaceAll("[^A-Za-z0-9]+$", "")   // remove trailing non-alphanumeric
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   408
                .replaceAll("[^A-Za-z0-9]", ".")    // replace internal non-alphanumeric
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   409
                + suffix;
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   410
    }
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   411
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   412
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   413
    static ToolOption get(String name) {
37393
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   414
        String oname = name;
43878
4b0a3bda61d3 8175048: javadoc does not decode options containing '=' and ':' correctly
jjg
parents: 43875
diff changeset
   415
        if (name.startsWith("--") && name.contains("=")) {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   416
            oname = name.substring(0, name.indexOf('='));
37393
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   417
        }
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   418
        for (ToolOption o : values()) {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   419
            for (String n : o.names) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   420
                if (oname.equals(n)) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   421
                    return o;
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40762
diff changeset
   422
                }
37393
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   423
            }
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   424
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   425
        return null;
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   426
    }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   427
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   428
    static abstract class Helper {
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   429
24897
655b72d7b96e 7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents: 22163
diff changeset
   430
        // File manager options
655b72d7b96e 7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents: 22163
diff changeset
   431
        final Map<Option, String> fileManagerOpts = new LinkedHashMap<>();
655b72d7b96e 7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents: 22163
diff changeset
   432
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   433
        /** javac options, set by various options. */
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   434
        Options compOpts; // = Options.instance(context)
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   435
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   436
        /** Javadoc tool options */
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   437
        final Map<ToolOption, Object> jdtoolOpts = new EnumMap<>(ToolOption.class);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   438
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   439
        /** dump stack traces for debugging etc.*/
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   440
        boolean dumpOnError = false;
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   441
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   442
        /** Set by -breakiterator. */
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   443
        boolean breakiterator = false;
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   444
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   445
        /** Set by -Xwerror. */
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   446
        boolean rejectWarnings = false;
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   447
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   448
        /** Set by -prompt. */
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   449
        boolean promptOnError;
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   450
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   451
        /** Set by -locale. */
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   452
        String docLocale = "";
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   453
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   454
        Helper() {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   455
            populateDefaultAccessMap();
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   456
        }
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   457
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   458
        abstract void usage();
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   459
        abstract void Xusage();
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   460
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   461
        abstract String getLocalizedMessage(String msg, Object... args);
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   462
37393
a9ba8bd6697b 8152818: Javadoc must support module options supported by javac.
ksrini
parents: 36526
diff changeset
   463
        abstract OptionHelper getOptionHelper();
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   464
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   465
        @SuppressWarnings("unchecked")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   466
        void addToList(ToolOption opt, String delimiter, String str) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   467
            List<String> list = (List<String>) jdtoolOpts.computeIfAbsent(opt, v -> new ArrayList<>());
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   468
            list.addAll(Arrays.asList(str.split(delimiter)));
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   469
            jdtoolOpts.put(opt, list);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   470
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   471
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   472
        void setExpandRequires(ToolOption opt, String arg) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   473
            switch (arg) {
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   474
                case "transitive":
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   475
                    jdtoolOpts.put(opt, AccessKind.PUBLIC);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   476
                    break;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   477
                case "all":
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   478
                    jdtoolOpts.put(opt, AccessKind.PRIVATE);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   479
                    break;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   480
                default:
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   481
                    String text = getLocalizedMessage("main.illegal_option_value", arg);
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   482
                    throw new IllegalOptionValue(this::usage, text);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   483
            }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   484
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   485
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   486
        void setShowModuleContents(ToolOption opt, String arg) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   487
            switch (arg) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   488
                case "api":
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   489
                    jdtoolOpts.put(opt, AccessKind.PUBLIC);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   490
                    break;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   491
                case "all":
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   492
                    jdtoolOpts.put(opt, AccessKind.PRIVATE);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   493
                    break;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   494
                default:
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   495
                    String text = getLocalizedMessage("main.illegal_option_value", arg);
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   496
                    throw new IllegalOptionValue(this::usage, text);
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   497
            }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   498
        }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   499
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   500
        void setShowPackageAccess(ToolOption opt, String arg) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   501
            switch (arg) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   502
                case "exported":
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   503
                    jdtoolOpts.put(opt, AccessKind.PUBLIC);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   504
                    break;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   505
                case "all":
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   506
                    jdtoolOpts.put(opt, AccessKind.PRIVATE);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   507
                    break;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   508
                default:
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   509
                    String text = getLocalizedMessage("main.illegal_option_value", arg);
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   510
                    throw new IllegalOptionValue(this::usage, text);
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   511
            }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   512
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   513
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   514
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   515
        void setFilter(ToolOption opt, String arg) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   516
            jdtoolOpts.put(opt, getAccessValue(arg));
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   517
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   518
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   519
        void setSimpleFilter(String arg) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   520
            handleSimpleOption(arg);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   521
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   522
24897
655b72d7b96e 7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents: 22163
diff changeset
   523
        void setFileManagerOpt(Option opt, String arg) {
655b72d7b96e 7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents: 22163
diff changeset
   524
            fileManagerOpts.put(opt, arg);
655b72d7b96e 7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents: 22163
diff changeset
   525
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31936
diff changeset
   526
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   527
        void handleSimpleOption(String arg) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   528
            populateSimpleAccessMap(getAccessValue(arg));
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   529
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   530
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   531
        /*
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   532
         * This method handles both the simple options -package,
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   533
         * -private, so on, in addition to the new ones such as
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   534
         * --show-types:public and so on.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   535
         */
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   536
        private AccessKind getAccessValue(String arg) throws OptionException {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   537
            int colon = arg.indexOf(':');
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   538
            String value = (colon > 0)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   539
                    ? arg.substring(colon + 1)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   540
                    : arg;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   541
            switch (value) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   542
                case "public":
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   543
                    return AccessKind.PUBLIC;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   544
                case "protected":
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   545
                    return AccessKind.PROTECTED;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   546
                case "package":
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   547
                    return AccessKind.PACKAGE;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   548
                case "private":
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   549
                    return AccessKind.PRIVATE;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   550
                default:
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   551
                    String text = getLocalizedMessage("main.illegal_option_value", value);
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   552
                    throw new IllegalOptionValue(this::usage, text);
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   553
            }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   554
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   555
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   556
        /*
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   557
         * Sets the entire kind map to PROTECTED this is the default.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   558
         */
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   559
        private void populateDefaultAccessMap() {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   560
            populateSimpleAccessMap(AccessKind.PROTECTED);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   561
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   562
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   563
        /*
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   564
         * This sets access to all the allowed kinds in the
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   565
         * access map.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   566
         */
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   567
        void populateSimpleAccessMap(AccessKind accessValue) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   568
            for (ElementKind kind : ElementsTable.ModifierFilter.ALLOWED_KINDS) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   569
                switch (kind) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   570
                    case METHOD:
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   571
                        jdtoolOpts.put(SHOW_MEMBERS, accessValue);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   572
                        break;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   573
                    case CLASS:
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   574
                        jdtoolOpts.put(SHOW_TYPES, accessValue);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   575
                        break;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   576
                    case PACKAGE:
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   577
                        jdtoolOpts.put(SHOW_PACKAGES, accessValue);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   578
                        break;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   579
                    case MODULE:
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   580
                        jdtoolOpts.put(SHOW_MODULE_CONTENTS, accessValue);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   581
                        break;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   582
                    default:
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   583
                        throw new AssertionError("unknown element kind:" + kind);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   584
                }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40308
diff changeset
   585
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31936
diff changeset
   586
        }
14543
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   587
    }
43edeaf6d0a9 8003257: refactor javadoc tool option handling
jjg
parents:
diff changeset
   588
}