langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java
author pmuthuswamy
Wed, 02 Aug 2017 09:26:35 -0700
changeset 46080 65ccd412049b
parent 46079 059faa5e1267
child 46085 373965429061
permissions -rw-r--r--
8183582: Rationalize doclet -docencoding and -charset options Reviewed-by: jjg, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
43872
b5ce3bc28931 8174839: javadoc crashes with a method which does not override a super.
ksrini
parents: 43261
diff changeset
     2
 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    26
package jdk.javadoc.internal.doclets.toolkit;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14061
diff changeset
    28
import java.io.*;
44460
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
    29
import java.lang.ref.*;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14061
diff changeset
    30
import java.util.*;
35419
6adb831721fe 8148413: Memory leak in javadoc VisibleMemberMap
jjg
parents: 25874
diff changeset
    31
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    32
import javax.lang.model.element.Element;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
    33
import javax.lang.model.element.ModuleElement;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    34
import javax.lang.model.element.PackageElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    35
import javax.lang.model.element.TypeElement;
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
    36
import javax.lang.model.util.SimpleElementVisitor9;
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 19937
diff changeset
    37
import javax.tools.JavaFileManager;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    38
import javax.tools.JavaFileObject;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14061
diff changeset
    39
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    40
import com.sun.source.util.DocTreePath;
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
    41
import com.sun.tools.javac.util.DefinedBy;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
    42
import com.sun.tools.javac.util.DefinedBy.Api;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    43
import jdk.javadoc.doclet.Doclet;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    44
import jdk.javadoc.doclet.DocletEnvironment;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    45
import jdk.javadoc.doclet.Reporter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    46
import jdk.javadoc.internal.doclets.toolkit.builders.BuilderFactory;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    47
import jdk.javadoc.internal.doclets.toolkit.taglets.TagletManager;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    48
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    49
import jdk.javadoc.internal.doclets.toolkit.util.DocFileFactory;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    50
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    51
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    52
import jdk.javadoc.internal.doclets.toolkit.util.Extern;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    53
import jdk.javadoc.internal.doclets.toolkit.util.Group;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    54
import jdk.javadoc.internal.doclets.toolkit.util.MetaKeywords;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    55
import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    56
import jdk.javadoc.internal.doclets.toolkit.util.TypeElementCatalog;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    57
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
    58
import jdk.javadoc.internal.doclets.toolkit.util.Utils.Pair;
44460
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
    59
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    60
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.GetterSetter;
44460
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
    61
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.Kind;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    62
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
    63
import static javax.tools.Diagnostic.Kind.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
 * Configure the output based on the options. Doclets should sub-class
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 45157
diff changeset
    67
 * BaseConfiguration, to configure and add their own options. This class contains
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
 * all user options which are supported by the 1.1 doclet and the standard
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
 * doclet.
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
    70
 * <p>
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
    71
 * <p><b>This is NOT part of any supported API.
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
    72
 * If you write code that depends on this, you do so at your own risk.
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
    73
 * This code and its internal interfaces are subject to change or
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
    74
 * deletion without notice.</b>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
 * @author Robert Field.
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
 * @author Atul Dambalkar.
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
 * @author Jamie Ho
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
 */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 45157
diff changeset
    80
