langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
author jjg
Fri, 27 May 2016 13:06:58 -0700
changeset 38617 d93a7f64e231
parent 38515 6ae7f7d9b44c
permissions -rw-r--r--
8157606: deprecate com.sun.javadoc API Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
35419
6adb831721fe 8148413: Memory leak in javadoc VisibleMemberMap
jjg
parents: 25874
diff changeset
     2
 * Copyright (c) 1997, 2016, 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
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.doclets.internal.toolkit;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14061
diff changeset
    28
import java.io.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14061
diff changeset
    29
import java.util.*;
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
    30
import java.util.regex.Matcher;
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
    31
import java.util.regex.Pattern;
35419
6adb831721fe 8148413: Memory leak in javadoc VisibleMemberMap
jjg
parents: 25874
diff changeset
    32
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 19937
diff changeset
    33
import javax.tools.JavaFileManager;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
    34
import javax.tools.JavaFileManager.Location;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14061
diff changeset
    35
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14061
diff changeset
    36
import com.sun.javadoc.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14061
diff changeset
    37
import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
import com.sun.tools.doclets.internal.toolkit.taglets.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
import com.sun.tools.doclets.internal.toolkit.util.*;
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 19937
diff changeset
    40
import com.sun.tools.javac.util.StringUtils;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * Configure the output based on the options. Doclets should sub-class
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * Configuration, to configure and add their own options. This class contains
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * all user options which are supported by the 1.1 doclet and the standard
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    48
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    49
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    50
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    51
 *  deletion without notice.</b>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 * @author Robert Field.
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
 * @author Atul Dambalkar.
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 * @author Jamie Ho
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
 */
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 38515
diff changeset
    57
