langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java
author ksrini
Thu, 11 May 2017 15:12:38 -0700
changeset 45155 141f584faf59
parent 44878 9dd9cf7919ff
permissions -rw-r--r--
8179632: Fix the old doclet documentation Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
     1
/*
44878
9dd9cf7919ff 8179299: Fix HTML 5 errors in java.compiler module
jjg
parents: 40313
diff changeset
     2
 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
     4
 *
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    10
 *
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    15
 * accompanied this code).
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    16
 *
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    20
 *
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    23
 * questions.
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    24
 */
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    26
/**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 34916
diff changeset
    27
<p style="font-style: italic; font-size:larger">
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 34916
diff changeset
    28
<b>Note:</b> The declarations in this package have been superseded by those
45155
141f584faf59 8179632: Fix the old doclet documentation
ksrini
parents: 44878
diff changeset
    29
in the package {@link jdk.javadoc.doclet}.
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 35426
diff changeset
    30
For more information, see the <i>Migration Guide</i> in the documentation for that package.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 34916
diff changeset
    31
</p>
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 34916
diff changeset
    32
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
The Doclet API (also called the Javadoc API) provides a mechanism
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    34
for clients to inspect the source-level structure of programs and
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
libraries, including javadoc comments embedded in the source.
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
This is useful for documentation, program checking, automatic
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
code generation and many other tools.
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    40
Doclets are invoked by javadoc and use this API to write out
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
program information to files.  For example, the standard doclet is called
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
by default and writes out documentation to HTML files.
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    45
The invocation is defined by the abstract {@link com.sun.javadoc.Doclet} class
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
-- the entry point is the {@link com.sun.javadoc.Doclet#start(RootDoc) start} method:
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
<pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    public static boolean <b>start</b>(RootDoc root)
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
</pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
The {@link com.sun.javadoc.RootDoc} instance holds the root of the program structure
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    51
information. From this root all other program structure
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    52
information can be extracted.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
44878
9dd9cf7919ff 8179299: Fix HTML 5 errors in java.compiler module
jjg
parents: 40313
diff changeset
    55
<a id="terminology"></a>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
<h3>Terminology</h3>
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
44878
9dd9cf7919ff 8179299: Fix HTML 5 errors in java.compiler module
jjg
parents: 40313
diff changeset
    58
<a id="included"></a>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
When calling javadoc, you pass in package names and source file names --
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    60
these are called the <em>specified</em> packages and classes.
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    61
You also pass in Javadoc options; the <em>access control</em> Javadoc options
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 23135
diff changeset
    62
({@code -public}, {@code -protected}, {@code -package},
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 23135
diff changeset
    63
and {@code -private}) filter program elements, producing a
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
result set, called the <em>included</em> set, or "documented" set.
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    65
(The unfiltered set is also available through
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
{@link com.sun.javadoc.PackageDoc#allClasses(boolean) allClasses(false)}.)
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
44878
9dd9cf7919ff 8179299: Fix HTML 5 errors in java.compiler module
jjg
parents: 40313
diff changeset
    69
<a id="class"></a>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
Throughout this API, the term <em>class</em> is normally a
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    71
shorthand for "class or interface", as in: {@link com.sun.javadoc.ClassDoc},
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
{@link com.sun.javadoc.PackageDoc#allClasses() allClasses()}, and
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
{@link com.sun.javadoc.PackageDoc#findClass(String) findClass(String)}.
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    74
In only a couple of other places, it means "class, as opposed to interface",
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
as in:  {@link com.sun.javadoc.Doc#isClass()}.
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
In the second sense, this API calls out four kinds of classes:
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    77
{@linkplain com.sun.javadoc.Doc#isOrdinaryClass() ordinary classes},
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
{@linkplain com.sun.javadoc.Doc#isEnum() enums},
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    79
{@linkplain com.sun.javadoc.Doc#isError() errors} and
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
{@linkplain com.sun.javadoc.Doc#isException() exceptions}.
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    81
Throughout the API, the detailed description of each program element
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
describes explicitly which meaning is being used.
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
44878
9dd9cf7919ff 8179299: Fix HTML 5 errors in java.compiler module
jjg
parents: 40313
diff changeset
    85
<a id="qualified"></a>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
A <em>qualified</em> class or interface name is one that has its package
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 23135
diff changeset
    87
name prepended to it, such as {@code java.lang.String}.  A non-qualified
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 23135
diff changeset
    88
name has no package name, such as {@code String}.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
44878
9dd9cf7919ff 8179299: Fix HTML 5 errors in java.compiler module
jjg
parents: 40313
diff changeset
    91
<a id="example"></a>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
<h3>Example</h3>
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    93
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    94
The following is an example doclet that
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 23135
diff changeset
    95
displays information in the {@code @param} tags of the processed
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
classes:
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
<pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
import com.sun.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
23135
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   100
public class ListParams extends <span style="color:red" >Doclet</span> {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
23135
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   102
    public static boolean start(<span style="color:red" >RootDoc</span> root) {
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   103
        <span style="color:red" >ClassDoc</span>[] classes = root.<span style="color:red" >classes</span>();
23109
1efb9231d5a2 8032526: fix the accessibility, html, syntax errors and warnings reported by doclint report in langtools
cl
parents: 21019
diff changeset
   104
        for (int i = 0; i &lt; classes.length; ++i) {
23135
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   105
            <span style="color:red" >ClassDoc</span> cd = classes[i];
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   106
            printMembers(cd.<span style="color:red" >constructors</span>());
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   107
            printMembers(cd.<span style="color:red" >methods</span>());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
23135
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   112
    static void printMembers(<span style="color:red" >ExecutableMemberDoc</span>[] mems) {
23109
1efb9231d5a2 8032526: fix the accessibility, html, syntax errors and warnings reported by doclint report in langtools
cl
parents: 21019
diff changeset
   113
        for (int i = 0; i &lt; mems.length; ++i) {
23135
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   114
            <span style="color:red" >ParamTag</span>[] params = mems[i].<span style="color:red" >paramTags</span>();
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   115
            System.out.println(mems[i].<span style="color:red" >qualifiedName</span>());
23109
1efb9231d5a2 8032526: fix the accessibility, html, syntax errors and warnings reported by doclint report in langtools
cl
parents: 21019
diff changeset
   116
            for (int j = 0; j &lt; params.length; ++j) {
23135
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   117
                System.out.println("   " + params[j].<span style="color:red" >parameterName</span>()
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   118
                    + " - " + params[j].<span style="color:red" >parameterComment</span>());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
        }
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   121
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
}
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
</pre>
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   124
Interfaces and methods from the Javadoc API are marked in
23135
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   125
<span style="color:red" >red</span>.
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   126
{@link com.sun.javadoc.Doclet Doclet} is an abstract class that specifies
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   127
the invocation interface for doclets,
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   128
{@link com.sun.javadoc.Doclet Doclet} holds class or interface information,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
{@link com.sun.javadoc.ExecutableMemberDoc} is a
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   130
superinterface of {@link com.sun.javadoc.MethodDoc} and
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   131
{@link com.sun.javadoc.ConstructorDoc},
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
and {@link com.sun.javadoc.ParamTag} holds information
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 23135
diff changeset
   133
from "{@code @param}" tags.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
This doclet when invoked with a command line like:
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
<pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
    javadoc -doclet ListParams -sourcepath &lt;source-location&gt; java.util
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
</pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
producing output like:
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
<pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    ...
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
    java.util.ArrayList.add
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
       index - index at which the specified element is to be inserted.
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
       element - element to be inserted.
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
    java.util.ArrayList.remove
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
       index - the index of the element to removed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
    ...
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
</pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
@see com.sun.javadoc.Doclet
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
@see com.sun.javadoc.RootDoc
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   152
*/
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   153
package com.sun.javadoc;