public abstract class BaseConfiguration {
44388
4d0903f1f311 8176836: Provide Taglet with context
jjg
parents: 44293
diff changeset
    81
    /**
4d0903f1f311 8176836: Provide Taglet with context
jjg
parents: 44293
diff changeset
    82
     * The doclet that created this configuration.
4d0903f1f311 8176836: Provide Taglet with context
jjg
parents: 44293
diff changeset
    83
     */
4d0903f1f311 8176836: Provide Taglet with context
jjg
parents: 44293
diff changeset
    84
    public final Doclet doclet;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     * The factory for builders.
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    protected BuilderFactory builderFactory;
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     * The taglet manager.
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
    public TagletManager tagletManager;
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     * The path to the builder XML input file.
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
    public String builderXMLPath;
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
     * The default path to the builder XML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   104
    public static final String DEFAULT_BUILDER_XML = "resources/doclet.xml";
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
     * The path to Taglets
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     */
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   109
    public String tagletpath = null;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     * This is true if option "-serialwarn" is used. Defualt value is false to
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   113
     * suppress excessive warnings about serial tag.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    public boolean serialwarn = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
     * The specified amount of space between tab stops.
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
     */
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   120
    public int sourcetab;
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   121
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   122
    public String tabSpaces;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     * True if we should generate browsable sources.
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    public boolean linksource = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     * True if command line option "-nosince" is used. Default value is
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     * false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
    public boolean nosince = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * True if we should recursively copy the doc-file subdirectories
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    public boolean copydocfilesubdirs = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   141
     * Maintain backward compatibility with previous javadoc version
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   142
     */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   143
    public boolean backwardCompatibility = true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   144
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   145
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     * True if user wants to add member names as meta keywords.
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     * Set to false because meta keywords are ignored in general
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
     * by most Internet search engines.
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
    public boolean keywords = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
    /**
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   153
     * The meta tag keywords instance.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     */
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   155
    public final MetaKeywords metakeywords;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
    /**
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   158
     * The set of doc-file subdirectories to exclude
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   160
    protected Set<String> excludedDocFileDirs;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
    /**
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   163
     * The set of qualifiers to exclude
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   165
    protected Set<String> excludedQualifiers;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
    /**
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   168
     * The doclet environment.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
     */
39364
bd6d4a7936b4 8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents: 39181
diff changeset
   170
    public DocletEnvironment docEnv;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
    /**
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   173
     * An utility class for commonly used helpers
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   174
     */
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   175
    public Utils utils;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   176
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   177
    /**
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   178
     * All the temporary accessors to javac internals.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   179
     */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   180
    public WorkArounds workArounds;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   181
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   182
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     * Destination directory name, in which doclet will generate the entire
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     * documentation. Default is current directory.
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
    public String destDirName = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     * Destination directory name, in which doclet will copy the doc-files to.
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
    public String docFileDestDirName = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     * Encoding for this document. Default is default encoding for this
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
     * platform.
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
    public String docencoding = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
     * True if user wants to suppress descriptions and tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
    public boolean nocomment = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     * Encoding for this document. Default is default encoding for this
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
     * platform.
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
    public String encoding = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
     * Generate author specific information for all the classes if @author
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     * tag is used in the doc comment and if -author option is used.
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
     * <code>showauthor</code> is set to true if -author option is used.
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
     * Default is don't show author information.
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
    public boolean showauthor = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
    /**
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   219
     * Generate documentation for JavaFX getters and setters automatically
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   220
     * by copying it from the appropriate property definition.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   221
     */
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   222
    public boolean javafx = false;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   223
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   224
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
     * Generate version specific information for the all the classes
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
     * if @version tag is used in the doc comment and if -version option is
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
     * used. <code>showversion</code> is set to true if -version option is
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
     * used.Default is don't show version information.
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
    public boolean showversion = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
    /**
43261
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
   233
     * Allow JavaScript in doc comments.
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
   234
     */
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
   235
    private boolean allowScriptInComments = false;
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
   236
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
   237
    /**
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   238
     * Sourcepath from where to read the source files. Default is classpath.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   239
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   240
    public String sourcepath = "";
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   241
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   242
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   243
     * Generate modules documentation if more than one module is present.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   244
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   245
    public boolean showModules = false;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   246
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   247
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
     * Don't generate deprecated API information at all, if -nodeprecated
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
     * option is used. <code>nodepracted</code> is set to true if
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
     * -nodeprecated option is used. Default is generate deprected API
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
     * information.
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
    public boolean nodeprecated = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
     * The catalog of classes specified on the command-line
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   258
    public TypeElementCatalog typeElementCatalog;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
     * True if user wants to suppress time stamp in output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
     * Default is false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
     */
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   264
    public boolean notimestamp = false;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
    /**
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   267
     * The package grouping instance.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
     */
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   269
    public final Group group = new Group(this);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
    /**
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   272
     * The tracker of external package links.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
    public final Extern extern = new Extern(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   276
    public Reporter reporter;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   277
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   278
    public Locale locale;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   279
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   280
    /**
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   281
     * Suppress all messages
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   282
     */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   283
    public boolean quiet = false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   284
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   285
    // A list containing urls
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   286
    private final List<String> linkList = new ArrayList<>();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   287
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   288
     // A list of pairs containing urls and package list
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   289
    private final List<Pair<String, String>> linkOfflineList = new ArrayList<>();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   290
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   291
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   292
    public boolean dumpOnError = false;
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 41252
diff changeset
   293
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   294
    private List<Pair<String, String>> groupPairs;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   295
44460
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
   296
    private final Map<TypeElement, EnumMap<Kind, Reference<VisibleMemberMap>>> typeElementMemberCache;
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
   297
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   298
    public abstract Messages getMessages();
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   299
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   300
    public abstract Resources getResources();
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   301
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
     * Return the build date for the doclet.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   304
     *
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   305
     * @return the build date
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
    public abstract String getDocletSpecificBuildDate();
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
    /**
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   310
     * This method should be defined in all those doclets (configurations),
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 45157
diff changeset
   311
     * which want to derive themselves from this BaseConfiguration. This method
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   312
     * can be used to finish up the options setup.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   313
     *
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   314
     * @return true if successful and false otherwise
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   316
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   317
    public abstract boolean finishOptionSettings();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   319
    public CommentUtils cmtUtils;
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14545
diff changeset
   320
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14545
diff changeset
   321
    /**
41633
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41451
diff changeset
   322
     * A sorted set of included packages.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
     */
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   324
    public SortedSet<PackageElement> packages = null;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   325
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   326
    public OverviewElement overviewElement;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
35419
6adb831721fe 8148413: Memory leak in javadoc VisibleMemberMap
jjg
parents: 25874
diff changeset
   328
    // The following three fields provide caches for use by all instances of VisibleMemberMap.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   329
    public final Map<TypeElement, List<Element>> propertiesCache = new HashMap<>();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   330
    public final Map<Element, Element> classPropertiesMap = new HashMap<>();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   331
    public final Map<Element, GetterSetter> getterSetterMap = new HashMap<>();
35419
6adb831721fe 8148413: Memory leak in javadoc VisibleMemberMap
jjg
parents: 25874
diff changeset
   332
35420
9303ae941f69 8148417: Memory leak in javadoc DocFileFactory
jjg
parents: 35419
diff changeset
   333
    public DocFileFactory docFileFactory;
9303ae941f69 8148417: Memory leak in javadoc DocFileFactory
jjg
parents: 35419
diff changeset
   334
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
    /**
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   336
     * A sorted map, giving the (specified|included|other) packages for each module.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   337
     */
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   338
    public SortedMap<ModuleElement, Set<PackageElement>> modulePackages;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   339
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   340
    /**
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   341
     * The list of known modules, that should be documented.
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   342
     */
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   343
    public SortedSet<ModuleElement> modules;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   344
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   345
    protected static final String sharedResourceBundleName =
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   346
            "jdk.javadoc.internal.doclets.toolkit.resources.doclets";
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   347
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   348
    /**
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   349
     * Constructs the configurations needed by the doclet.
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   350
     *
44388
4d0903f1f311 8176836: Provide Taglet with context
jjg
parents: 44293
diff changeset
   351
     * @param doclet the doclet that created this configuration
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 45157
diff changeset
   353
    public BaseConfiguration(Doclet doclet) {
44388
4d0903f1f311 8176836: Provide Taglet with context
jjg
parents: 44293
diff changeset
   354
        this.doclet = doclet;
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   355
        excludedDocFileDirs = new HashSet<>();
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   356
        excludedQualifiers = new HashSet<>();
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   357
        setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   358
        metakeywords = new MetaKeywords(this);
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   359
        groupPairs = new ArrayList<>(0);
44460
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
   360
        typeElementMemberCache = new HashMap<>();
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   361
    }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   362
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   363
    private boolean initialized = false;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   364
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   365
    protected void initConfiguration(DocletEnvironment docEnv) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   366
        if (initialized) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   367
            throw new IllegalStateException("configuration previously initialized");
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   368
        }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   369
        initialized = true;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   370
        this.docEnv = docEnv;
39364
bd6d4a7936b4 8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents: 39181
diff changeset
   371
        overviewElement = new OverviewElement(docEnv);
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   372
        Splitter specifiedSplitter = new Splitter(docEnv, false);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   373
        specifiedModuleElements = Collections.unmodifiableSet(specifiedSplitter.mset);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   374
        specifiedPackageElements = Collections.unmodifiableSet(specifiedSplitter.pset);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   375
        specifiedTypeElements = Collections.unmodifiableSet(specifiedSplitter.tset);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   376
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   377
        Splitter includedSplitter = new Splitter(docEnv, true);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   378
        includedModuleElements = Collections.unmodifiableSet(includedSplitter.mset);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   379
        includedPackageElements = Collections.unmodifiableSet(includedSplitter.pset);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   380
        includedTypeElements = Collections.unmodifiableSet(includedSplitter.tset);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
     * Return the builder factory for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
     * @return the builder factory for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
    public BuilderFactory getBuilderFactory() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
        if (builderFactory == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
            builderFactory = new BuilderFactory(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
        return builderFactory;
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   395
    public Reporter getReporter() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   396
        return this.reporter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   397
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   398
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   399
    private Set<ModuleElement> specifiedModuleElements;
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   400
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   401
    public Set<ModuleElement> getSpecifiedModuleElements() {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   402
        return specifiedModuleElements;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   403
    }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   404
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   405
    private Set<PackageElement> specifiedPackageElements;
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   406
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   407
    public Set<PackageElement> getSpecifiedPackageElements() {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   408
        return specifiedPackageElements;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   409
    }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   410
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   411
    private Set<TypeElement> specifiedTypeElements;
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   412
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   413
    public Set<TypeElement> getSpecifiedTypeElements() {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   414
        return specifiedTypeElements;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   415
    }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   416
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   417
    private Set<ModuleElement> includedModuleElements;
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   418
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   419
    public Set<ModuleElement> getIncludedModuleElements() {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   420
        return includedModuleElements;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   421
    }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   422
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   423
    private Set<PackageElement> includedPackageElements;
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   424
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   425
    public Set<PackageElement> getIncludedPackageElements() {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   426
        return includedPackageElements;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   427
    }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   428
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   429
    private Set<TypeElement> includedTypeElements;
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   430
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   431
    public Set<TypeElement> getIncludedTypeElements() {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   432
        return includedTypeElements;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   433
    }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   434
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   435
    private void initModules() {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   436
        // Build the modules structure used by the doclet
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   437
        modules = new TreeSet<>(utils.makeModuleComparator());
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   438
        modules.addAll(getSpecifiedModuleElements());
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   439
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   440
        modulePackages = new TreeMap<>(utils.makeModuleComparator());
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   441
        for (PackageElement p : packages) {
39364
bd6d4a7936b4 8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents: 39181
diff changeset
   442
            ModuleElement mdle = docEnv.getElementUtils().getModuleOf(p);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   443
            if (mdle != null && !mdle.isUnnamed()) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   444
                Set<PackageElement> s = modulePackages
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   445
                        .computeIfAbsent(mdle, m -> new TreeSet<>(utils.makePackageComparator()));
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   446
                s.add(p);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   447
            }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   448
        }
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   449
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   450
        for (PackageElement p : getIncludedPackageElements()) {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   451
            ModuleElement mdle = docEnv.getElementUtils().getModuleOf(p);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   452
            if (mdle != null && !mdle.isUnnamed()) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   453
                Set<PackageElement> s = modulePackages
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   454
                        .computeIfAbsent(mdle, m -> new TreeSet<>(utils.makePackageComparator()));
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   455
                s.add(p);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   456
            }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   457
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   458
44293
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 43872
diff changeset
   459
        // add entries for modules which may not have exported packages
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 43872
diff changeset
   460
        modules.forEach((ModuleElement mdle) -> {
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 43872
diff changeset
   461
            modulePackages.computeIfAbsent(mdle, m -> Collections.emptySet());
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 43872
diff changeset
   462
        });
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 43872
diff changeset
   463
37943
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 37848
diff changeset
   464
        modules.addAll(modulePackages.keySet());
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   465
        showModules = !modules.isEmpty();
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   466
        for (Set<PackageElement> pkgs : modulePackages.values()) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   467
            packages.addAll(pkgs);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40314
diff changeset
   468
        }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   469
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   470
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   471
    private void initPackages() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   472
        packages = new TreeSet<>(utils.makePackageComparator());
41633
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41451
diff changeset
   473
        // add all the included packages
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   474
        packages.addAll(includedPackageElements);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   477
    public Set<Doclet.Option> getSupportedOptions() {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
   478
        Resources resources = getResources();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   479
        Doclet.Option[] options = {
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   480
                new Option(resources, "-author") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   481
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   482
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   483
                        showauthor = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   484
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   485
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   486
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   487
                new Option(resources, "-d", 1) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   488
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   489
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   490
                        destDirName = addTrailingFileSep(args.get(0));
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   491
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   492
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   493
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   494
                new Option(resources, "-docencoding", 1) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   495
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   496
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   497
                        docencoding = args.get(0);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   498
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   499
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   500
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   501
                new Option(resources, "-docfilessubdirs") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   502
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   503
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   504
                        copydocfilesubdirs = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   505
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   506
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   507
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   508
                new Hidden(resources, "-encoding", 1) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   509
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   510
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   511
                        encoding = args.get(0);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   512
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   513
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   514
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   515
                new Option(resources, "-excludedocfilessubdir", 1) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   516
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   517
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   518
                        addToSet(excludedDocFileDirs, args.get(0));
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   519
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   520
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   521
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   522
                new Option(resources, "-group", 2) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   523
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   524
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   525
                        groupPairs.add(new Pair<>(args.get(0), args.get(1)));
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   526
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   527
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   528
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   529
                new Option(resources, "--javafx -javafx") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   530
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   531
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   532
                        javafx = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   533
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   534
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   535
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   536
                new Option(resources, "-keywords") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   537
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   538
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   539
                        keywords = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   540
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   541
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   542
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   543
                new Option(resources, "-link", 1) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   544
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   545
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   546
                        linkList.add(args.get(0));
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   547
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   548
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   549
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   550
                new Option(resources, "-linksource") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   551
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   552
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   553
                        linksource = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   554
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   555
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   556
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   557
                new Option(resources, "-linkoffline", 2) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   558
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   559
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   560
                        linkOfflineList.add(new Pair<String, String>(args.get(0), args.get(1)));
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   561
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   562
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   563
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   564
                new Option(resources, "-nocomment") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   565
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   566
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   567
                        nocomment = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   568
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   569
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   570
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   571
                new Option(resources, "-nodeprecated") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   572
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   573
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   574
                        nodeprecated = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   575
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   576
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   577
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   578
                new Option(resources, "-nosince") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   579
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   580
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   581
                        nosince = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   582
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   583
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   584
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   585
                new Option(resources, "-notimestamp") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   586
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   587
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   588
                        notimestamp = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   589
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   590
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   591
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   592
                new Option(resources, "-noqualifier", 1) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   593
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   594
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   595
                        addToSet(excludedQualifiers, args.get(0));
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   596
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   597
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   598
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   599
                new Hidden(resources, "-quiet") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   600
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   601
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   602
                        quiet = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   603
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   604
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   605
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   606
                new Option(resources, "-serialwarn") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   607
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   608
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   609
                        serialwarn = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   610
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   611
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   612
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   613
                new Option(resources, "-sourcetab", 1) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   614
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   615
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   616
                        linksource = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   617
                        try {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   618
                            setTabWidth(Integer.parseInt(args.get(0)));
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   619
                        } catch (NumberFormatException e) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   620
                            //Set to -1 so that warning will be printed
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   621
                            //to indicate what is valid argument.
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   622
                            sourcetab = -1;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   623
                        }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   624
                        if (sourcetab <= 0) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   625
                            getMessages().warning("doclet.sourcetab_warning");
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   626
                            setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   627
                        }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   628
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   629
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   630
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   631
                new Option(resources, "-tag", 1) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   632
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   633
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   634
                        ArrayList<String> list = new ArrayList<>();
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   635
                        list.add(opt);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   636
                        list.add(args.get(0));
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   637
                        customTagStrs.add(list);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   638
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   639
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   640
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   641
                new Option(resources, "-taglet", 1) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   642
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   643
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   644
                        ArrayList<String> list = new ArrayList<>();
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   645
                        list.add(opt);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   646
                        list.add(args.get(0));
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   647
                        customTagStrs.add(list);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   648
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   649
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   650
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   651
                new Option(resources, "-tagletpath", 1) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   652
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   653
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   654
                        tagletpath = args.get(0);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   655
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   656
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   657
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   658
                new Option(resources, "-version") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   659
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   660
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   661
                        showversion = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   662
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   663
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   664
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   665
                new Hidden(resources, "--dump-on-error") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   666
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   667
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   668
                        dumpOnError = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   669
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   670
                    }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   671
                },
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   672
                new Option(resources, "--allow-script-in-comments") {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   673
                    @Override
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   674
                    public boolean process(String opt, List<String> args) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   675
                        allowScriptInComments = true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   676
                        return true;
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   677
                    }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   678
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   679
        };
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   680
        Set<Doclet.Option> set = new TreeSet<>();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   681
        set.addAll(Arrays.asList(options));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   682
        return set;
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14545
diff changeset
   683
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14545
diff changeset
   684
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   685
    final LinkedHashSet<List<String>> customTagStrs = new LinkedHashSet<>();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   686
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   687
    /*
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   688
     * when this is called all the option have been set, this method,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   689
     * initializes certain components before anything else is started.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   690
     */
46080
65ccd412049b 8183582: Rationalize doclet -docencoding and -charset options
pmuthuswamy
parents: 46079
diff changeset
   691
    protected boolean finishOptionSettings0() throws DocletException {
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   692
        initDestDirectory();
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   693
        for (String link : linkList) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   694
            extern.link(link, reporter);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   695
        }
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   696
        for (Pair<String, String> linkOfflinePair : linkOfflineList) {
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   697
            extern.link(linkOfflinePair.first, linkOfflinePair.second, reporter);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   698
        }
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   699
        typeElementCatalog = new TypeElementCatalog(includedTypeElements, this);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   700
        initTagletManager(customTagStrs);
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   701
        groupPairs.stream().forEach((grp) -> {
45157
f5f796453339 8178043: Support grouping modules in unified javadoc
bpatel
parents: 44815
diff changeset
   702
            if (showModules) {
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   703
                group.checkModuleGroups(grp.first, grp.second);
45157
f5f796453339 8178043: Support grouping modules in unified javadoc
bpatel
parents: 44815
diff changeset
   704
            } else {
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   705
                group.checkPackageGroups(grp.first, grp.second);
45157
f5f796453339 8178043: Support grouping modules in unified javadoc
bpatel
parents: 44815
diff changeset
   706
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   707
        });
46080
65ccd412049b 8183582: Rationalize doclet -docencoding and -charset options
pmuthuswamy
parents: 46079
diff changeset
   708
        return true;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   709
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   710
06bc494ca11e Initial load
duke
parents:
diff changeset
   711
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   712
     * Set the command line options supported by this configuration.
06bc494ca11e Initial load
duke
parents:
diff changeset
   713
     *
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   714
     * @return true if the options are set successfully
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   715
     * @throws DocletException if there is a problem while setting the options
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   716
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   717
    public boolean setOptions() throws DocletException {
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   718
        initPackages();
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   719
        initModules();
46080
65ccd412049b 8183582: Rationalize doclet -docencoding and -charset options
pmuthuswamy
parents: 46079
diff changeset
   720
        if (!finishOptionSettings0() || !finishOptionSettings())
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   721
            return false;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   722
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   723
        return true;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   724
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   725
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   726
    private void initDestDirectory() throws DocletException {
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   727
        if (!destDirName.isEmpty()) {
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   728
            DocFile destDir = DocFile.createFileForDirectory(this, destDirName);
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   729
            if (!destDir.exists()) {
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   730
                //Create the output directory (in case it doesn't exist yet)
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   731
                reporter.print(NOTE, getText("doclet.dest_dir_create", destDirName));
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   732
                destDir.mkdirs();
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   733
            } else if (!destDir.isDirectory()) {
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   734
                throw new SimpleDocletException(getText(
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   735
                        "doclet.destination_directory_not_directory_0",
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   736
                        destDir.getPath()));
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   737
            } else if (!destDir.canWrite()) {
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   738
                throw new SimpleDocletException(getText(
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   739
                        "doclet.destination_directory_not_writable_0",
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   740
                        destDir.getPath()));
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   741
            }
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   742
        }
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   743
        DocFileFactory.getFactory(this).setDestDir(destDirName);
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   744
    }
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   745
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   746
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   747
     * Initialize the taglet manager.  The strings to initialize the simple custom tags should
06bc494ca11e Initial load
duke
parents:
diff changeset
   748
     * be in the following format:  "[tag name]:[location str]:[heading]".
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   749
     *
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   750
     * @param customTagStrs the set two dimensional arrays of strings.  These arrays contain
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   751
     *                      either -tag or -taglet arguments.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   752
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   753
    private void initTagletManager(Set<List<String>> customTagStrs) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   754
        tagletManager = tagletManager == null ?
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   755
                new TagletManager(nosince, showversion, showauthor, javafx, this) :
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   756
                tagletManager;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   757
        for (List<String> args : customTagStrs) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   758
            if (args.get(0).equals("-taglet")) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   759
                tagletManager.addCustomTag(args.get(1), getFileManager(), tagletpath);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   760
                continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
   761
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   762
            List<String> tokens = tokenize(args.get(1), TagletManager.SIMPLE_TAGLET_OPT_SEPARATOR, 3);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   763
            if (tokens.size() == 1) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   764
                String tagName = args.get(1);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   765
                if (tagletManager.isKnownCustomTag(tagName)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   766
                    //reorder a standard tag
06bc494ca11e Initial load
duke
parents:
diff changeset
   767
                    tagletManager.addNewSimpleCustomTag(tagName, null, "");
06bc494ca11e Initial load
duke
parents:
diff changeset
   768
                } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   769
                    //Create a simple tag with the heading that has the same name as the tag.
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14260
diff changeset
   770
                    StringBuilder heading = new StringBuilder(tagName + ":");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   771
                    heading.setCharAt(0, Character.toUpperCase(tagName.charAt(0)));
06bc494ca11e Initial load
duke
parents:
diff changeset
   772
                    tagletManager.addNewSimpleCustomTag(tagName, heading.toString(), "a");
06bc494ca11e Initial load
duke
parents:
diff changeset
   773
                }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   774
            } else if (tokens.size() == 2) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   775
                //Add simple taglet without heading, probably to excluding it in the output.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   776
                tagletManager.addNewSimpleCustomTag(tokens.get(0), tokens.get(1), "");
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   777
            } else if (tokens.size() >= 3) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   778
                tagletManager.addNewSimpleCustomTag(tokens.get(0), tokens.get(2), tokens.get(1));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   779
            } else {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   780
                Messages messages = getMessages();
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   781
                messages.error("doclet.Error_invalid_custom_tag_argument", args.get(1));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   782
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   783
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   784
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   785
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   786
    /**
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   787
     * Given a string, return an array of tokens.  The separator can be escaped
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   788
     * with the '\' character.  The '\' character may also be escaped by the
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   789
     * '\' character.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   790
     *
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   791
     * @param s         the string to tokenize.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   792
     * @param separator the separator char.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   793
     * @param maxTokens the maximum number of tokens returned.  If the
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   794
     *                  max is reached, the remaining part of s is appended
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   795
     *                  to the end of the last token.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   796
     * @return an array of tokens.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   797
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   798
    private List<String> tokenize(String s, char separator, int maxTokens) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   799
        List<String> tokens = new ArrayList<>();
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   800
        StringBuilder token = new StringBuilder();
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   801
        boolean prevIsEscapeChar = false;
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   802
        for (int i = 0; i < s.length(); i += Character.charCount(i)) {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   803
            int currentChar = s.codePointAt(i);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   804
            if (prevIsEscapeChar) {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   805
                // Case 1:  escaped character
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   806
                token.appendCodePoint(currentChar);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   807
                prevIsEscapeChar = false;
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   808
            } else if (currentChar == separator && tokens.size() < maxTokens - 1) {
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   809
                // Case 2:  separator
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   810
                tokens.add(token.toString());
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   811
                token = new StringBuilder();
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   812
            } else if (currentChar == '\\') {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   813
                // Case 3:  escape character
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   814
                prevIsEscapeChar = true;
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   815
            } else {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   816
                // Case 4:  regular character
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   817
                token.appendCodePoint(currentChar);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   818
            }
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   819
        }
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   820
        if (token.length() > 0) {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   821
            tokens.add(token.toString());
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   822
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   823
        return tokens;
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   824
    }
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   825
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   826
    private void addToSet(Set<String> s, String str) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   827
        StringTokenizer st = new StringTokenizer(str, ":");
06bc494ca11e Initial load
duke
parents:
diff changeset
   828
        String current;
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   829
        while (st.hasMoreTokens()) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   830
            current = st.nextToken();
06bc494ca11e Initial load
duke
parents:
diff changeset
   831
            s.add(current);
06bc494ca11e Initial load
duke
parents:
diff changeset
   832
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   833
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   834
06bc494ca11e Initial load
duke
parents:
diff changeset
   835
    /**
14061
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents: 13842
diff changeset
   836
     * Add a trailing file separator, if not found. Remove superfluous
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents: 13842
diff changeset
   837
     * file separators if any. Preserve the front double file separator for
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents: 13842
diff changeset
   838
     * UNC paths.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   839
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   840
     * @param path Path under consideration.
06bc494ca11e Initial load
duke
parents:
diff changeset
   841
     * @return String Properly constructed path string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   842
     */
14061
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents: 13842
diff changeset
   843
    public static String addTrailingFileSep(String path) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   844
        String fs = System.getProperty("file.separator");
06bc494ca11e Initial load
duke
parents:
diff changeset
   845
        String dblfs = fs + fs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   846
        int indexDblfs;
14061
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents: 13842
diff changeset
   847
        while ((indexDblfs = path.indexOf(dblfs, 1)) >= 0) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   848
            path = path.substring(0, indexDblfs) +
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   849
                    path.substring(indexDblfs + fs.length());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   850
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   851
        if (!path.endsWith(fs))
06bc494ca11e Initial load
duke
parents:
diff changeset
   852
            path += fs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   853
        return path;
06bc494ca11e Initial load
duke
parents:
diff changeset
   854
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   855
06bc494ca11e Initial load
duke
parents:
diff changeset
   856
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   857
     * This checks for the validity of the options used by the user.
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   858
     * As of this writing, this checks only docencoding.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   859
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   860
     * @return true if all the options are valid.
06bc494ca11e Initial load
duke
parents:
diff changeset
   861
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   862
    public boolean generalValidOptions() {
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   863
        if (docencoding != null) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   864
            if (!checkOutputFileEncoding(docencoding)) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   865
                return false;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   866
            }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   867
        }
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
   868
        if (docencoding == null && (encoding != null && !encoding.isEmpty())) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   869
            if (!checkOutputFileEncoding(encoding)) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   870
                return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   871
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   872
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   873
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   874
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   875
06bc494ca11e Initial load
duke
parents:
diff changeset
   876
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   877
     * Check the validity of the given Source or Output File encoding on this
