langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java
author sla
Mon, 10 Aug 2015 13:08:53 +0200
changeset 32171 20aeca84739b
parent 25874 83c19f00452c
child 34916 16043fc1d90b
permissions -rw-r--r--
8076470: Remove the JVM TI hprof Agent Reviewed-by: sspitsyn, mchung, erikj
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
/*
23135
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
     2
 * Copyright (c) 1998, 2014, 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
/**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
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
    28
for clients to inspect the source-level structure of programs and
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
libraries, including javadoc comments embedded in the source.
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
This is useful for documentation, program checking, automatic
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
code generation and many other tools.
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    34
Doclets are invoked by javadoc and use this API to write out
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
program information to files.  For example, the standard doclet is called
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
by default and writes out documentation to HTML files.
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    39
The invocation is defined by the abstract {@link com.sun.javadoc.Doclet} class
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
-- the entry point is the {@link com.sun.javadoc.Doclet#start(RootDoc) start} method:
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
<pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
    public static boolean <b>start</b>(RootDoc root)
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
</pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
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
    45
information. From this root all other program structure
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    46
information can be extracted.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
<a name="terminology"></a>
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
<h3>Terminology</h3>
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
<a name="included"></a>
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
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
    54
these are called the <em>specified</em> packages and classes.
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    55
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
    56
({@code -public}, {@code -protected}, {@code -package},
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 23135
diff changeset
    57
and {@code -private}) filter program elements, producing a
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
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
    59
(The unfiltered set is also available through
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
{@link com.sun.javadoc.PackageDoc#allClasses(boolean) allClasses(false)}.)
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
<a name="class"></a>
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
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
    65
shorthand for "class or interface", as in: {@link com.sun.javadoc.ClassDoc},
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
{@link com.sun.javadoc.PackageDoc#allClasses() allClasses()}, and
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
{@link com.sun.javadoc.PackageDoc#findClass(String) findClass(String)}.
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    68
In only a couple of other places, it means "class, as opposed to interface",
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
as in:  {@link com.sun.javadoc.Doc#isClass()}.
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
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
    71
{@linkplain com.sun.javadoc.Doc#isOrdinaryClass() ordinary classes},
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
{@linkplain com.sun.javadoc.Doc#isEnum() enums},
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    73
{@linkplain com.sun.javadoc.Doc#isError() errors} and
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
{@linkplain com.sun.javadoc.Doc#isException() exceptions}.
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    75
Throughout the API, the detailed description of each program element
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
describes explicitly which meaning is being used.
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
<a name="qualified"></a>
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
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
    81
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
    82
name has no package name, such as {@code String}.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
<a name="example"></a>
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
<h3>Example</h3>
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    87
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
    88
The following is an example doclet that
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 23135
diff changeset
    89
displays information in the {@code @param} tags of the processed
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
classes:
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
<pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
import com.sun.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
23135
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
    94
public class ListParams extends <span style="color:red" >Doclet</span> {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
23135
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
    96
    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
    97
        <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
    98
        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
    99
            <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
   100
            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
   101
            printMembers(cd.<span style="color:red" >methods</span>());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
23135
3c45d467788f 8035875: remove deprecated html <font> tags from javadoc package-info.java file
jjg
parents: 23109
diff changeset
   106
    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
   107
        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
   108
            <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
   109
            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
   110
            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
   111
                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
   112
                    + " - " + params[j].<span style="color:red" >parameterComment</span>());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
        }
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   115
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
}
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
</pre>
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   118
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
   119
<span style="color:red" >red</span>.
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   120
{@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
   121
the invocation interface for doclets,
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   122
{@link com.sun.javadoc.Doclet Doclet} holds class or interface information,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
{@link com.sun.javadoc.ExecutableMemberDoc} is a
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   124
superinterface of {@link com.sun.javadoc.MethodDoc} and
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   125
{@link com.sun.javadoc.ConstructorDoc},
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
and {@link com.sun.javadoc.ParamTag} holds information
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 23135
diff changeset
   127
from "{@code @param}" tags.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
This doclet when invoked with a command line like:
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
<pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
    javadoc -doclet ListParams -sourcepath &lt;source-location&gt; java.util
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
</pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
producing output like:
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
<pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    ...
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
    java.util.ArrayList.add
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
       index - index at which the specified element is to be inserted.
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
       element - element to be inserted.
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
    java.util.ArrayList.remove
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
       index - the index of the element to removed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    ...
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
</pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
@see com.sun.javadoc.Doclet
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
@see com.sun.javadoc.RootDoc
21019
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   146
*/
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   147
@jdk.Exported
ce43db751581 8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents: 5568
diff changeset
   148
package com.sun.javadoc;