author | sla |
Mon, 10 Aug 2015 13:08:53 +0200 | |
changeset 32171 | 20aeca84739b |
parent 25874 | 83c19f00452c |
child 34916 | 16043fc1d90b |
permissions | -rw-r--r-- |
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 | 25 |
|
21019
ce43db751581
8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents:
5568
diff
changeset
|
26 |
/** |
10 | 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 | 29 |
libraries, including javadoc comments embedded in the source. |
30 |
This is useful for documentation, program checking, automatic |
|
31 |
code generation and many other tools. |
|
32 |
<p> |
|
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 | 35 |
program information to files. For example, the standard doclet is called |
36 |
by default and writes out documentation to HTML files. |
|
37 |
<p> |
|
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 | 40 |
-- the entry point is the {@link com.sun.javadoc.Doclet#start(RootDoc) start} method: |
41 |
<pre> |
|
42 |
public static boolean <b>start</b>(RootDoc root) |
|
43 |
</pre> |
|
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 | 47 |
<p> |
48 |
||
49 |
<a name="terminology"></a> |
|
50 |
<h3>Terminology</h3> |
|
51 |
||
52 |
<a name="included"></a> |
|
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 | 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 | 60 |
{@link com.sun.javadoc.PackageDoc#allClasses(boolean) allClasses(false)}.) |
61 |
<p> |
|
62 |
||
63 |
<a name="class"></a> |
|
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 | 66 |
{@link com.sun.javadoc.PackageDoc#allClasses() allClasses()}, and |
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 | 69 |
as in: {@link com.sun.javadoc.Doc#isClass()}. |
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 | 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 | 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 | 76 |
describes explicitly which meaning is being used. |
77 |
<p> |
|
78 |
||
79 |
<a name="qualified"></a> |
|
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 | 83 |
<p> |
84 |
||
85 |
<a name="example"></a> |
|
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 | 90 |
classes: |
91 |
<pre> |
|
92 |
import com.sun.javadoc.*; |
|
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 | 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 < 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 | 102 |
} |
103 |
return true; |
|
104 |
} |
|
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 < 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 < 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 | 113 |
} |
114 |
} |
|
21019
ce43db751581
8026371: "tidy" issues in langtools/src/**/*.html files
jjg
parents:
5568
diff
changeset
|
115 |
} |
10 | 116 |
} |
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 | 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 | 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 | 128 |
<p> |
129 |
This doclet when invoked with a command line like: |
|
130 |
<pre> |
|
131 |
javadoc -doclet ListParams -sourcepath <source-location> java.util |
|
132 |
</pre> |
|
133 |
producing output like: |
|
134 |
<pre> |
|
135 |
... |
|
136 |
java.util.ArrayList.add |
|
137 |
index - index at which the specified element is to be inserted. |
|
138 |
element - element to be inserted. |
|
139 |
java.util.ArrayList.remove |
|
140 |
index - the index of the element to removed. |
|
141 |
... |
|
142 |
||
143 |
</pre> |
|
144 |
@see com.sun.javadoc.Doclet |
|
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; |