langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
author ksrini
Fri, 18 Apr 2014 08:44:53 -0700
changeset 24221 2376793dd33b
parent 23968 d67158b385dd
permissions -rw-r--r--
8038583: [javadoc] Refactor uses of arrays to Collections Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
23968
d67158b385dd 8026736: Enhance Javadoc pages
bpatel
parents: 22163
diff changeset
     2
 * Copyright (c) 1998, 2014, 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.formats.html;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 13842
diff changeset
    28
import java.net.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 13842
diff changeset
    29
import java.util.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
    31
import javax.tools.JavaFileManager;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
    32
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
import com.sun.javadoc.*;
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 15354
diff changeset
    34
import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 13842
diff changeset
    35
import com.sun.tools.doclets.internal.toolkit.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 13842
diff changeset
    36
import com.sun.tools.doclets.internal.toolkit.util.*;
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
    37
import com.sun.tools.doclint.DocLint;
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
    38
import com.sun.tools.javac.file.JavacFileManager;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
    39
import com.sun.tools.javac.util.Context;
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 21888
diff changeset
    40
import com.sun.tools.javac.util.StringUtils;
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
    41
import com.sun.tools.javadoc.RootDocImpl;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * Configure the output based on the command line options.
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * Also determine the length of the command line option. For example,
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 * for a option "-header" there will be a string argument associated, then the
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * the length of option "-header" is two. But for option "-nohelp" no argument
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 * is needed so it's length is 1.
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * </p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 * Also do the error checking on the options used. For example it is illegal to
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 * use "-helpfile" option when already "-nohelp" option is used.
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
 * </p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 *
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
    56
 *  <p><b>This is NOT part of any supported API.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
    57
 *  If you write code that depends on this, you do so at your own risk.
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
    58
 *  This code and its internal interfaces are subject to change or
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
    59
 *  deletion without notice.</b>
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
    60
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
 * @author Robert Field.
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
 * @author Atul Dambalkar.
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
 * @author Jamie Ho
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
    64
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
public class ConfigurationImpl extends Configuration {
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
     * The build date.  Note: For now, we will use
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
     * a version number instead of a date.
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    public static final String BUILD_DATE = System.getProperty("java.version");
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * Argument for command line option "-header".
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    public String header = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     * Argument for command line option "-packagesheader".
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    public String packagesheader = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * Argument for command line option "-footer".
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    public String footer = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
     * Argument for command line option "-doctitle".
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
    public String doctitle = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
     * Argument for command line option "-windowtitle".
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    public String windowtitle = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
     * Argument for command line option "-top".
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    public String top = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
     * Argument for command line option "-bottom".
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    public String bottom = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * Argument for command line option "-helpfile".
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
    public String helpfile = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     * Argument for command line option "-stylesheetfile".
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    public String stylesheetfile = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    /**
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   120
     * Argument for command line option "-Xdocrootparent".
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   121
     */
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   122
    public String docrootparent = "";
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   123
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   124
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     * True if command line option "-nohelp" is used. Default value is false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    public boolean nohelp = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     * True if command line option "-splitindex" is used. Default value is
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     * false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
    public boolean splitindex = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * False if command line option "-noindex" is used. Default value is true.
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    public boolean createindex = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     * True if command line option "-use" is used. Default value is false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
    public boolean classuse = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     * False if command line option "-notree" is used. Default value is true.
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    public boolean createtree = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * True if command line option "-nodeprecated" is used. Default value is
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     * false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
    public boolean nodeprecatedlist = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
     * True if command line option "-nonavbar" is used. Default value is false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
    public boolean nonavbar = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
     * True if command line option "-nooverview" is used. Default value is
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
     * false
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
    private boolean nooverview = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     * True if command line option "-overview" is used. Default value is false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
    public boolean overview = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
     * This is true if option "-overview" is used or option "-overview" is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
     * used and number of packages is more than one.
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
    public boolean createoverview = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
    /**
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   179
     * Collected set of doclint options
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   180
     */
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   181
    public Set<String> doclintOpts = new LinkedHashSet<>();
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   182
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   183
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     * Unique Resource Handler for this package.
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
    public final MessageRetriever standardmessage;
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     * First file to appear in the right-hand frame in the generated
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     * documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14259
diff changeset
   192
    public DocPath topFile = DocPath.empty;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
     * The classdoc for the class file getting generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
     */
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   197
    public ClassDoc currentcd = null;  // Set this classdoc in the ClassWriter.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    /**
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
   200
     * Constructor. Initializes resource for the
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
   201
     * {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
     */
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   203
    public ConfigurationImpl() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
        standardmessage = new MessageRetriever(this,
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
            "com.sun.tools.doclets.formats.html.resources.standard");
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
21888
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   208
    private final String versionRBName = "com.sun.tools.javadoc.resources.version";
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   209
    private ResourceBundle versionRB;
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   210
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   211
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     * Return the build date for the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   214
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
    public String getDocletSpecificBuildDate() {
21888
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   216
        if (versionRB == null) {
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   217
            try {
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   218
                versionRB = ResourceBundle.getBundle(versionRBName);
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   219
            } catch (MissingResourceException e) {
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   220
                return BUILD_DATE;
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   221
            }
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   222
        }
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   223
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   224
        try {
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   225
            return versionRB.getString("release");
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   226
        } catch (MissingResourceException e) {
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   227
            return BUILD_DATE;
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   228
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
     * Depending upon the command line options provided by the user, set
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
     * configure the output generation environment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
     * @param options The array of option names and values.
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   237
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
    public void setSpecificDocletOptions(String[][] options) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
        for (int oi = 0; oi < options.length; ++oi) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
            String[] os = options[oi];
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 21888
diff changeset
   241
            String opt = StringUtils.toLowerCase(os[0]);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
            if (opt.equals("-footer")) {
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   243
                footer = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   244
            } else if (opt.equals("-header")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   245
                header = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   246
            } else if (opt.equals("-packagesheader")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   247
                packagesheader = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   248
            } else if (opt.equals("-doctitle")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   249
                doctitle = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   250
            } else if (opt.equals("-windowtitle")) {
23968
d67158b385dd 8026736: Enhance Javadoc pages
bpatel
parents: 22163
diff changeset
   251
                windowtitle = os[1].replaceAll("\\<.*?>", "");
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   252
            } else if (opt.equals("-top")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   253
                top = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   254
            } else if (opt.equals("-bottom")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   255
                bottom = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   256
            } else if (opt.equals("-helpfile")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   257
                helpfile = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   258
            } else if (opt.equals("-stylesheetfile")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   259
                stylesheetfile = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   260
            } else if (opt.equals("-charset")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   261
                charset = os[1];
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   262
            } else if (opt.equals("-xdocrootparent")) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   263
                docrootparent = os[1];
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   264
            } else if (opt.equals("-nohelp")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
                nohelp = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   266
            } else if (opt.equals("-splitindex")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
                splitindex = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   268
            } else if (opt.equals("-noindex")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
                createindex = false;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   270
            } else if (opt.equals("-use")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
                classuse = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   272
            } else if (opt.equals("-notree")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
                createtree = false;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   274
            } else if (opt.equals("-nodeprecatedlist")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
                nodeprecatedlist = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   276
            } else if (opt.equals("-nonavbar")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
                nonavbar = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   278
            } else if (opt.equals("-nooverview")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
                nooverview = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   280
            } else if (opt.equals("-overview")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
                overview = true;
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   282
            } else if (opt.equals("-xdoclint")) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   283
                doclintOpts.add(null);
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   284
            } else if (opt.startsWith("-xdoclint:")) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   285
                doclintOpts.add(opt.substring(opt.indexOf(":") + 1));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
        if (root.specifiedClasses().length > 0) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   289
            Map<String,PackageDoc> map = new HashMap<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
            PackageDoc pd;
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
            ClassDoc[] classes = root.classes();
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   292
            for (ClassDoc aClass : classes) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   293
                pd = aClass.containingPackage();
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   294
                if (!map.containsKey(pd.name())) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
                    map.put(pd.name(), pd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
        setCreateOverview();
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
        setTopFile(root);
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   301
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   302
        if (root instanceof RootDocImpl) {
21500
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents: 18005
diff changeset
   303
            ((RootDocImpl) root).initDocLint(doclintOpts, tagletManager.getCustomTagNames());
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   304
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
     * Returns the "length" of a given option. If an option takes no
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
     * arguments, its length is one. If it takes one argument, it's
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
     * length is two, and so on. This method is called by JavaDoc to
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
     * parse the options it does not recognize. It then calls
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
     * {@link #validOptions(String[][], DocErrorReporter)} to
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
     * validate them.
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
     * <b>Note:</b><br>
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
     * The options arrive as case-sensitive strings. For options that
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
     * are not case-sensitive, use toLowerCase() on the option string
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
     * before comparing it.
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
     * </blockquote>
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
     * @return number of arguments + 1 for a option. Zero return means
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
     * option not known.  Negative value means error occurred.
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
    public int optionLength(String option) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
        int result = -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
        if ((result = super.optionLength(option)) > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
            return result;
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
        // otherwise look for the options we have added
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 21888
diff changeset
   329
        option = StringUtils.toLowerCase(option);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
        if (option.equals("-nodeprecatedlist") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
            option.equals("-noindex") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
            option.equals("-notree") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
            option.equals("-nohelp") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
            option.equals("-splitindex") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
            option.equals("-serialwarn") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
            option.equals("-use") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
            option.equals("-nonavbar") ||
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   338
            option.equals("-nooverview") ||
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   339
            option.equals("-xdoclint") ||
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   340
            option.startsWith("-xdoclint:")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
            return 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
        } else if (option.equals("-help")) {
18005
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   343
            // Uugh: first, this should not be hidden inside optionLength,
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   344
            // and second, we should not be writing directly to stdout.
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   345
            // But we have no access to a DocErrorReporter, which would
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   346
            // allow use of reporter.printNotice
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
            System.out.println(getText("doclet.usage"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
            return 1;
18005
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   349
        } else if (option.equals("-x")) {
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   350
            // Uugh: first, this should not be hidden inside optionLength,
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   351
            // and second, we should not be writing directly to stdout.
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   352
            // But we have no access to a DocErrorReporter, which would
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   353
            // allow use of reporter.printNotice
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   354
            System.out.println(getText("doclet.X.usage"));
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   355
            return 1;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
        } else if (option.equals("-footer") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
                   option.equals("-header") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
                   option.equals("-packagesheader") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
                   option.equals("-doctitle") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
                   option.equals("-windowtitle") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
                   option.equals("-top") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
                   option.equals("-bottom") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
                   option.equals("-helpfile") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
                   option.equals("-stylesheetfile") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
                   option.equals("-charset") ||
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   366
                   option.equals("-overview") ||
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   367
                   option.equals("-xdocrootparent")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
            return 2;
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
            return 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   377
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
    public boolean validOptions(String options[][],
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
            DocErrorReporter reporter) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
        boolean helpfile = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
        boolean nohelp = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
        boolean overview = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
        boolean nooverview = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
        boolean splitindex = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
        boolean noindex = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
        // check shared options
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
        if (!generalValidOptions(options, reporter)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
        // otherwise look at our options
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
        for (int oi = 0; oi < options.length; ++oi) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
            String[] os = options[oi];
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 21888
diff changeset
   393
            String opt = StringUtils.toLowerCase(os[0]);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
            if (opt.equals("-helpfile")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
                if (nohelp == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
                        "-helpfile", "-nohelp"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
                if (helpfile == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
                    reporter.printError(getText("doclet.Option_reuse",
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
                        "-helpfile"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
                }
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   405
                DocFile help = DocFile.createFileForInput(this, os[1]);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
                if (!help.exists()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
                    reporter.printError(getText("doclet.File_not_found", os[1]));
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
                helpfile = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
            } else  if (opt.equals("-nohelp")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
                if (helpfile == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
                        "-nohelp", "-helpfile"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
                nohelp = true;
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   418
            } else if (opt.equals("-xdocrootparent")) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   419
                try {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   420
                    new URL(os[1]);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   421
                } catch (MalformedURLException e) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   422
                    reporter.printError(getText("doclet.MalformedURL", os[1]));
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   423
                    return false;
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   424
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
            } else if (opt.equals("-overview")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   426
                if (nooverview == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
                        "-overview", "-nooverview"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   431
                if (overview == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
                    reporter.printError(getText("doclet.Option_reuse",
06bc494ca11e Initial load
duke
parents:
diff changeset
   433
                        "-overview"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   434
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
                overview = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
            } else  if (opt.equals("-nooverview")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
                if (overview == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   440
                        "-nooverview", "-overview"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   441
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   442
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   443
                nooverview = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
            } else if (opt.equals("-splitindex")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
                if (noindex == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   447
                        "-splitindex", "-noindex"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   449
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   450
                splitindex = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
            } else if (opt.equals("-noindex")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
                if (splitindex == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
                        "-noindex", "-splitindex"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   455
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
                noindex = true;
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   458
            } else if (opt.startsWith("-xdoclint:")) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   459
                if (opt.contains("/")) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   460
                    reporter.printError(getText("doclet.Option_doclint_no_qualifiers"));
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   461
                    return false;
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   462
                }
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   463
                if (!DocLint.isValidOption(
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   464
                        opt.replace("-xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX))) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   465
                    reporter.printError(getText("doclet.Option_doclint_invalid_arg"));
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   466
                    return false;
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   467
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   468
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   469
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   470
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   471
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   472
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   476
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   477
    public MessageRetriever getDocletSpecificMsg() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   478
        return standardmessage;
06bc494ca11e Initial load
duke
parents:
diff changeset
   479
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   480
06bc494ca11e Initial load
duke
parents:
diff changeset
   481
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   482
     * Decide the page which will appear first in the right-hand frame. It will
06bc494ca11e Initial load
duke
parents:
diff changeset
   483
     * be "overview-summary.html" if "-overview" option is used or no
06bc494ca11e Initial load
duke
parents:
diff changeset
   484
     * "-overview" but the number of packages is more than one. It will be
06bc494ca11e Initial load
duke
parents:
diff changeset
   485
     * "package-summary.html" of the respective package if there is only one
06bc494ca11e Initial load
duke
parents:
diff changeset
   486
     * package to document. It will be a class page(first in the sorted order),
06bc494ca11e Initial load
duke
parents:
diff changeset
   487
     * if only classes are provided on the command line.
06bc494ca11e Initial load
duke
parents:
diff changeset
   488
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   489
     * @param root Root of the program structure.
06bc494ca11e Initial load
duke
parents:
diff changeset
   490
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   491
    protected void setTopFile(RootDoc root) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   492
        if (!checkForDeprecation(root)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   493
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   494
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   495
        if (createoverview) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14259
diff changeset
   496
            topFile = DocPaths.OVERVIEW_SUMMARY;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   497
        } else {
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23968
diff changeset
   498
            if (packages.size() == 1 && packages.first().name().equals("")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   499
                if (root.classes().length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   500
                    ClassDoc[] classarr = root.classes();
06bc494ca11e Initial load
duke
parents:
diff changeset
   501
                    Arrays.sort(classarr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   502
                    ClassDoc cd = getValidClass(classarr);
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14259
diff changeset
   503
                    topFile = DocPath.forClass(cd);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   504
                }
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23968
diff changeset
   505
            } else if (!packages.isEmpty()) {
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23968
diff changeset
   506
                topFile = DocPath.forPackage(packages.first()).resolve(DocPaths.PACKAGE_SUMMARY);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   507
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   508
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   509
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   510
06bc494ca11e Initial load
duke
parents:
diff changeset
   511
    protected ClassDoc getValidClass(ClassDoc[] classarr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   512
        if (!nodeprecated) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   513
            return classarr[0];
06bc494ca11e Initial load
duke
parents:
diff changeset
   514
        }
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   515
        for (ClassDoc cd : classarr) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   516
            if (cd.tags("deprecated").length == 0) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   517
                return cd;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   518
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   519
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   520
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   521
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   522
06bc494ca11e Initial load
duke
parents:
diff changeset
   523
    protected boolean checkForDeprecation(RootDoc root) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   524
        for (ClassDoc cd : root.classes()) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   525
            if (isGeneratedDoc(cd)) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   526
                return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   527
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   528
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   529
        return false;
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
     * Generate "overview.html" page if option "-overview" is used or number of
06bc494ca11e Initial load
duke
parents:
diff changeset
   534
     * packages is more than one. Sets {@link #createoverview} field to true.
06bc494ca11e Initial load
duke
parents:
diff changeset
   535
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   536
    protected void setCreateOverview() {
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23968
diff changeset
   537
        if ((overview || packages.size() > 1) && !nooverview) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   538
            createoverview = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   539
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   540
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   541
06bc494ca11e Initial load
duke
parents:
diff changeset
   542
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   543
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   544
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   545
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   546
    public WriterFactory getWriterFactory() {
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   547
        return new WriterFactoryImpl(this);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   548
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   549
06bc494ca11e Initial load
duke
parents:
diff changeset
   550
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   551
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   552
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   553
    @Override
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   554
    public Comparator<ProgramElementDoc> getMemberComparator() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   555
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   556
    }
1863
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   557
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   558
    /**
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   559
     * {@inheritDoc}
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   560
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   561
    @Override
1863
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   562
    public Locale getLocale() {
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   563
        if (root instanceof RootDocImpl)
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   564
            return ((RootDocImpl)root).getLocale();
1863
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   565
        else
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   566
            return Locale.getDefault();
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   567
    }
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   568
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   569
    /**
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   570
     * {@inheritDoc}
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   571
     */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   572
    @Override
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   573
    public JavaFileManager getFileManager() {
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   574
        if (fileManager == null) {
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   575
            if (root instanceof RootDocImpl)
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   576
                fileManager = ((RootDocImpl) root).getFileManager();
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   577
            else
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   578
                fileManager = new JavacFileManager(new Context(), false, null);
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   579
        }
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   580
        return fileManager;
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   581
    }
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   582
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   583
    private JavaFileManager fileManager;
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   584
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   585
    @Override
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   586
    public boolean showMessage(SourcePosition pos, String key) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   587
        if (root instanceof RootDocImpl) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   588
            return pos == null || ((RootDocImpl) root).showTagMessages();
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   589
        }
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   590
        return true;
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   591
    }
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 15354
diff changeset
   592
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 15354
diff changeset
   593
    @Override
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17563
diff changeset
   594
    public Content newContent() {
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 15354
diff changeset
   595
        return new ContentBuilder();
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 15354
diff changeset
   596
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   597
}