@Deprecated
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
public abstract class Configuration {
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
    /**
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    61
     * Exception used to report a problem during setOptions.
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    62
     */
16560
c6c7f0c26568 8010361: fix some langtools findbugs issues
jjg
parents: 16324
diff changeset
    63
    public static class Fault extends Exception {
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    64
        private static final long serialVersionUID = 0;
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    65
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    66
        Fault(String msg) {
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    67
            super(msg);
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    68
        }
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    69
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    70
        Fault(String msg, Exception cause) {
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    71
            super(msg, cause);
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    72
        }
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    73
    }
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    74
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
    75
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     * The factory for builders.
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
    protected BuilderFactory builderFactory;
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     * The taglet manager.
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    public TagletManager tagletManager;
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * The path to the builder XML input file.
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
    public String builderXMLPath;
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     * The default path to the builder XML.
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    private static final String DEFAULT_BUILDER_XML = "resources/doclet.xml";
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     * The path to Taglets
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
    public String tagletpath = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
     * 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
   102
     * suppress excessive warnings about serial tag.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    public boolean serialwarn = false;
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 specified amount of space between tab stops.
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     */
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   109
    public int sourcetab;
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   110
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   111
    public String tabSpaces;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     * True if we should generate browsable sources.
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
    public boolean linksource = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
     * True if command line option "-nosince" is used. Default value is
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
     * false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
    public boolean nosince = false;
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 recursively copy the doc-file subdirectories
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    public boolean copydocfilesubdirs = 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
     * The META charset tag used for cross-platform viewing.
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    public String charset = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     * True if user wants to add member names as meta keywords.
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * Set to false because meta keywords are ignored in general
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * by most Internet search engines.
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
    public boolean keywords = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    /**
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   142
     * The meta tag keywords instance.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     */
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   144
    public final MetaKeywords metakeywords;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     * The list of doc-file subdirectories to exclude
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   149
    protected Set<String> excludedDocFileDirs;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     * The list of qualifiers to exclude
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   154
    protected Set<String> excludedQualifiers;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
     * The Root of the generated Program Structure from the Doclet API.
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
    public RootDoc root;
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
    /**
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   162
     * An utility class for commonly used helpers
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   163
     */
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   164
    public Utils utils;
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   165
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
     * Destination directory name, in which doclet will generate the entire
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     * documentation. Default is current directory.
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
    public String destDirName = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
     * Destination directory name, in which doclet will copy the doc-files to.
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
    public String docFileDestDirName = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
     * Encoding for this document. Default is default encoding for this
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
     * platform.
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
    public String docencoding = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     * True if user wants to suppress descriptions and tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
    public boolean nocomment = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     * Encoding for this document. Default is default encoding for this
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     * platform.
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
    public String encoding = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     * Generate author specific information for all the classes if @author
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
     * tag is used in the doc comment and if -author option is used.
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
     * <code>showauthor</code> is set to true if -author option is used.
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
     * Default is don't show author information.
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    public boolean showauthor = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
    /**
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   202
     * 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
   203
     * 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
   204
     */
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   205
    public boolean javafx = false;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   206
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   207
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
     * Generate version specific information for the all the classes
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
     * if @version tag is used in the doc comment and if -version option is
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
     * used. <code>showversion</code> is set to true if -version option is
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
     * used.Default is don't show version information.
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
    public boolean showversion = false;
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14545
diff changeset
   214
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14545
diff changeset
   215
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
     * Don't generate deprecated API information at all, if -nodeprecated
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
     * option is used. <code>nodepracted</code> is set to true if
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
     * -nodeprecated option is used. Default is generate deprected API
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
     * information.
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
    public boolean nodeprecated = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
     * The catalog of classes specified on the command-line
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
    public ClassDocCatalog classDocCatalog;
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
     * Message Retriever for the doclet, to retrieve message from the resource
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
     * file for this Configuration, which is common for 1.1 and standard
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
     * doclets.
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
     * TODO:  Make this private!!!
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
    public MessageRetriever message = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
     * True if user wants to suppress time stamp in output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
     * Default is false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
    public boolean notimestamp= false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
    /**
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   244
     * The package grouping instance.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
     */
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   246
    public final Group group = new Group(this);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
    /**
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   249
     * The tracker of external package links.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
    public final Extern extern = new Extern(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
     * Return the build date for the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
    public abstract String getDocletSpecificBuildDate();
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
     * This method should be defined in all those doclets(configurations),
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
     * which want to derive themselves from this Configuration. This method
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
     * can be used to set its own command line options.
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
     * @param options The array of option names and values.
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
     * @throws DocletAbortException
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
     */
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   266
    public abstract void setSpecificDocletOptions(String[][] options) throws Fault;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
     * Return the doclet specific {@link MessageRetriever}
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
     * @return the doclet specific MessageRetriever.
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
    public abstract MessageRetriever getDocletSpecificMsg();
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
    /**
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22165
diff changeset
   275
     * A sorted set of packages specified on the command-line merged with a
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22165
diff changeset
   276
     * collection of packages that contain the classes specified on the
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22165
diff changeset
   277
     * command-line.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
     */
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22165
diff changeset
   279
    public SortedSet<PackageDoc> packages;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   281
    public boolean exportInternalAPI;
35420
9303ae941f69 8148417: Memory leak in javadoc DocFileFactory
jjg
parents: 35419
diff changeset
   282
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
     * Constructor. Constructs the message retriever with resource file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
    public Configuration() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
        message =
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
            new MessageRetriever(this,
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
            "com.sun.tools.doclets.internal.toolkit.resources.doclets");
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   290
        excludedDocFileDirs = new HashSet<>();
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   291
        excludedQualifiers = new HashSet<>();
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   292
        setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   293
        utils = new Utils();
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   294
        metakeywords = new MetaKeywords(this);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
     * Return the builder factory for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
     * @return the builder factory for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
    public BuilderFactory getBuilderFactory() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
        if (builderFactory == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
            builderFactory = new BuilderFactory(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
        return builderFactory;
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
     * This method should be defined in all those doclets
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
     * which want to inherit from this Configuration. This method
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
     * should return the number of arguments to the command line
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
     * option (including the option name).  For example,
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
     * -notimestamp is a single-argument option, so this method would
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
     * return 1.
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
     * @param option Command line option under consideration.
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
     * @return number of arguments to option (including the
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
     * option name). Zero return means option not known.
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
     * Negative value means error occurred.
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
    public int optionLength(String option) {
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 19937
diff changeset
   323
        option = StringUtils.toLowerCase(option);
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   324
        switch (option) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   325
            case "-author":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   326
            case "-docfilessubdirs":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   327
            case "-javafx":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   328
            case "-keywords":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   329
            case "-linksource":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   330
            case "-nocomment":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   331
            case "-nodeprecated":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   332
            case "-nosince":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   333
            case "-notimestamp":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   334
            case "-quiet":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   335
            case "-xnodate":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   336
            case "-version":
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   337
            case "-xdaccessinternalapi":
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   338
                return 1;
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   339
            case "-d":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   340
            case "-docencoding":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   341
            case "-encoding":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   342
            case "-excludedocfilessubdir":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   343
            case "-link":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   344
            case "-sourcetab":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   345
            case "-noqualifier":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   346
            case "-output":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   347
            case "-sourcepath":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   348
            case "-tag":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   349
            case "-taglet":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   350
            case "-tagletpath":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   351
                return 2;
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   352
            case "-group":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   353
            case "-linkoffline":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   354
                return 3;
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   355
            default:
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   356
                return -1;  // indicate we don't know about it
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
     * Perform error checking on the given options.
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
     * @param options  the given options to check.
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
     * @param reporter the reporter used to report errors.
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
    public abstract boolean validOptions(String options[][],
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
        DocErrorReporter reporter);
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22165
diff changeset
   369
    private void initPackages() {
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22165
diff changeset
   370
        packages = new TreeSet<>(Arrays.asList(root.specifiedPackages()));
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   371
        for (ClassDoc aClass : root.specifiedClasses()) {
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22165
diff changeset
   372
            packages.add(aClass.containingPackage());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
     * Set the command line options supported by this configuration.
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
     * @param options the two dimensional array of options.
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
     */
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   381
    public void setOptions(String[][] options) throws Fault {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   382
        LinkedHashSet<String[]> customTagStrs = new LinkedHashSet<>();
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   383
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   384
        // Some options, specifically -link and -linkoffline, require that
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   385
        // the output directory has already been created: so do that first.
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   386
        for (String[] os : options) {
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 19937
diff changeset
   387
            String opt = StringUtils.toLowerCase(os[0]);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
            if (opt.equals("-d")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
                destDirName = addTrailingFileSep(os[1]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
                docFileDestDirName = destDirName;
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   391
                ensureOutputDirExists();
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   392
                break;
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   393
            }
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   394
        }
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   395
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   396
        for (String[] os : options) {
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 19937
diff changeset
   397
            String opt = StringUtils.toLowerCase(os[0]);
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   398
            if (opt.equals("-docfilessubdirs")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
                copydocfilesubdirs = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9606
diff changeset
   400
            } else if (opt.equals("-docencoding")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
                docencoding = os[1];
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9606
diff changeset
   402
            } else if (opt.equals("-encoding")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
                encoding = os[1];
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9606
diff changeset
   404
            } else if (opt.equals("-author")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
                showauthor = true;
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   406
            } else  if (opt.equals("-javafx")) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   407
                javafx = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9606
diff changeset
   408
            } else if (opt.equals("-nosince")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9606
diff changeset
   409
                nosince = true;
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9606
diff changeset
   410
            } else if (opt.equals("-version")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
                showversion = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9606
diff changeset
   412
            } else if (opt.equals("-nodeprecated")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
                nodeprecated = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
            } else if (opt.equals("-excludedocfilessubdir")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
                addToSet(excludedDocFileDirs, os[1]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
            } else if (opt.equals("-noqualifier")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
                addToSet(excludedQualifiers, os[1]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   418
            } else if (opt.equals("-linksource")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   419
                linksource = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   420
            } else if (opt.equals("-sourcetab")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   421
                linksource = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   422
                try {
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   423
                    setTabWidth(Integer.parseInt(os[1]));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   424
                } catch (NumberFormatException e) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
                    //Set to -1 so that warning will be printed
06bc494ca11e Initial load
duke
parents:
diff changeset
   426
                    //to indicate what is valid argument.
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
                    sourcetab = -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
                if (sourcetab <= 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
                    message.warning("doclet.sourcetab_warning");
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   431
                    setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
                }
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9606
diff changeset
   433
            } else if (opt.equals("-notimestamp")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   434
                notimestamp = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9606
diff changeset
   435
            } else if (opt.equals("-nocomment")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
                nocomment = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
            } else if (opt.equals("-tag") || opt.equals("-taglet")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
                customTagStrs.add(os);
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
            } else if (opt.equals("-tagletpath")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   440
                tagletpath = os[1];
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9606
diff changeset
   441
            } else if (opt.equals("-keywords")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   442
                keywords = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9606
diff changeset
   443
            } else if (opt.equals("-serialwarn")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
                serialwarn = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
            } else if (opt.equals("-group")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
                group.checkPackageGroups(os[1], os[2]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   447
            } else if (opt.equals("-link")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
                String url = os[1];
14361
2814fa6977ac 8001219: Clean up use of URLs in javadoc Extern class
jjg
parents: 14263
diff changeset
   449
                extern.link(url, url, root, false);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   450
            } else if (opt.equals("-linkoffline")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
                String url = os[1];
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
                String pkglisturl = os[2];
14361
2814fa6977ac 8001219: Clean up use of URLs in javadoc Extern class
jjg
parents: 14263
diff changeset
   453
                extern.link(url, pkglisturl, root, true);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   454
            } else if (opt.equals("-xdaccessinternalapi")) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   455
                exportInternalAPI = true;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   458
        if (docencoding == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   459
            docencoding = encoding;
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   461
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   462
        classDocCatalog = new ClassDocCatalog(root.specifiedClasses(), this);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   463
        initTagletManager(customTagStrs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   464
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   465
06bc494ca11e Initial load
duke
parents:
diff changeset
   466
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   467
     * Set the command line options supported by this configuration.
06bc494ca11e Initial load
duke
parents:
diff changeset
   468
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   469
     * @throws DocletAbortException
06bc494ca11e Initial load
duke
parents:
diff changeset
   470
     */
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   471
    public void setOptions() throws Fault {
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22165
diff changeset
   472
        initPackages();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
        setOptions(root.options());
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
        setSpecificDocletOptions(root.options());
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   477
    private void ensureOutputDirExists() throws Fault {
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   478
        DocFile destDir = DocFile.createFileForDirectory(this, destDirName);
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   479
        if (!destDir.exists()) {
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   480
            //Create the output directory (in case it doesn't exist yet)
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   481
            root.printNotice(getText("doclet.dest_dir_create", destDirName));
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   482
            destDir.mkdirs();
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   483
        } else if (!destDir.isDirectory()) {
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   484
            throw new Fault(getText(
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   485
                "doclet.destination_directory_not_directory_0",
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   486
                destDir.getPath()));
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   487
        } else if (!destDir.canWrite()) {
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   488
            throw new Fault(getText(
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   489
                "doclet.destination_directory_not_writable_0",
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   490
                destDir.getPath()));
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   491
        }
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   492
    }
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   493
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   494
06bc494ca11e Initial load
duke
parents:
diff changeset
   495
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   496
     * Initialize the taglet manager.  The strings to initialize the simple custom tags should
06bc494ca11e Initial load
duke
parents:
diff changeset
   497
     * be in the following format:  "[tag name]:[location str]:[heading]".
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   498
     * @param customTagStrs the set two dimensional arrays of strings.  These arrays contain
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   499
     * either -tag or -taglet arguments.
06bc494ca11e Initial load
duke
parents:
diff changeset
   500
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1475
diff changeset
   501
    private void initTagletManager(Set<String[]> customTagStrs) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   502
        tagletManager = (tagletManager == null)
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   503
                ? new TagletManager(nosince, showversion, showauthor, javafx, exportInternalAPI, message)
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   504
                : tagletManager;
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   505
        for (String[] args : customTagStrs) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   506
            if (args[0].equals("-taglet")) {
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   507
                tagletManager.addCustomTag(args[1], getFileManager(), tagletpath);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   508
                continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
   509
            }
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   510
            String[] tokens = tokenize(args[1],
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   511
                                       TagletManager.SIMPLE_TAGLET_OPT_SEPARATOR, 3);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   512
            if (tokens.length == 1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   513
                String tagName = args[1];
06bc494ca11e Initial load
duke
parents:
diff changeset
   514
                if (tagletManager.isKnownCustomTag(tagName)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   515
                    //reorder a standard tag
06bc494ca11e Initial load
duke
parents:
diff changeset
   516
                    tagletManager.addNewSimpleCustomTag(tagName, null, "");
06bc494ca11e Initial load
duke
parents:
diff changeset
   517
                } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   518
                    //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
   519
                    StringBuilder heading = new StringBuilder(tagName + ":");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   520
                    heading.setCharAt(0, Character.toUpperCase(tagName.charAt(0)));
06bc494ca11e Initial load
duke
parents:
diff changeset
   521
                    tagletManager.addNewSimpleCustomTag(tagName, heading.toString(), "a");
06bc494ca11e Initial load
duke
parents:
diff changeset
   522
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   523
            } else if (tokens.length == 2) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   524
                //Add simple taglet without heading, probably to excluding it in the output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   525
                tagletManager.addNewSimpleCustomTag(tokens[0], tokens[1], "");
06bc494ca11e Initial load
duke
parents:
diff changeset
   526
            } else if (tokens.length >= 3) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   527
                tagletManager.addNewSimpleCustomTag(tokens[0], tokens[2], tokens[1]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   528
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   529
                message.error("doclet.Error_invalid_custom_tag_argument", args[1]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   530
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   531
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   532
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   533
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   534
    /**
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   535
     * 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
   536
     * 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
   537
     * '\' character.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   538
     *
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   539
     * @param s         the string to tokenize.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   540
     * @param separator the separator char.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   541
     * @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
   542
     *                  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
   543
     *                  to the end of the last token.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   544
     *
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   545
     * @return an array of tokens.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   546
     */
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   547
    private String[] tokenize(String s, char separator, int maxTokens) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   548
        List<String> tokens = new ArrayList<>();
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   549
        StringBuilder  token = new StringBuilder ();
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   550
        boolean prevIsEscapeChar = false;
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   551
        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
   552
            int currentChar = s.codePointAt(i);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   553
            if (prevIsEscapeChar) {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   554
                // Case 1:  escaped character
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   555
                token.appendCodePoint(currentChar);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   556
                prevIsEscapeChar = false;
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   557
            } else if (currentChar == separator && tokens.size() < maxTokens-1) {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   558
                // Case 2:  separator
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   559
                tokens.add(token.toString());
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   560
                token = new StringBuilder();
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   561
            } else if (currentChar == '\\') {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   562
                // Case 3:  escape character
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   563
                prevIsEscapeChar = true;
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   564
            } else {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   565
                // Case 4:  regular character
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   566
                token.appendCodePoint(currentChar);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   567
            }
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   568
        }
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   569
        if (token.length() > 0) {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   570
            tokens.add(token.toString());
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   571
        }
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   572
        return tokens.toArray(new String[] {});
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   573
    }
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   574
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   575
    private void addToSet(Set<String> s, String str){
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   576
        StringTokenizer st = new StringTokenizer(str, ":");
06bc494ca11e Initial load
duke
parents:
diff changeset
   577
        String current;
06bc494ca11e Initial load
duke
parents:
diff changeset
   578
        while(st.hasMoreTokens()){
06bc494ca11e Initial load
duke
parents:
diff changeset
   579
            current = st.nextToken();
06bc494ca11e Initial load
duke
parents:
diff changeset
   580
            s.add(current);
06bc494ca11e Initial load
duke
parents:
diff changeset
   581
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   582
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   583
06bc494ca11e Initial load
duke
parents:
diff changeset
   584
    /**
14061
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents: 13842
diff changeset
   585
     * 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
   586
     * 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
   587
     * UNC paths.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   588
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   589
     * @param path Path under consideration.
06bc494ca11e Initial load
duke
parents:
diff changeset
   590
     * @return String Properly constructed path string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   591
     */
14061
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents: 13842
diff changeset
   592
    public static String addTrailingFileSep(String path) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   593
        String fs = System.getProperty("file.separator");
06bc494ca11e Initial load
duke
parents:
diff changeset
   594
        String dblfs = fs + fs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   595
        int indexDblfs;
14061
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents: 13842
diff changeset
   596
        while ((indexDblfs = path.indexOf(dblfs, 1)) >= 0) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   597
            path = path.substring(0, indexDblfs) +
06bc494ca11e Initial load
duke
parents:
diff changeset
   598
                path.substring(indexDblfs + fs.length());
06bc494ca11e Initial load
duke
parents:
diff changeset
   599
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   600
        if (!path.endsWith(fs))
06bc494ca11e Initial load
duke
parents:
diff changeset
   601
            path += fs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   602
        return path;
06bc494ca11e Initial load
duke
parents:
diff changeset
   603
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   604
06bc494ca11e Initial load
duke
parents:
diff changeset
   605
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   606
     * This checks for the validity of the options used by the user.
06bc494ca11e Initial load
duke
parents:
diff changeset
   607
     * This works exactly like
06bc494ca11e Initial load
duke
parents:
diff changeset
   608
     * {@link com.sun.javadoc.Doclet#validOptions(String[][],
06bc494ca11e Initial load
duke
parents:
diff changeset
   609
     * DocErrorReporter)}. This will validate the options which are shared
06bc494ca11e Initial load
duke
parents:
diff changeset
   610
     * by our doclets. For example, this method will flag an error using
06bc494ca11e Initial load
duke
parents:
diff changeset
   611
     * the DocErrorReporter if user has used "-nohelp" and "-helpfile" option
06bc494ca11e Initial load
duke
parents:
diff changeset
   612
     * together.
06bc494ca11e Initial load
duke
parents:
diff changeset
   613
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   614
     * @param options  options used on the command line.
06bc494ca11e Initial load
duke
parents:
diff changeset
   615
     * @param reporter used to report errors.
06bc494ca11e Initial load
duke
parents:
diff changeset
   616
     * @return true if all the options are valid.
06bc494ca11e Initial load
duke
parents:
diff changeset
   617
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   618
    public boolean generalValidOptions(String options[][],
06bc494ca11e Initial load
duke
parents:
diff changeset
   619
            DocErrorReporter reporter) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   620
        boolean docencodingfound = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   621
        String encoding = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   622
        for (int oi = 0; oi < options.length; oi++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   623
            String[] os = options[oi];
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 19937
diff changeset
   624
            String opt = StringUtils.toLowerCase(os[0]);
16324
332d7f5fdf62 8008949: javadoc stopped copying doc-files
jjg
parents: 16319
diff changeset
   625
            if (opt.equals("-docencoding")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   626
                docencodingfound = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   627
                if (!checkOutputFileEncoding(os[1], reporter)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   628
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   629
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   630
            } else if (opt.equals("-encoding")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   631
                encoding = os[1];
06bc494ca11e Initial load
duke
parents:
diff changeset
   632
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   633
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   634
        if (!docencodingfound && encoding.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   635
            if (!checkOutputFileEncoding(encoding, reporter)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   636
                return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   637
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   638
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   639
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   640
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   641
06bc494ca11e Initial load
duke
parents:
diff changeset
   642
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   643
     * Check the validity of the given Source or Output File encoding on this
06bc494ca11e Initial load
duke
parents:
diff changeset
   644
     * platform.
06bc494ca11e Initial load
duke
parents:
diff changeset
   645
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   646
     * @param docencoding output file encoding.
06bc494ca11e Initial load
duke
parents:
diff changeset
   647
     * @param reporter    used to report errors.
06bc494ca11e Initial load
duke
parents:
diff changeset
   648
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   649
    private boolean checkOutputFileEncoding(String docencoding,
06bc494ca11e Initial load
duke
parents:
diff changeset
   650
            DocErrorReporter reporter) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   651
        OutputStream ost= new ByteArrayOutputStream();
06bc494ca11e Initial load
duke
parents:
diff changeset
   652
        OutputStreamWriter osw = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   653
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   654
            osw = new OutputStreamWriter(ost, docencoding);
06bc494ca11e Initial load
duke
parents:
diff changeset
   655
        } catch (UnsupportedEncodingException exc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   656
            reporter.printError(getText("doclet.Encoding_not_supported",
06bc494ca11e Initial load
duke
parents:
diff changeset
   657
                docencoding));
06bc494ca11e Initial load
duke
parents:
diff changeset
   658
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   659
        } finally {
06bc494ca11e Initial load
duke
parents:
diff changeset
   660
            try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   661
                if (osw != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   662
                    osw.close();
06bc494ca11e Initial load
duke
parents:
diff changeset
   663
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   664
            } catch (IOException exc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   665
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   666
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   667
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   668
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   669
06bc494ca11e Initial load
duke
parents:
diff changeset
   670
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   671
     * Return true if the given doc-file subdirectory should be excluded and
06bc494ca11e Initial load
duke
parents:
diff changeset
   672
     * false otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   673
     * @param docfilesubdir the doc-files subdirectory to check.
06bc494ca11e Initial load
duke
parents:
diff changeset
   674
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   675
    public boolean shouldExcludeDocFileDir(String docfilesubdir){
06bc494ca11e Initial load
duke
parents:
diff changeset
   676
        if (excludedDocFileDirs.contains(docfilesubdir)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   677
            return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   678
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   679
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   680
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   681
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   682
06bc494ca11e Initial load
duke
parents:
diff changeset
   683
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   684
     * Return true if the given qualifier should be excluded and false otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   685
     * @param qualifier the qualifier to check.
06bc494ca11e Initial load
duke
parents:
diff changeset
   686
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   687
    public boolean shouldExcludeQualifier(String qualifier){
06bc494ca11e Initial load
duke
parents:
diff changeset
   688
        if (excludedQualifiers.contains("all") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   689
            excludedQualifiers.contains(qualifier) ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   690
            excludedQualifiers.contains(qualifier + ".*")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   691
            return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   692
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   693
            int index = -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   694
            while ((index = qualifier.indexOf(".", index + 1)) != -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   695
                if (excludedQualifiers.contains(qualifier.substring(0, index + 1) + "*")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   696
                    return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   697
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   698
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   699
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   700
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   701
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   702
06bc494ca11e Initial load
duke
parents:
diff changeset
   703
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   704
     * Return the qualified name of the <code>ClassDoc</code> if it's qualifier is not excluded.  Otherwise,
06bc494ca11e Initial load
duke
parents:
diff changeset
   705
     * return the unqualified <code>ClassDoc</code> name.
06bc494ca11e Initial load
duke
parents:
diff changeset
   706
     * @param cd the <code>ClassDoc</code> to check.
06bc494ca11e Initial load
duke
parents:
diff changeset
   707
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   708
    public String getClassName(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   709
        PackageDoc pd = cd.containingPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
   710
        if (pd != null && shouldExcludeQualifier(cd.containingPackage().name())) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   711
            return cd.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
   712
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   713
            return cd.qualifiedName();
06bc494ca11e Initial load
duke
parents:
diff changeset
   714
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   715
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   716
06bc494ca11e Initial load
duke
parents:
diff changeset
   717
    public String getText(String key) {
38515
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   718
        // Check the doclet specific properties file.
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   719
        MessageRetriever docletMessage = getDocletSpecificMsg();
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   720
        if (docletMessage.containsKey(key)) {
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   721
            return docletMessage.getText(key);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   722
        }
38515
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   723
        // Check the shared properties file.
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   724
        return message.getText(key);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   725
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   726
06bc494ca11e Initial load
duke
parents:
diff changeset
   727
    public String getText(String key, String a1) {
38515
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   728
        // Check the doclet specific properties file.
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   729
        MessageRetriever docletMessage = getDocletSpecificMsg();
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   730
        if (docletMessage.containsKey(key)) {
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   731
            return docletMessage.getText(key, a1);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   732
        }
38515
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   733
        // Check the shared properties file.
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   734
        return message.getText(key, a1);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   735
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   736
06bc494ca11e Initial load
duke
parents:
diff changeset
   737
    public String getText(String key, String a1, String a2) {
38515
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   738
        // Check the doclet specific properties file.
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   739
        MessageRetriever docletMessage = getDocletSpecificMsg();
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   740
        if (docletMessage.containsKey(key)) {
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   741
            return docletMessage.getText(key, a1, a2);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   742
        }
38515
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   743
        // Check the shared properties file.
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   744
        return message.getText(key, a1, a2);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   745
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   746
06bc494ca11e Initial load
duke
parents:
diff changeset
   747
    public String getText(String key, String a1, String a2, String a3) {
38515
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   748
        // Check the doclet specific properties file.
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   749
        MessageRetriever docletMessage = getDocletSpecificMsg();
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   750
        if (docletMessage.containsKey(key)) {
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   751
            return docletMessage.getText(key, a1, a2, a3);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   752
        }
38515
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   753
        // Check the shared properties file.
6ae7f7d9b44c 8157102: Avoid exceptional control flow in Configuration.getText
redestad
parents: 36526
diff changeset
   754
        return message.getText(key, a1, a2, a3);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   755
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   756
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17563
diff changeset
   757
    public abstract Content newContent();
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   758
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   759
    /**
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   760
     * Get the configuration string as a content.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   761
     *
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   762
     * @param key the key to look for in the configuration file
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   763
     * @return a content tree for the text
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   764
     */
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   765
    public Content getResource(String key) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17563
diff changeset
   766
        Content c = newContent();
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   767
        c.addContent(getText(key));
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   768
        return c;
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   769
    }
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   770
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   771
    /**
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   772
     * Get the configuration string as a content.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   773
     *
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   774
     * @param key the key to look for in the configuration file
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   775
     * @param o   string or content argument added to configuration text
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   776
     * @return a content tree for the text
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   777
     */
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   778
    public Content getResource(String key, Object o) {
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   779
        return getResource(key, o, null, null);
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   780
    }
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   781
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   782
    /**
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   783
     * Get the configuration string as a content.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   784
     *
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   785
     * @param key the key to look for in the configuration file
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   786
     * @param o   string or content argument added to configuration text
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   787
     * @return a content tree for the text
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   788
     */
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   789
    public Content getResource(String key, Object o1, Object o2) {
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   790
        return getResource(key, o1, o2, null);
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   791
    }
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   792
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   793
    /**
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   794
     * Get the configuration string as a content.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   795
     *
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   796
     * @param key the key to look for in the configuration file
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   797
     * @param o1  string or content argument added to configuration text
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   798
     * @param o2  string or content argument added to configuration text
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   799
     * @return a content tree for the text
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   800
     */
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   801
    public Content getResource(String key, Object o0, Object o1, Object o2) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17563
diff changeset
   802
        Content c = newContent();
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   803
        Pattern p = Pattern.compile("\\{([012])\\}");
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   804
        String text = getText(key);
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   805
        Matcher m = p.matcher(text);
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   806
        int start = 0;
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   807
        while (m.find(start)) {
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   808
            c.addContent(text.substring(start, m.start()));
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   809
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   810
            Object o = null;
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   811
            switch (m.group(1).charAt(0)) {
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   812
                case '0': o = o0; break;
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   813
                case '1': o = o1; break;
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   814
                case '2': o = o2; break;
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   815
            }
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   816
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   817
            if (o == null) {
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   818
                c.addContent("{" + m.group(1) + "}");
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   819
            } else if (o instanceof String) {
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   820
                c.addContent((String) o);
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   821
            } else if (o instanceof Content) {
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   822
                c.addContent((Content) o);
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   823
            }
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   824
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   825
            start = m.end();
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   826
        }
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   827
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   828
        c.addContent(text.substring(start));
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   829
        return c;
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   830
    }
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   831
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 16560
diff changeset
   832
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   833
    /**
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   834
     * Return true if the ClassDoc element is getting documented, depending upon
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   835
     * -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
   836
     * -nodeprecated is not used. Return false if -nodeprecated is used and if
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   837
     * either ClassDoc element is deprecated or the containing package is deprecated.
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   838
     *
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   839
     * @param cd the ClassDoc for which the page generation is checked
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   840
     */
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   841
    public boolean isGeneratedDoc(ClassDoc cd) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   842
        if (!nodeprecated) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   843
            return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   844
        }
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   845
        return !(utils.isDeprecated(cd) || utils.isDeprecated(cd.containingPackage()));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   846
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   847
06bc494ca11e Initial load
duke
parents:
diff changeset
   848
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   849
     * Return the doclet specific instance of a writer factory.
06bc494ca11e Initial load
duke
parents:
diff changeset
   850
     * @return the {@link WriterFactory} for the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   851
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   852
    public abstract WriterFactory getWriterFactory();
06bc494ca11e Initial load
duke
parents:
diff changeset
   853
06bc494ca11e Initial load
duke
parents:
diff changeset
   854
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   855
     * Return the input stream to the builder XML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   856
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   857
     * @return the input steam to the builder XML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   858
     * @throws FileNotFoundException when the given XML file cannot be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   859
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   860
    public InputStream getBuilderXML() throws IOException {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   861
        return builderXMLPath == null ?
06bc494ca11e Initial load
duke
parents:
diff changeset
   862
            Configuration.class.getResourceAsStream(DEFAULT_BUILDER_XML) :
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14361
diff changeset
   863
            DocFile.createFileForInput(this, builderXMLPath).openInputStream();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   864
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   865
06bc494ca11e Initial load
duke
parents:
diff changeset
   866
    /**
1863
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1789
diff changeset
   867
     * Return the Locale for this document.
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1789
diff changeset
   868
     */
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1789
diff changeset
   869
    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
   870
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1789
diff changeset
   871
    /**
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   872
     * Return the current file manager.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   873
     */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   874
    public abstract JavaFileManager getFileManager();
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   875
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   876
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   877
     * Return the comparator that will be used to sort member documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   878
     * To no do any sorting, return null.
06bc494ca11e Initial load
duke
parents:
diff changeset
   879
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   880
     * @return the {@link java.util.Comparator} used to sort members.
06bc494ca11e Initial load
duke
parents:
diff changeset
   881
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   882
    public abstract Comparator<ProgramElementDoc> getMemberComparator();
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   883
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   884
    private void setTabWidth(int n) {
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   885
        sourcetab = n;
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   886
        tabSpaces = String.format("%" + n + "s", "");
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   887
    }
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   888
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   889
    public abstract boolean showMessage(SourcePosition pos, String key);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   890
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36037
diff changeset
   891
    public abstract Location getLocationForPackage(PackageDoc pd);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   892
}