langtools/src/share/classes/com/sun/tools/javadoc/Main.java
author jjg
Sun, 18 May 2014 19:59:10 -0700
changeset 24604 7f68545b5128
parent 14260 727a84636f12
permissions -rw-r--r--
8041422: Split javac ClassReader into ClassReader+ClassFinder Reviewed-by: jfranck
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 5520
diff changeset
     2
 * Copyright (c) 2000, 2012, 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: 1652
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: 1652
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: 1652
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1652
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1652
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.javadoc;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import java.io.PrintWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
 * Provides external entry points (tool and programmatic)
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 * for the javadoc program.
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 5520
diff changeset
    34
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 5520
diff changeset
    35
 *  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: 5520
diff changeset
    36
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 5520
diff changeset
    37
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 5520
diff changeset
    38
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * @since 1.4
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
public class Main {
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
     * Constructor should never be called.
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
    private Main() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
     * Command line interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
     * @param args   The command line parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
     */
1363
d7fc53d64560 6748601: javadoc API should allow varargs use
jjg
parents: 10
diff changeset
    53
    public static void main(String... args) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
        System.exit(execute(args));
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     * Programmatic interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     * @param args   The command line parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
     * @return The return code.
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
     */
1363
d7fc53d64560 6748601: javadoc API should allow varargs use
jjg
parents: 10
diff changeset
    62
    public static int execute(String... args) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
        Start jdoc = new Start();
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
        return jdoc.begin(args);
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     * Programmatic interface.
1365
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    69
     * @param args   The command line parameters.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    70
     * @param docletParentClassLoader The parent class loader used when
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    71
     *  creating the doclet classloader. If null, the class loader used
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    72
     *  to instantiate doclets will be created without specifying a parent
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    73
     *  class loader.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    74
     * @return The return code.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    75
     * @since 1.7
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    76
     */
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    77
    public static int execute(ClassLoader docletParentClassLoader, String... args) {
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    78
        Start jdoc = new Start(docletParentClassLoader);
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    79
        return jdoc.begin(args);
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    80
    }
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    81
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    82
    /**
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    83
     * Programmatic interface.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     * @param programName  Name of the program (for error messages).
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * @param args   The command line parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * @return The return code.
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     */
1363
d7fc53d64560 6748601: javadoc API should allow varargs use
jjg
parents: 10
diff changeset
    88
    public static int execute(String programName, String... args) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
        Start jdoc = new Start(programName);
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
        return jdoc.begin(args);
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     * Programmatic interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
     * @param programName  Name of the program (for error messages).
1365
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    96
     * @param args   The command line parameters.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    97
     * @param docletParentClassLoader The parent class loader used when
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    98
     *  creating the doclet classloader. If null, the class loader used
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
    99
     *  to instantiate doclets will be created without specifying a parent
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   100
     *  class loader.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   101
     * @return The return code.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   102
     * @since 1.7
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   103
     */
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   104
    public static int execute(String programName, ClassLoader docletParentClassLoader, String... args) {
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   105
        Start jdoc = new Start(programName, docletParentClassLoader);
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   106
        return jdoc.begin(args);
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   107
    }
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   108
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   109
    /**
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   110
     * Programmatic interface.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   111
     * @param programName  Name of the program (for error messages).
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     * @param defaultDocletClassName  Fully qualified class name.
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     * @param args   The command line parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     * @return The return code.
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
    public static int execute(String programName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
                              String defaultDocletClassName,
1363
d7fc53d64560 6748601: javadoc API should allow varargs use
jjg
parents: 10
diff changeset
   118
                              String... args) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
        Start jdoc = new Start(programName, defaultDocletClassName);
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
        return jdoc.begin(args);
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
     * Programmatic interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     * @param programName  Name of the program (for error messages).
1365
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   126
     * @param defaultDocletClassName  Fully qualified class name.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   127
     * @param docletParentClassLoader The parent class loader used when
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   128
     *  creating the doclet classloader. If null, the class loader used
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   129
     *  to instantiate doclets will be created without specifying a parent
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   130
     *  class loader.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   131
     * @param args   The command line parameters.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   132
     * @return The return code.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   133
     * @since 1.7
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   134
     */
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   135
    public static int execute(String programName,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   136
                              String defaultDocletClassName,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   137
                              ClassLoader docletParentClassLoader,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   138
                              String... args) {
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   139
        Start jdoc = new Start(programName, defaultDocletClassName, docletParentClassLoader);
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   140
        return jdoc.begin(args);
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   141
    }
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   142
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   143
    /**
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   144
     * Programmatic interface.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   145
     * @param programName  Name of the program (for error messages).
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     * @param errWriter    PrintWriter to receive error messages.
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     * @param warnWriter    PrintWriter to receive error messages.
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
     * @param noticeWriter    PrintWriter to receive error messages.
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
     * @param defaultDocletClassName  Fully qualified class name.
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     * @param args   The command line parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * @return The return code.
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
    public static int execute(String programName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
                              PrintWriter errWriter,
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
                              PrintWriter warnWriter,
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
                              PrintWriter noticeWriter,
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
                              String defaultDocletClassName,
1363
d7fc53d64560 6748601: javadoc API should allow varargs use
jjg
parents: 10
diff changeset
   158
                              String... args) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
        Start jdoc = new Start(programName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
                               errWriter, warnWriter, noticeWriter,
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
                               defaultDocletClassName);
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
        return jdoc.begin(args);
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
    }
1365
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   164
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   165
    /**
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   166
     * Programmatic interface.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   167
     * @param programName  Name of the program (for error messages).
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   168
     * @param errWriter    PrintWriter to receive error messages.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   169
     * @param warnWriter    PrintWriter to receive error messages.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   170
     * @param noticeWriter    PrintWriter to receive error messages.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   171
     * @param defaultDocletClassName  Fully qualified class name.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   172
     * @param docletParentClassLoader The parent class loader used when
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   173
     *  creating the doclet classloader. If null, the class loader used
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   174
     *  to instantiate doclets will be created without specifying a parent
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   175
     *  class loader.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   176
     * @param args   The command line parameters.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   177
     * @return The return code.
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   178
     * @since 1.7
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   179
     */
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   180
    public static int execute(String programName,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   181
                              PrintWriter errWriter,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   182
                              PrintWriter warnWriter,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   183
                              PrintWriter noticeWriter,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   184
                              String defaultDocletClassName,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   185
                              ClassLoader docletParentClassLoader,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   186
                              String... args) {
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   187
        Start jdoc = new Start(programName,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   188
                               errWriter, warnWriter, noticeWriter,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   189
                               defaultDocletClassName,
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   190
                               docletParentClassLoader);
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   191
        return jdoc.begin(args);
ced0e3c4678f 6748546: javadoc API should be classloader-friendly
jjg
parents: 1363
diff changeset
   192
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
}