06bc494ca11e Initial load
duke
parents:
diff changeset
   878
     * platform.
06bc494ca11e Initial load
duke
parents:
diff changeset
   879
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   880
     * @param docencoding output file encoding.
06bc494ca11e Initial load
duke
parents:
diff changeset
   881
     * @param reporter    used to report errors.
06bc494ca11e Initial load
duke
parents:
diff changeset
   882
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   883
    private boolean checkOutputFileEncoding(String docencoding) {
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   884
        OutputStream ost = new ByteArrayOutputStream();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   885
        OutputStreamWriter osw = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   886
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   887
            osw = new OutputStreamWriter(ost, docencoding);
06bc494ca11e Initial load
duke
parents:
diff changeset
   888
        } catch (UnsupportedEncodingException exc) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   889
            reporter.print(ERROR, getText("doclet.Encoding_not_supported", docencoding));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   890
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   891
        } finally {
06bc494ca11e Initial load
duke
parents:
diff changeset
   892
            try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   893
                if (osw != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   894
                    osw.close();
06bc494ca11e Initial load
duke
parents:
diff changeset
   895
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   896
            } catch (IOException exc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   897
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   898
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   899
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   900
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   901
06bc494ca11e Initial load
duke
parents:
diff changeset
   902
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   903
     * Return true if the given doc-file subdirectory should be excluded and
06bc494ca11e Initial load
duke
parents:
diff changeset
   904
     * false otherwise.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   905
     *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   906
     * @param docfilesubdir the doc-files subdirectory to check.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   907
     * @return true if the directory is excluded.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   908
     */
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   909
    public boolean shouldExcludeDocFileDir(String docfilesubdir) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   910
        return excludedDocFileDirs.contains(docfilesubdir);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   911
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   912
06bc494ca11e Initial load
duke
parents:
diff changeset
   913
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   914
     * Return true if the given qualifier should be excluded and false otherwise.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   915
     *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   916
     * @param qualifier the qualifier to check.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   917
     * @return true if the qualifier should be excluded
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   918
     */
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   919
    public boolean shouldExcludeQualifier(String qualifier) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   920
        if (excludedQualifiers.contains("all") ||
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   921
                excludedQualifiers.contains(qualifier) ||
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   922
                excludedQualifiers.contains(qualifier + ".*")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   923
            return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   924
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   925
            int index = -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   926
            while ((index = qualifier.indexOf(".", index + 1)) != -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   927
                if (excludedQualifiers.contains(qualifier.substring(0, index + 1) + "*")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   928
                    return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   929
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   930
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   931
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   932
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   933
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   934
06bc494ca11e Initial load
duke
parents:
diff changeset
   935
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   936
     * Return the qualified name of the Element if its qualifier is not excluded.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   937
     * Otherwise return the unqualified Element name.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   938
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   939
     * @param te the TypeElement to check.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   940
     * @return the class name
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   941
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   942
    public String getClassName(TypeElement te) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   943
        PackageElement pkg = utils.containingPackage(te);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   944
        return shouldExcludeQualifier(utils.getPackageName(pkg))
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   945
                ? utils.getSimpleName(te)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
   946
                : utils.getFullyQualifiedName(te);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   947
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   948
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   949
    /**
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   950
     * Convenience method to obtain a resource from the doclet's
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   951
     * {@link Resources resources}.
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   952
     * Equivalent to <code>getResources.getText(key);</code>.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   953
     *
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   954
     * @param key the key for the desired string
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   955
     * @return the string for the given key
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   956
     * @throws MissingResourceException if the key is not found in either
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   957
     *                                  bundle.
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   958
     */
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   959
    public abstract String getText(String key);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   960
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   961
    /**
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   962
     * Convenience method to obtain a resource from the doclet's
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   963
     * {@link Resources resources}.
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   964
     * Equivalent to <code>getResources.getText(key, args);</code>.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   965
     *
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   966
     * @param key  the key for the desired string
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   967
     * @param args values to be substituted into the resulting string
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   968
     * @return the string for the given key
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   969
     * @throws MissingResourceException if the key is not found in either
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   970
     *                                  bundle.
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   971
     */
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   972
    public abstract String getText(String key, String... args);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   973
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   974
    /**
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   975
     * Convenience method to obtain a resource from the doclet's
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   976
     * {@link Resources resources} as a {@code Content} object.
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   977
     *
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   978
     * @param key the key for the desired string
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   979
     * @return a content tree for the text
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   980
     */
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   981
    public abstract Content getContent(String key);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   982
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   983
    /**
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   984
     * Convenience method to obtain a resource from the doclet's
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   985
     * {@link Resources resources} as a {@code Content} object.
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   986
     *
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   987
     * @param key the key for the desired string
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   988
     * @param o   string or content argument added to configuration text
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   989
     * @return a content tree for the text
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   990
     */
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   991
    public abstract Content getContent(String key, Object o);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   992
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   993
    /**
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   994
     * Convenience method to obtain a resource from the doclet's
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   995
     * {@link Resources resources} as a {@code Content} object.
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   996
     *
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   997
     * @param key the key for the desired string
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   998
     * @param o1  resource argument
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
   999
     * @param o2  resource argument
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
  1000
     * @return a content tree for the text
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
  1001
     */
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
  1002
    public abstract Content getContent(String key, Object o1, Object o2);
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
  1003
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
  1004
    /**
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
  1005
     * Get the configuration string as a content.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
  1006
     *
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
  1007
     * @param key the key for the desired string
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1008
     * @param o0  string or content argument added to configuration text
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
  1009
     * @param o1  string or content argument added to configuration text
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
  1010
     * @param o2  string or content argument added to configuration text
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
  1011
     * @return a content tree for the text
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
  1012
     */
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
  1013
    public abstract Content getContent(String key, Object o0, Object o1, Object o2);
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
  1014
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1015
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1016
     * Return true if the TypeElement element is getting documented, depending upon
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
  1017
     * -nodeprecated option and the deprecation information. Return true if
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
  1018
     * -nodeprecated is not used. Return false if -nodeprecated is used and if
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1019
     * either TypeElement element is deprecated or the containing package is deprecated.
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
  1020
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1021
     * @param te the TypeElement for which the page generation is checked
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1022
     * @return true if it is a generated doc.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1023
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1024
    public boolean isGeneratedDoc(TypeElement te) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1025
        if (!nodeprecated) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1026
            return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1027
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1028
        return !(utils.isDeprecated(te) || utils.isDeprecated(utils.containingPackage(te)));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1029
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1030
06bc494ca11e Initial load
duke
parents:
diff changeset
  1031
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1032
     * Return the doclet specific instance of a writer factory.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
  1033
     *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1034
     * @return the {@link WriterFactory} for the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1035
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1036
    public abstract WriterFactory getWriterFactory();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1037
06bc494ca11e Initial load
duke
parents:
diff changeset
  1038
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1039
     * Return the input stream to the builder XML.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1040
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1041
     * @return the input steam to the builder XML.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
  1042
     * @throws DocFileIOException when the given XML file cannot be found or opened.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1043
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
  1044
    public InputStream getBuilderXML() throws DocFileIOException {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1045
        return builderXMLPath == null ?
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
  1046
                BaseConfiguration.class.getResourceAsStream(DEFAULT_BUILDER_XML) :
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
  1047
                DocFile.createFileForInput(this, builderXMLPath).openInputStream();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1048
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1049
06bc494ca11e Initial load
duke
parents:
diff changeset
  1050
    /**
1863
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1789
diff changeset
  1051
     * Return the Locale for this document.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
  1052
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1053
     * @return the current locale
1863
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1789
diff changeset
  1054
     */
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1789
diff changeset
  1055
    public abstract Locale getLocale();
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1789
diff changeset
  1056
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1789
diff changeset
  1057
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1058
     * Return the path of the overview file and null if it does not exist.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1059
     *
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1060
     * @return the path of the overview file.
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
  1061
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1062
    public abstract JavaFileObject getOverviewPath();
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
  1063
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
  1064
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1065
     * Return the current file manager.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
  1066
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1067
     * @return JavaFileManager
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1068
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1069
    public abstract JavaFileManager getFileManager();
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
  1070
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
  1071
    private void setTabWidth(int n) {
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
  1072
        sourcetab = n;
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
  1073
        tabSpaces = String.format("%" + n + "s", "");
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
  1074
    }
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
  1075
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1076
    public abstract boolean showMessage(DocTreePath path, String key);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1077
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1078
    public abstract boolean showMessage(Element e, String key);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1079
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1080
    public static abstract class Option implements Doclet.Option, Comparable<Option> {
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1081
        private final String[] names;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1082
        private final String parameters;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1083
        private final String description;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1084
        private final int argCount;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1085
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1086
        protected Option(Resources resources, String name, int argCount) {
44815
2a0f6c7033bd 8178830: standard doclet: -javafx option should be unhidden
ksrini
parents: 44460
diff changeset
  1087
            this(resources, null, name, argCount);
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1088
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1089
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1090
        protected Option(Resources resources, String keyBase, String name, int argCount) {
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1091
            this.names = name.trim().split("\\s+");
44815
2a0f6c7033bd 8178830: standard doclet: -javafx option should be unhidden
ksrini
parents: 44460
diff changeset
  1092
            if (keyBase == null) {
2a0f6c7033bd 8178830: standard doclet: -javafx option should be unhidden
ksrini
parents: 44460
diff changeset
  1093
                keyBase = "doclet.usage." + names[0].toLowerCase().replaceAll("^-+", "");
2a0f6c7033bd 8178830: standard doclet: -javafx option should be unhidden
ksrini
parents: 44460
diff changeset
  1094
            }
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1095
            String desc = getOptionsMessage(resources, keyBase + ".description");
40314
52f8470ce3e4 8163524: doclet resources doclet.usage.NAME.name are redundant
jjg
parents: 40303
diff changeset
  1096
            if (desc.isEmpty()) {
52f8470ce3e4 8163524: doclet resources doclet.usage.NAME.name are redundant
jjg
parents: 40303
diff changeset
  1097
                this.description = "<MISSING KEY>";
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1098
                this.parameters = "<MISSING KEY>";
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1099
            } else {
40314
52f8470ce3e4 8163524: doclet resources doclet.usage.NAME.name are redundant
jjg
parents: 40303
diff changeset
  1100
                this.description = desc;
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1101
                this.parameters = getOptionsMessage(resources, keyBase + ".parameters");
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1102
            }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1103
            this.argCount = argCount;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1104
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1105
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1106
        protected Option(Resources resources, String name) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1107
            this(resources, name, 0);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1108
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1109
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1110
        private String getOptionsMessage(Resources resources, String key) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1111
            try {
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1112
                return resources.getText(key);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1113
            } catch (MissingResourceException ignore) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1114
                return "";
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1115
            }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1116
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1117
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1118
        @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1119
        public String getDescription() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1120
            return description;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1121
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1122
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1123
        @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1124
        public Option.Kind getKind() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1125
            return Doclet.Option.Kind.STANDARD;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1126
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1127
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1128
        @Override
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1129
        public List<String> getNames() {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1130
            return Arrays.asList(names);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1131
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1132
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1133
        @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1134
        public String getParameters() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1135
            return parameters;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1136
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1137
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1138
        @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1139
        public String toString() {
43872
b5ce3bc28931 8174839: javadoc crashes with a method which does not override a super.
ksrini
parents: 43261
diff changeset
  1140
            return Arrays.toString(names);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1141
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1142
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1143
        @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1144
        public int getArgumentCount() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1145
            return argCount;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1146
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1147
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1148
        public boolean matches(String option) {
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1149
            for (String name : names) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1150
                boolean matchCase = name.startsWith("--");
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1151
                if (option.startsWith("--") && option.contains("=")) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1152
                    return name.equals(option.substring(option.indexOf("=") + 1));
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1153
                } else if (matchCase) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1154
                    return name.equals(option);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1155
                }
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1156
                return name.toLowerCase().equals(option.toLowerCase());
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1157
            }
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1158
            return false;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1159
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1160
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1161
        @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1162
        public int compareTo(Option that) {
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1163
            return this.getNames().get(0).compareTo(that.getNames().get(0));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1164
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1165
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1166
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1167
    public abstract class XOption extends Option {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1168
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1169
        public XOption(Resources resources, String prefix, String name, int argCount) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1170
            super(resources, prefix, name, argCount);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1171
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1172
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1173
        public XOption(Resources resources, String name, int argCount) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1174
            super(resources, name, argCount);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1175
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1176
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1177
        public XOption(Resources resources, String name) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1178
            this(resources, name, 0);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1179
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1180
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1181
        @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1182
        public Option.Kind getKind() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1183
            return Doclet.Option.Kind.EXTENDED;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1184
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1185
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1186
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1187
    public abstract class Hidden extends Option {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1188
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1189
        public Hidden(Resources resources, String name, int argCount) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1190
            super(resources, name, argCount);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1191
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1192
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1193
        public Hidden(Resources resources, String name) {
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 40587
diff changeset
  1194
            this(resources, name, 0);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1195
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1196
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1197
        @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1198
        public Option.Kind getKind() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1199
            return Doclet.Option.Kind.OTHER;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1200
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1201
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1202
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 35420
diff changeset
  1203
    /*
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1204
     * Splits the elements in a collection to its individual
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1205
     * collection.
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1206
     */
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1207
    static private class Splitter {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1208
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1209
        final Set<ModuleElement> mset = new LinkedHashSet<>();
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1210
        final Set<PackageElement> pset = new LinkedHashSet<>();
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1211
        final Set<TypeElement> tset = new LinkedHashSet<>();
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1212
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1213
        Splitter(DocletEnvironment docEnv, boolean included) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1214
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1215
            Set<? extends Element> inset = included
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1216
                    ? docEnv.getIncludedElements()
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1217
                    : docEnv.getSpecifiedElements();
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1218
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1219
            for (Element e : inset) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1220
                new SimpleElementVisitor9<Void, Void>() {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1221
                    @Override
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1222
                    @DefinedBy(Api.LANGUAGE_MODEL)
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1223
                    public Void visitModule(ModuleElement e, Void p) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1224
                        mset.add(e);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1225
                        return null;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1226
                    }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1227
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1228
                    @Override
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1229
                    @DefinedBy(Api.LANGUAGE_MODEL)
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1230
                    public Void visitPackage(PackageElement e, Void p) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1231
                        pset.add(e);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1232
                        return null;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1233
                    }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1234
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1235
                    @Override
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1236
                    @DefinedBy(Api.LANGUAGE_MODEL)
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1237
                    public Void visitType(TypeElement e, Void p) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1238
                        tset.add(e);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1239
                        return null;
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1240
                    }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1241
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1242
                    @Override
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1243
                    @DefinedBy(Api.LANGUAGE_MODEL)
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1244
                    protected Void defaultAction(Element e, Void p) {
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1245
                        throw new AssertionError("unexpected element: " + e);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1246
                    }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1247
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1248
                }.visit(e);
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1249
            }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1250
        }
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41633
diff changeset
  1251
    }
43261
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
  1252
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
  1253
    /**
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
  1254
     * Returns whether or not to allow JavaScript in comments.
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
  1255
     * Default is off; can be set true from a command line option.
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 45871
diff changeset
  1256
     *
43261
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
  1257
     * @return the allowScriptInComments
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
  1258
     */
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
  1259
    public boolean isAllowScriptInComments() {
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
  1260
        return allowScriptInComments;
d377e97291d8 8138725: Add options for Javadoc generation
jjg
parents: 42277
diff changeset
  1261
    }
44460
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1262
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1263
    public VisibleMemberMap getVisibleMemberMap(TypeElement te, VisibleMemberMap.Kind kind) {
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1264
        EnumMap<Kind, Reference<VisibleMemberMap>> cacheMap = typeElementMemberCache
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1265
                .computeIfAbsent(te, k -> new EnumMap<>(VisibleMemberMap.Kind.class));
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1266
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1267
        Reference<VisibleMemberMap> vmapRef = cacheMap.get(kind);
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1268
        // recompute, if referent has been garbage collected
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1269
        VisibleMemberMap vMap = vmapRef == null ? null : vmapRef.get();
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1270
        if (vMap == null) {
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1271
            vMap = new VisibleMemberMap(te, kind, this);
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1272
            cacheMap.put(kind, new SoftReference<>(vMap));
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1273
        }
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1274
        return vMap;
9adfc635dd7b 8177567: cache VisibleMemberMap
ksrini
parents: 44388
diff changeset
  1275
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1276
}