author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 58477 | d148a7e7160c |
permissions | -rw-r--r-- |
10 | 1 |
/* |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48295
diff
changeset
|
2 |
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.toolkit.util; |
10 | 27 |
|
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
28 |
import java.lang.annotation.Documented; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
29 |
import java.lang.ref.SoftReference; |
43261 | 30 |
import java.net.URI; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
31 |
import java.text.CollationKey; |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
32 |
import java.text.Collator; |
52144
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
33 |
import java.text.ParseException; |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
34 |
import java.text.RuleBasedCollator; |
1869
0e193a8f3520
6794582: javadoc should read files using a FileManager
jjg
parents:
1864
diff
changeset
|
35 |
import java.util.*; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
36 |
import java.util.AbstractMap.SimpleEntry; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
37 |
import java.util.Map.Entry; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
38 |
import java.util.stream.Collectors; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
39 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
40 |
import javax.lang.model.SourceVersion; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
41 |
import javax.lang.model.element.AnnotationMirror; |
42816
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
42 |
import javax.lang.model.element.AnnotationValue; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
43 |
import javax.lang.model.element.Element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
44 |
import javax.lang.model.element.ElementKind; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
45 |
import javax.lang.model.element.ExecutableElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
46 |
import javax.lang.model.element.Modifier; |
36526 | 47 |
import javax.lang.model.element.ModuleElement; |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
48 |
import javax.lang.model.element.ModuleElement.RequiresDirective; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
49 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
50 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
51 |
import javax.lang.model.element.TypeParameterElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
52 |
import javax.lang.model.element.VariableElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
53 |
import javax.lang.model.type.ArrayType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
54 |
import javax.lang.model.type.DeclaredType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
55 |
import javax.lang.model.type.ErrorType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
56 |
import javax.lang.model.type.ExecutableType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
57 |
import javax.lang.model.type.NoType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
58 |
import javax.lang.model.type.PrimitiveType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
59 |
import javax.lang.model.type.TypeMirror; |
47988
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
60 |
import javax.lang.model.type.TypeVariable; |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
61 |
import javax.lang.model.type.WildcardType; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
62 |
import javax.lang.model.util.ElementFilter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
63 |
import javax.lang.model.util.ElementKindVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
64 |
import javax.lang.model.util.Elements; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
65 |
import javax.lang.model.util.SimpleElementVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
66 |
import javax.lang.model.util.SimpleTypeVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
67 |
import javax.lang.model.util.TypeKindVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
68 |
import javax.lang.model.util.Types; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
69 |
import javax.tools.FileObject; |
40605
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
70 |
import javax.tools.JavaFileManager; |
36526 | 71 |
import javax.tools.JavaFileManager.Location; |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19667
diff
changeset
|
72 |
import javax.tools.StandardLocation; |
1869
0e193a8f3520
6794582: javadoc should read files using a FileManager
jjg
parents:
1864
diff
changeset
|
73 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
74 |
import com.sun.source.doctree.DocCommentTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
75 |
import com.sun.source.doctree.DocTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
76 |
import com.sun.source.doctree.DocTree.Kind; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
77 |
import com.sun.source.doctree.ParamTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
78 |
import com.sun.source.doctree.SerialFieldTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
79 |
import com.sun.source.tree.CompilationUnitTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
80 |
import com.sun.source.tree.LineMap; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
81 |
import com.sun.source.util.DocSourcePositions; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
82 |
import com.sun.source.util.DocTrees; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
83 |
import com.sun.source.util.TreePath; |
42816
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
84 |
import com.sun.tools.javac.model.JavacTypes; |
50856
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
85 |
import jdk.javadoc.internal.doclets.formats.html.SearchIndexItem; |
45417 | 86 |
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
87 |
import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo; |
40587 | 88 |
import jdk.javadoc.internal.doclets.toolkit.Messages; |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
52174
diff
changeset
|
89 |
import jdk.javadoc.internal.doclets.toolkit.Resources; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
90 |
import jdk.javadoc.internal.doclets.toolkit.WorkArounds; |
42816
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
91 |
import jdk.javadoc.internal.tool.DocEnvImpl; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
92 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
93 |
import static javax.lang.model.element.ElementKind.*; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
94 |
import static javax.lang.model.element.Modifier.*; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
95 |
import static javax.lang.model.type.TypeKind.*; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
96 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
97 |
import static com.sun.source.doctree.DocTree.Kind.*; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
98 |
import static jdk.javadoc.internal.doclets.toolkit.builders.ConstantsSummaryBuilder.MAX_CONSTANT_VALUE_INDEX_LENGTH; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
99 |
|
10 | 100 |
/** |
101 |
* Utilities Class for Doclets. |
|
102 |
* |
|
14260 | 103 |
* <p><b>This is NOT part of any supported API. |
104 |
* If you write code that depends on this, you do so at your own risk. |
|
105 |
* This code and its internal interfaces are subject to change or |
|
106 |
* deletion without notice.</b> |
|
10 | 107 |
* |
108 |
* @author Atul M Dambalkar |
|
109 |
* @author Jamie Ho |
|
110 |
*/ |
|
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
25449
diff
changeset
|
111 |
public class Utils { |
45417 | 112 |
public final BaseConfiguration configuration; |
40303 | 113 |
public final Messages messages; |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
52174
diff
changeset
|
114 |
public final Resources resources; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
115 |
public final DocTrees docTrees; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
116 |
public final Elements elementUtils; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
117 |
public final Types typeUtils; |
43261 | 118 |
public final JavaScriptScanner javaScriptScanner; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
119 |
|
45417 | 120 |
public Utils(BaseConfiguration c) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
121 |
configuration = c; |
40303 | 122 |
messages = configuration.getMessages(); |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
52174
diff
changeset
|
123 |
resources = configuration.getResources(); |
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
38617
diff
changeset
|
124 |
elementUtils = c.docEnv.getElementUtils(); |
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
38617
diff
changeset
|
125 |
typeUtils = c.docEnv.getTypeUtils(); |
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
38617
diff
changeset
|
126 |
docTrees = c.docEnv.getDocTrees(); |
43261 | 127 |
javaScriptScanner = c.isAllowScriptInComments() ? null : new JavaScriptScanner(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
128 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
129 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
130 |
// our own little symbol table |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
131 |
private HashMap<String, TypeMirror> symtab = new HashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
132 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
133 |
public TypeMirror getSymbol(String signature) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
134 |
TypeMirror type = symtab.get(signature); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
135 |
if (type == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
136 |
TypeElement typeElement = elementUtils.getTypeElement(signature); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
137 |
if (typeElement == null) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
138 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
139 |
type = typeElement.asType(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
140 |
if (type == null) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
141 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
142 |
symtab.put(signature, type); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
143 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
144 |
return type; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
145 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
146 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
147 |
public TypeMirror getObjectType() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
148 |
return getSymbol("java.lang.Object"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
149 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
150 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
151 |
public TypeMirror getExceptionType() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
152 |
return getSymbol("java.lang.Exception"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
153 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
154 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
155 |
public TypeMirror getErrorType() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
156 |
return getSymbol("java.lang.Error"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
157 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
158 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
159 |
public TypeMirror getSerializableType() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
160 |
return getSymbol("java.io.Serializable"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
161 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
162 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
163 |
public TypeMirror getExternalizableType() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
164 |
return getSymbol("java.io.Externalizable"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
165 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
166 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
167 |
public TypeMirror getIllegalArgumentExceptionType() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
168 |
return getSymbol("java.lang.IllegalArgumentException"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
169 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
170 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
171 |
public TypeMirror getNullPointerExceptionType() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
172 |
return getSymbol("java.lang.NullPointerException"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
173 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
174 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
175 |
public TypeMirror getDeprecatedType() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
176 |
return getSymbol("java.lang.Deprecated"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
177 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
178 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
179 |
public TypeMirror getFunctionalInterface() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
180 |
return getSymbol("java.lang.FunctionalInterface"); |
10 | 181 |
} |
182 |
||
183 |
/** |
|
184 |
* Return array of class members whose documentation is to be generated. |
|
185 |
* If the member is deprecated do not include such a member in the |
|
186 |
* returned array. |
|
187 |
* |
|
188 |
* @param members Array of members to choose from. |
|
189 |
* @return List List of eligible members for whom |
|
190 |
* documentation is getting generated. |
|
191 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
192 |
public List<Element> excludeDeprecatedMembers(List<? extends Element> members) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
193 |
List<Element> excludeList = members.stream() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
194 |
.filter((member) -> (!isDeprecated(member))) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
195 |
.sorted(makeGeneralPurposeComparator()) |
36043
0a4c7a4fde8d
8150077: Due to a javac type inference issue, javadoc doesn't compile with a jdk prior to 8u40
simonis
parents:
35426
diff
changeset
|
196 |
.collect(Collectors.<Element, List<Element>>toCollection(ArrayList::new)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
197 |
return excludeList; |
10 | 198 |
} |
199 |
||
200 |
/** |
|
201 |
* Search for the given method in the given class. |
|
202 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
203 |
* @param te Class to search into. |
10 | 204 |
* @param method Method to be searched. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
205 |
* @return ExecutableElement Method found, null otherwise. |
10 | 206 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
207 |
public ExecutableElement findMethod(TypeElement te, ExecutableElement method) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
208 |
for (Element m : getMethods(te)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
209 |
if (executableMembersEqual(method, (ExecutableElement)m)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
210 |
return (ExecutableElement)m; |
10 | 211 |
} |
212 |
} |
|
213 |
return null; |
|
214 |
} |
|
215 |
||
216 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
217 |
* Test whether a class is a subclass of another class. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
218 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
219 |
* @param t1 the candidate superclass. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
220 |
* @param t2 the target |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
221 |
* @return true if t1 is a superclass of t2. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
222 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
223 |
public boolean isSubclassOf(TypeElement t1, TypeElement t2) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
224 |
return typeUtils.isSubtype(t1.asType(), t2.asType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
225 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
226 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
227 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
228 |
* @param e1 the first method to compare. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
229 |
* @param e2 the second method to compare. |
10 | 230 |
* @return true if member1 overrides/hides or is overriden/hidden by member2. |
231 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
232 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
233 |
public boolean executableMembersEqual(ExecutableElement e1, ExecutableElement e2) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
234 |
// TODO: investigate if Elements.hides(..) will work here. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
235 |
if (isStatic(e1) && isStatic(e2)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
236 |
List<? extends VariableElement> parameters1 = e1.getParameters(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
237 |
List<? extends VariableElement> parameters2 = e2.getParameters(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
238 |
if (e1.getSimpleName().equals(e2.getSimpleName()) && |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
239 |
parameters1.size() == parameters2.size()) { |
10 | 240 |
int j; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
241 |
for (j = 0 ; j < parameters1.size(); j++) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
242 |
VariableElement v1 = parameters1.get(j); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
243 |
VariableElement v2 = parameters2.get(j); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
244 |
String t1 = getTypeName(v1.asType(), true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
245 |
String t2 = getTypeName(v2.asType(), true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
246 |
if (!(t1.equals(t2) || |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
247 |
isTypeVariable(v1.asType()) || isTypeVariable(v2.asType()))) { |
10 | 248 |
break; |
249 |
} |
|
250 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
251 |
if (j == parameters1.size()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
252 |
return true; |
10 | 253 |
} |
254 |
} |
|
255 |
return false; |
|
256 |
} else { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
257 |
return elementUtils.overrides(e1, e2, getEnclosingTypeElement(e1)) || |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
258 |
elementUtils.overrides(e2, e1, getEnclosingTypeElement(e2)) || |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
259 |
e1.equals(e2); |
10 | 260 |
} |
261 |
} |
|
262 |
||
263 |
/** |
|
9303
eae35c201e19
7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents:
8631
diff
changeset
|
264 |
* According to |
eae35c201e19
7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents:
8631
diff
changeset
|
265 |
* <cite>The Java™ Language Specification</cite>, |
eae35c201e19
7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents:
8631
diff
changeset
|
266 |
* all the outer classes and static inner classes are core classes. |
10 | 267 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
268 |
public boolean isCoreClass(TypeElement e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
269 |
return getEnclosingTypeElement(e) == null || isStatic(e); |
10 | 270 |
} |
271 |
||
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
48028
diff
changeset
|
272 |
public Location getLocationForPackage(PackageElement pd) { |
42824 | 273 |
ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(pd); |
274 |
||
275 |
if (mdle == null) |
|
276 |
return defaultLocation(); |
|
277 |
||
278 |
return getLocationForModule(mdle); |
|
40605
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
279 |
} |
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
280 |
|
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
48028
diff
changeset
|
281 |
public Location getLocationForModule(ModuleElement mdle) { |
40605
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
282 |
Location loc = configuration.workArounds.getLocationForModule(mdle); |
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
283 |
if (loc != null) |
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
284 |
return loc; |
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
285 |
|
42824 | 286 |
return defaultLocation(); |
287 |
} |
|
288 |
||
289 |
private Location defaultLocation() { |
|
40605
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
290 |
JavaFileManager fm = configuration.docEnv.getJavaFileManager(); |
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
291 |
return fm.hasLocation(StandardLocation.SOURCE_PATH) |
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
292 |
? StandardLocation.SOURCE_PATH |
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
293 |
: StandardLocation.CLASS_PATH; |
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
294 |
} |
926c13175b67
8157349: Missing doc-files in javadoc documentation
ksrini
parents:
40587
diff
changeset
|
295 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
296 |
public boolean isAnnotated(TypeMirror e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
297 |
return !e.getAnnotationMirrors().isEmpty(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
298 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
299 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
300 |
public boolean isAnnotated(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
301 |
return !e.getAnnotationMirrors().isEmpty(); |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25874
diff
changeset
|
302 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
303 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
304 |
public boolean isAnnotationType(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
305 |
return new SimpleElementVisitor9<Boolean, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
306 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
307 |
public Boolean visitExecutable(ExecutableElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
308 |
return visit(e.getEnclosingElement()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
309 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
310 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
311 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
312 |
public Boolean visitUnknown(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
313 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
314 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
315 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
316 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
317 |
protected Boolean defaultAction(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
318 |
return e.getKind() == ANNOTATION_TYPE; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
319 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
320 |
}.visit(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
321 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
322 |
|
10 | 323 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
324 |
* An Enum implementation is almost identical, thus this method returns if |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
325 |
* this element represents a CLASS or an ENUM |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
326 |
* @param e element |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
327 |
* @return true if class or enum |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
328 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
329 |
public boolean isClass(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
330 |
return e.getKind().isClass(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
331 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
332 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
333 |
public boolean isConstructor(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
334 |
return e.getKind() == CONSTRUCTOR; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
335 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
336 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
337 |
public boolean isEnum(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
338 |
return e.getKind() == ENUM; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
339 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
340 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
341 |
boolean isEnumConstant(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
342 |
return e.getKind() == ENUM_CONSTANT; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
343 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
344 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
345 |
public boolean isField(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
346 |
return e.getKind() == FIELD; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
347 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
348 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
349 |
public boolean isInterface(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
350 |
return e.getKind() == INTERFACE; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
351 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
352 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
353 |
public boolean isMethod(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
354 |
return e.getKind() == METHOD; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
355 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
356 |
|
40511 | 357 |
public boolean isModule(Element e) { |
358 |
return e.getKind() == ElementKind.MODULE; |
|
359 |
} |
|
360 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
361 |
public boolean isPackage(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
362 |
return e.getKind() == ElementKind.PACKAGE; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
363 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
364 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
365 |
public boolean isAbstract(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
366 |
return e.getModifiers().contains(Modifier.ABSTRACT); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
367 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
368 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
369 |
public boolean isDefault(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
370 |
return e.getModifiers().contains(Modifier.DEFAULT); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
371 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
372 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
373 |
public boolean isPackagePrivate(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
374 |
return !(isPublic(e) || isPrivate(e) || isProtected(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
375 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
376 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
377 |
public boolean isPrivate(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
378 |
return e.getModifiers().contains(Modifier.PRIVATE); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
379 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
380 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
381 |
public boolean isProtected(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
382 |
return e.getModifiers().contains(Modifier.PROTECTED); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
383 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
384 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
385 |
public boolean isPublic(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
386 |
return e.getModifiers().contains(Modifier.PUBLIC); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
387 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
388 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
389 |
public boolean isProperty(String name) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
390 |
return configuration.javafx && name.endsWith("Property"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
391 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
392 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
393 |
public String getPropertyName(String name) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
394 |
return isProperty(name) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
395 |
? name.substring(0, name.length() - "Property".length()) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
396 |
: name; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
397 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
398 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
399 |
public String getPropertyLabel(String name) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
400 |
return name.substring(0, name.lastIndexOf("Property")); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
401 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
402 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
403 |
public boolean isOverviewElement(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
404 |
return e.getKind() == ElementKind.OTHER; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
405 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
406 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
407 |
public boolean isStatic(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
408 |
return e.getModifiers().contains(Modifier.STATIC); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
409 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
410 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
411 |
public boolean isSerializable(TypeElement e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
412 |
return typeUtils.isSubtype(e.asType(), getSerializableType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
413 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
414 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
415 |
public boolean isExternalizable(TypeElement e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
416 |
return typeUtils.isSubtype(e.asType(), getExternalizableType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
417 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
418 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
419 |
public SortedSet<VariableElement> serializableFields(TypeElement aclass) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
420 |
return configuration.workArounds.getSerializableFields(this, aclass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
421 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
422 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
423 |
public SortedSet<ExecutableElement> serializationMethods(TypeElement aclass) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
424 |
return configuration.workArounds.getSerializationMethods(this, aclass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
425 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
426 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
427 |
public boolean definesSerializableFields(TypeElement aclass) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
428 |
return configuration.workArounds.definesSerializableFields(this, aclass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
429 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
430 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
431 |
public String modifiersToString(Element e, boolean trailingSpace) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
432 |
SortedSet<Modifier> set = new TreeSet<>(e.getModifiers()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
433 |
set.remove(Modifier.NATIVE); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
434 |
set.remove(Modifier.STRICTFP); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
435 |
set.remove(Modifier.SYNCHRONIZED); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
436 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
437 |
return new ElementKindVisitor9<String, SortedSet<Modifier>>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
438 |
final StringBuilder sb = new StringBuilder(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
439 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
440 |
void addVisibilityModifier(Set<Modifier> modifiers) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
441 |
if (modifiers.contains(PUBLIC)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
442 |
sb.append("public").append(" "); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
443 |
} else if (modifiers.contains(PROTECTED)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
444 |
sb.append("protected").append(" "); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
445 |
} else if (modifiers.contains(PRIVATE)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
446 |
sb.append("private").append(" "); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
447 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
448 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
449 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
450 |
void addStatic(Set<Modifier> modifiers) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
451 |
if (modifiers.contains(STATIC)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
452 |
sb.append("static").append(" "); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
453 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
454 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
455 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
456 |
void addModifers(Set<Modifier> modifiers) { |
42827
36468b5fa7f4
8181370: Convert anonymous inner classes into lambdas/method references
mcimadamore
parents:
42824
diff
changeset
|
457 |
String s = set.stream().map(Modifier::toString).collect(Collectors.joining(" ")); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
458 |
sb.append(s); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
459 |
if (!s.isEmpty()) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
460 |
sb.append(" "); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
461 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
462 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
463 |
String finalString(String s) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
464 |
sb.append(s); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
465 |
if (trailingSpace) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
466 |
if (sb.lastIndexOf(" ") == sb.length() - 1) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
467 |
return sb.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
468 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
469 |
return sb.append(" ").toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
470 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
471 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
472 |
return sb.toString().trim(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
473 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
474 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
475 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
476 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
477 |
public String visitTypeAsInterface(TypeElement e, SortedSet<Modifier> p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
478 |
addVisibilityModifier(p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
479 |
addStatic(p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
480 |
return finalString("interface"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
481 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
482 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
483 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
484 |
public String visitTypeAsEnum(TypeElement e, SortedSet<Modifier> p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
485 |
addVisibilityModifier(p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
486 |
addStatic(p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
487 |
return finalString("enum"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
488 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
489 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
490 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
491 |
public String visitTypeAsAnnotationType(TypeElement e, SortedSet<Modifier> p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
492 |
addVisibilityModifier(p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
493 |
addStatic(p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
494 |
return finalString("@interface"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
495 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
496 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
497 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
498 |
public String visitTypeAsClass(TypeElement e, SortedSet<Modifier> p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
499 |
addModifers(p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
500 |
return finalString("class"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
501 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
502 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
503 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
504 |
protected String defaultAction(Element e, SortedSet<Modifier> p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
505 |
addModifers(p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
506 |
return sb.toString().trim(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
507 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
508 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
509 |
}.visit(e, set); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
510 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
511 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
512 |
public boolean isFunctionalInterface(AnnotationMirror amirror) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
513 |
return amirror.getAnnotationType().equals(getFunctionalInterface()) && |
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
38617
diff
changeset
|
514 |
configuration.docEnv.getSourceVersion() |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
515 |
.compareTo(SourceVersion.RELEASE_8) >= 0; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
516 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
517 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
518 |
public boolean isNoType(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
519 |
return t.getKind() == NONE; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
520 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
521 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
522 |
public boolean isOrdinaryClass(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
523 |
if (isEnum(te) || isInterface(te) || isAnnotationType(te)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
524 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
525 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
526 |
if (isError(te) || isException(te)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
527 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
528 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
529 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
530 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
531 |
|
58477 | 532 |
public boolean isUndocumentedEnclosure(TypeElement enclosingTypeElement) { |
533 |
return isPackagePrivate(enclosingTypeElement) && !isLinkable(enclosingTypeElement); |
|
534 |
} |
|
535 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
536 |
public boolean isError(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
537 |
if (isEnum(te) || isInterface(te) || isAnnotationType(te)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
538 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
539 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
540 |
return typeUtils.isSubtype(te.asType(), getErrorType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
541 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
542 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
543 |
public boolean isException(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
544 |
if (isEnum(te) || isInterface(te) || isAnnotationType(te)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
545 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
546 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
547 |
return typeUtils.isSubtype(te.asType(), getExceptionType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
548 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
549 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
550 |
public boolean isPrimitive(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
551 |
return new SimpleTypeVisitor9<Boolean, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
552 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
553 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
554 |
public Boolean visitNoType(NoType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
555 |
return t.getKind() == VOID; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
556 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
557 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
558 |
public Boolean visitPrimitive(PrimitiveType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
559 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
560 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
561 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
562 |
public Boolean visitArray(ArrayType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
563 |
return visit(t.getComponentType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
564 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
565 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
566 |
protected Boolean defaultAction(TypeMirror e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
567 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
568 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
569 |
}.visit(t); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
570 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
571 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
572 |
public boolean isExecutableElement(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
573 |
ElementKind kind = e.getKind(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
574 |
switch (kind) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
575 |
case CONSTRUCTOR: case METHOD: case INSTANCE_INIT: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
576 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
577 |
default: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
578 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
579 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
580 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
581 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
582 |
public boolean isVariableElement(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
583 |
ElementKind kind = e.getKind(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
584 |
switch(kind) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
585 |
case ENUM_CONSTANT: case EXCEPTION_PARAMETER: case FIELD: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
586 |
case LOCAL_VARIABLE: case PARAMETER: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
587 |
case RESOURCE_VARIABLE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
588 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
589 |
default: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
590 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
591 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
592 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
593 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
594 |
public boolean isTypeElement(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
595 |
switch (e.getKind()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
596 |
case CLASS: case ENUM: case INTERFACE: case ANNOTATION_TYPE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
597 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
598 |
default: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
599 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
600 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
601 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
602 |
|
46078 | 603 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
604 |
* Get the signature. It is the parameter list, type is qualified. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
605 |
* For instance, for a method {@code mymethod(String x, int y)}, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
606 |
* it will return {@code(java.lang.String,int)}. |
46078 | 607 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
608 |
* @param e |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
609 |
* @return String |
10 | 610 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
611 |
public String signature(ExecutableElement e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
612 |
return makeSignature(e, true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
613 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
614 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
615 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
616 |
* Get flat signature. All types are not qualified. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
617 |
* Return a String, which is the flat signature of this member. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
618 |
* It is the parameter list, type is not qualified. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
619 |
* For instance, for a method {@code mymethod(String x, int y)}, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
620 |
* it will return {@code (String, int)}. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
621 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
622 |
public String flatSignature(ExecutableElement e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
623 |
return makeSignature(e, false); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
624 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
625 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
626 |
public String makeSignature(ExecutableElement e, boolean full) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
627 |
return makeSignature(e, full, false); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
628 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
629 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
630 |
public String makeSignature(ExecutableElement e, boolean full, boolean ignoreTypeParameters) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
631 |
StringBuilder result = new StringBuilder(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
632 |
result.append("("); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
633 |
Iterator<? extends VariableElement> iterator = e.getParameters().iterator(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
634 |
while (iterator.hasNext()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
635 |
VariableElement next = iterator.next(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
636 |
TypeMirror type = next.asType(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
637 |
result.append(getTypeSignature(type, full, ignoreTypeParameters)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
638 |
if (iterator.hasNext()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
639 |
result.append(", "); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
640 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
641 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
642 |
if (e.isVarArgs()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
643 |
int len = result.length(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
644 |
result.replace(len - 2, len, "..."); |
10 | 645 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
646 |
result.append(")"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
647 |
return result.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
648 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
649 |
|
44385
f777a2822087
8176231: javadoc -javafx creates bad link when Property is an array of objects
jjg
parents:
43872
diff
changeset
|
650 |
public String getTypeSignature(TypeMirror t, boolean qualifiedName, boolean noTypeParameters) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
651 |
return new SimpleTypeVisitor9<StringBuilder, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
652 |
final StringBuilder sb = new StringBuilder(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
653 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
654 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
655 |
public StringBuilder visitArray(ArrayType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
656 |
TypeMirror componentType = t.getComponentType(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
657 |
visit(componentType); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
658 |
sb.append("[]"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
659 |
return sb; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
660 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
661 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
662 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
663 |
public StringBuilder visitDeclared(DeclaredType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
664 |
Element e = t.asElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
665 |
sb.append(qualifiedName ? getFullyQualifiedName(e) : getSimpleName(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
666 |
List<? extends TypeMirror> typeArguments = t.getTypeArguments(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
667 |
if (typeArguments.isEmpty() || noTypeParameters) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
668 |
return sb; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
669 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
670 |
sb.append("<"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
671 |
Iterator<? extends TypeMirror> iterator = typeArguments.iterator(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
672 |
while (iterator.hasNext()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
673 |
TypeMirror ta = iterator.next(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
674 |
visit(ta); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
675 |
if (iterator.hasNext()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
676 |
sb.append(", "); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
677 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
678 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
679 |
sb.append(">"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
680 |
return sb; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
681 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
682 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
683 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
684 |
public StringBuilder visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
685 |
Element e = t.asElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
686 |
sb.append(qualifiedName ? getFullyQualifiedName(e, false) : getSimpleName(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
687 |
return sb; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
688 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
689 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
690 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
691 |
public StringBuilder visitWildcard(javax.lang.model.type.WildcardType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
692 |
sb.append("?"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
693 |
TypeMirror upperBound = t.getExtendsBound(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
694 |
if (upperBound != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
695 |
sb.append(" extends "); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
696 |
visit(upperBound); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
697 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
698 |
TypeMirror superBound = t.getSuperBound(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
699 |
if (superBound != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
700 |
sb.append(" super "); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
701 |
visit(superBound); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
702 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
703 |
return sb; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
704 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
705 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
706 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
707 |
protected StringBuilder defaultAction(TypeMirror e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
708 |
return sb.append(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
709 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
710 |
}.visit(t).toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
711 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
712 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
713 |
public boolean isArrayType(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
714 |
return t.getKind() == ARRAY; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
715 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
716 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
717 |
public boolean isDeclaredType(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
718 |
return t.getKind() == DECLARED; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
719 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
720 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
721 |
public boolean isErrorType(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
722 |
return t.getKind() == ERROR; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
723 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
724 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
725 |
public boolean isIntersectionType(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
726 |
return t.getKind() == INTERSECTION; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
727 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
728 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
729 |
public boolean isTypeParameterElement(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
730 |
return e.getKind() == TYPE_PARAMETER; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
731 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
732 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
733 |
public boolean isTypeVariable(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
734 |
return t.getKind() == TYPEVAR; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
735 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
736 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
737 |
public boolean isVoid(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
738 |
return t.getKind() == VOID; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
739 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
740 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
741 |
public boolean isWildCard(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
742 |
return t.getKind() == WILDCARD; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
743 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
744 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
745 |
public boolean ignoreBounds(TypeMirror bound) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
746 |
return bound.equals(getObjectType()) && !isAnnotated(bound); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
747 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
748 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
749 |
/* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
750 |
* a direct port of TypeVariable.getBounds |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
751 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
752 |
public List<? extends TypeMirror> getBounds(TypeParameterElement tpe) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
753 |
List<? extends TypeMirror> bounds = tpe.getBounds(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
754 |
if (!bounds.isEmpty()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
755 |
TypeMirror upperBound = bounds.get(bounds.size() - 1); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
756 |
if (ignoreBounds(upperBound)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
757 |
return Collections.emptyList(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
758 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
759 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
760 |
return bounds; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
761 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
762 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
763 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
764 |
* Returns the TypeMirror of the ExecutableElement for all methods, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
765 |
* a null if constructor. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
766 |
* @param ee the ExecutableElement |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
767 |
* @return |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
768 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
769 |
public TypeMirror getReturnType(ExecutableElement ee) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
770 |
return ee.getKind() == CONSTRUCTOR ? null : ee.getReturnType(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
771 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
772 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
773 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
774 |
* Return the type containing the method that this method overrides. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
775 |
* It may be a {@code TypeElement} or a {@code TypeParameterElement}. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
776 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
777 |
public TypeMirror overriddenType(ExecutableElement method) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
778 |
return configuration.workArounds.overriddenType(method); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
779 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
780 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
781 |
private TypeMirror getType(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
782 |
return (isNoType(t)) ? getObjectType() : t; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
783 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
784 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
785 |
public TypeMirror getSuperType(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
786 |
TypeMirror t = te.getSuperclass(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
787 |
return getType(t); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
788 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
789 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
790 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
791 |
* Return the class that originally defined the method that |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
792 |
* is overridden by the current definition, or null if no |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
793 |
* such class exists. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
794 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
795 |
* @return a TypeElement representing the superclass that |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
796 |
* originally defined this method, null if this method does |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
797 |
* not override a definition in a superclass. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
798 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
799 |
public TypeElement overriddenClass(ExecutableElement ee) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
800 |
TypeMirror type = overriddenType(ee); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
801 |
return (type != null) ? asTypeElement(type) : null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
802 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
803 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
804 |
public ExecutableElement overriddenMethod(ExecutableElement method) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
805 |
if (isStatic(method)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
806 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
807 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
808 |
final TypeElement origin = getEnclosingTypeElement(method); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
809 |
for (TypeMirror t = getSuperType(origin); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
810 |
t.getKind() == DECLARED; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
811 |
t = getSuperType(asTypeElement(t))) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
812 |
TypeElement te = asTypeElement(t); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
813 |
if (te == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
814 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
815 |
} |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
816 |
VisibleMemberTable vmt = configuration.getVisibleMemberTable(te); |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
817 |
for (Element e : vmt.getMembers(VisibleMemberTable.Kind.METHODS)) { |
47453
b4beec6a0a25
8189845: Fix for 8157000 causes significant performance regression
ksrini
parents:
47395
diff
changeset
|
818 |
ExecutableElement ee = (ExecutableElement)e; |
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
819 |
if (configuration.workArounds.overrides(method, ee, origin) && |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
820 |
!isSimpleOverride(ee)) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
821 |
return ee; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
822 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
823 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
824 |
if (t.equals(getObjectType())) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
825 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
826 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
827 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
828 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
829 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
830 |
public SortedSet<TypeElement> getTypeElementsAsSortedSet(Iterable<TypeElement> typeElements) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
831 |
SortedSet<TypeElement> set = new TreeSet<>(makeGeneralPurposeComparator()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
832 |
for (TypeElement te : typeElements) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
833 |
set.add(te); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
834 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
835 |
return set; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
836 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
837 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
838 |
public List<? extends DocTree> getSerialDataTrees(ExecutableElement member) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
839 |
return getBlockTags(member, SERIAL_DATA); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
840 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
841 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
842 |
public FileObject getFileObject(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
843 |
return docTrees.getPath(te).getCompilationUnit().getSourceFile(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
844 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
845 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
846 |
public TypeMirror getDeclaredType(TypeElement enclosing, TypeMirror target) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
847 |
return getDeclaredType(Collections.emptyList(), enclosing, target); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
848 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
849 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
850 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
851 |
* Finds the declaration of the enclosing's type parameter. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
852 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
853 |
* @param values |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
854 |
* @param enclosing a TypeElement whose type arguments we desire |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
855 |
* @param target the TypeMirror of the type as described by the enclosing |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
856 |
* @return |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
857 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
858 |
public TypeMirror getDeclaredType(Collection<TypeMirror> values, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
859 |
TypeElement enclosing, TypeMirror target) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
860 |
TypeElement targetElement = asTypeElement(target); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
861 |
List<? extends TypeParameterElement> targetTypeArgs = targetElement.getTypeParameters(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
862 |
if (targetTypeArgs.isEmpty()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
863 |
return target; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
864 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
865 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
866 |
List<? extends TypeParameterElement> enclosingTypeArgs = enclosing.getTypeParameters(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
867 |
List<TypeMirror> targetTypeArgTypes = new ArrayList<>(targetTypeArgs.size()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
868 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
869 |
if (enclosingTypeArgs.isEmpty()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
870 |
for (TypeMirror te : values) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
871 |
List<? extends TypeMirror> typeArguments = ((DeclaredType)te).getTypeArguments(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
872 |
if (typeArguments.size() >= targetTypeArgs.size()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
873 |
for (int i = 0 ; i < targetTypeArgs.size(); i++) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
874 |
targetTypeArgTypes.add(typeArguments.get(i)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
875 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
876 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
877 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
878 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
879 |
// we found no matches in the hierarchy |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
880 |
if (targetTypeArgTypes.isEmpty()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
881 |
return target; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
882 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
883 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
884 |
if (targetTypeArgs.size() > enclosingTypeArgs.size()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
885 |
return target; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
886 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
887 |
for (int i = 0; i < targetTypeArgs.size(); i++) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
888 |
TypeParameterElement tpe = enclosingTypeArgs.get(i); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
889 |
targetTypeArgTypes.add(tpe.asType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
890 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
891 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
892 |
TypeMirror dt = typeUtils.getDeclaredType(targetElement, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
893 |
targetTypeArgTypes.toArray(new TypeMirror[targetTypeArgTypes.size()])); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
894 |
return dt; |
10 | 895 |
} |
896 |
||
897 |
/** |
|
47988
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
898 |
* Returns all the implemented super-interfaces of a given type, |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
899 |
* in the case of classes, include all the super-interfaces of |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
900 |
* the supertype. The super-interfaces are collected before the |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
901 |
* super-interfaces of the supertype. |
10 | 902 |
* |
47988
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
903 |
* @param te the type element to get the super-interfaces for. |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
904 |
* @return the list of super-interfaces. |
10 | 905 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
906 |
public Set<TypeMirror> getAllInterfaces(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
907 |
Set<TypeMirror> results = new LinkedHashSet<>(); |
47988
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
908 |
getAllInterfaces(te.asType(), results); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
909 |
return results; |
10 | 910 |
} |
911 |
||
47988
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
912 |
private void getAllInterfaces(TypeMirror type, Set<TypeMirror> results) { |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
913 |
List<? extends TypeMirror> intfacs = typeUtils.directSupertypes(type); |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
914 |
TypeMirror superType = null; |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
915 |
for (TypeMirror intfac : intfacs) { |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
916 |
if (intfac == getObjectType()) |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
917 |
continue; |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
918 |
TypeElement e = asTypeElement(intfac); |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
919 |
if (isInterface(e)) { |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
920 |
if (isPublic(e) || isLinkable(e)) |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
921 |
results.add(intfac); |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
922 |
|
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
923 |
getAllInterfaces(intfac, results); |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
924 |
} else { |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
925 |
// Save the supertype for later. |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
926 |
superType = intfac; |
10 | 927 |
} |
928 |
} |
|
47988
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
929 |
// Collect the super-interfaces of the supertype. |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
930 |
if (superType != null) |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
931 |
getAllInterfaces(superType, results); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
932 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
933 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
934 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
935 |
* Lookup for a class within this package. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
936 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
937 |
* @return TypeElement of found class, or null if not found. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
938 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
939 |
public TypeElement findClassInPackageElement(PackageElement pkg, String className) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
940 |
for (TypeElement c : getAllClasses(pkg)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
941 |
if (getSimpleName(c).equals(className)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
942 |
return c; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
943 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
944 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
945 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
946 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
947 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
948 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
949 |
* TODO: FIXME: port to javax.lang.model |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
950 |
* Find a class within the context of this class. Search order: qualified name, in this class |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
951 |
* (inner), in this package, in the class imports, in the package imports. Return the |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
952 |
* TypeElement if found, null if not found. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
953 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
954 |
//### The specified search order is not the normal rule the |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
955 |
//### compiler would use. Leave as specified or change it? |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
956 |
public TypeElement findClass(Element element, String className) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
957 |
TypeElement encl = getEnclosingTypeElement(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
958 |
TypeElement searchResult = configuration.workArounds.searchClass(encl, className); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
959 |
if (searchResult == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
960 |
encl = getEnclosingTypeElement(encl); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
961 |
//Expand search space to include enclosing class. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
962 |
while (encl != null && getEnclosingTypeElement(encl) != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
963 |
encl = getEnclosingTypeElement(encl); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
964 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
965 |
searchResult = encl == null |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
966 |
? null |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
967 |
: configuration.workArounds.searchClass(encl, className); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
968 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
969 |
return searchResult; |
10 | 970 |
} |
971 |
||
972 |
/** |
|
973 |
* Enclose in quotes, used for paths and filenames that contains spaces |
|
974 |
*/ |
|
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
25449
diff
changeset
|
975 |
public String quote(String filepath) { |
10 | 976 |
return ("\"" + filepath + "\""); |
977 |
} |
|
978 |
||
979 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
980 |
* Parse the package name. We only want to display package name up to |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
981 |
* 2 levels. |
10 | 982 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
983 |
public String parsePackageName(PackageElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
984 |
String pkgname = p.isUnnamed() ? "" : getPackageName(p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
985 |
int index = -1; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
986 |
for (int j = 0; j < MAX_CONSTANT_VALUE_INDEX_LENGTH; j++) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
987 |
index = pkgname.indexOf(".", index + 1); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
988 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
989 |
if (index != -1) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
990 |
pkgname = pkgname.substring(0, index); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
991 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
992 |
return pkgname; |
10 | 993 |
} |
994 |
||
995 |
/** |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14265
diff
changeset
|
996 |
* Given a string, replace all occurrences of 'newStr' with 'oldStr'. |
10 | 997 |
* @param originalStr the string to modify. |
998 |
* @param oldStr the string to replace. |
|
999 |
* @param newStr the string to insert in place of the old string. |
|
1000 |
*/ |
|
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
25449
diff
changeset
|
1001 |
public String replaceText(String originalStr, String oldStr, |
10 | 1002 |
String newStr) { |
1003 |
if (oldStr == null || newStr == null || oldStr.equals(newStr)) { |
|
1004 |
return originalStr; |
|
1005 |
} |
|
8631
664f84942e74
6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents:
7681
diff
changeset
|
1006 |
return originalStr.replace(oldStr, newStr); |
10 | 1007 |
} |
1008 |
||
1009 |
/** |
|
1010 |
* Given an annotation, return true if it should be documented and false |
|
1011 |
* otherwise. |
|
1012 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1013 |
* @param annotation the annotation to check. |
10 | 1014 |
* |
1015 |
* @return true return true if it should be documented and false otherwise. |
|
1016 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1017 |
public boolean isDocumentedAnnotation(TypeElement annotation) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1018 |
for (AnnotationMirror anno : annotation.getAnnotationMirrors()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1019 |
if (getFullyQualifiedName(anno.getAnnotationType().asElement()).equals( |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
1020 |
Documented.class.getName())) { |
10 | 1021 |
return true; |
1022 |
} |
|
1023 |
} |
|
1024 |
return false; |
|
1025 |
} |
|
1026 |
||
1027 |
/** |
|
51190
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1028 |
* Returns true if this class is linkable and false if we can't link to it. |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1029 |
* |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1030 |
* <p> |
10 | 1031 |
* <b>NOTE:</b> You can only link to external classes if they are public or |
1032 |
* protected. |
|
1033 |
* |
|
1034 |
* @return true if this class is linkable and false if we can't link to the |
|
1035 |
* desired class. |
|
1036 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1037 |
public boolean isLinkable(TypeElement typeElem) { |
10 | 1038 |
return |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1039 |
(typeElem != null && |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1040 |
(isIncluded(typeElem) && configuration.isGeneratedDoc(typeElem))) || |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1041 |
(configuration.extern.isExternal(typeElem) && |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1042 |
(isPublic(typeElem) || isProtected(typeElem))); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1043 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1044 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1045 |
/** |
51190
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1046 |
* Returns true if an element is linkable in the context of a given type element. |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1047 |
* |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1048 |
* If the element is a type element, it delegates to {@link #isLinkable(TypeElement)}. |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1049 |
* Otherwise, the element is linkable if any of the following are true: |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1050 |
* <ul> |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1051 |
* <li>it is "included" (see {@link jdk.javadoc.doclet}) |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1052 |
* <li>it is inherited from an undocumented supertype |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1053 |
* <li>it is a public or protected member of an external API |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1054 |
* </ul> |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1055 |
* |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1056 |
* @param typeElem the type element |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1057 |
* @param elem the element |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1058 |
* @return whether or not the element is linkable |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1059 |
*/ |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1060 |
public boolean isLinkable(TypeElement typeElem, Element elem) { |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1061 |
if (isTypeElement(elem)) { |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1062 |
return isLinkable((TypeElement) elem); // defer to existing behavior |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1063 |
} |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1064 |
|
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1065 |
if (isIncluded(elem)) { |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1066 |
return true; |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1067 |
} |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1068 |
|
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1069 |
// Allow for the behavior that members of undocumented supertypes |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1070 |
// may be included in documented types |
58477 | 1071 |
if (isUndocumentedEnclosure(getEnclosingTypeElement(elem))) { |
51190
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1072 |
return true; |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1073 |
} |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1074 |
|
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1075 |
// Allow for external members |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1076 |
return isLinkable(typeElem) |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1077 |
&& configuration.extern.isExternal(typeElem) |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1078 |
&& (isPublic(elem) || isProtected(elem)); |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1079 |
} |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1080 |
|
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50856
diff
changeset
|
1081 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1082 |
* Return this type as a {@code TypeElement} if it represents a class |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1083 |
* interface or annotation. Array dimensions are ignored. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1084 |
* If this type {@code ParameterizedType} or {@code WildcardType}, return |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1085 |
* the {@code TypeElement} of the type's erasure. If this is an |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1086 |
* annotation, return this as a {@code TypeElement}. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1087 |
* If this is a primitive type, return null. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1088 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1089 |
* @return the {@code TypeElement} of this type, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1090 |
* or null if it is a primitive type. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1091 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1092 |
public TypeElement asTypeElement(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1093 |
return new SimpleTypeVisitor9<TypeElement, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1094 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1095 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1096 |
public TypeElement visitDeclared(DeclaredType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1097 |
return (TypeElement) t.asElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1098 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1099 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1100 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1101 |
public TypeElement visitArray(ArrayType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1102 |
return visit(t.getComponentType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1103 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1104 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1105 |
@Override |
47988
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
1106 |
public TypeElement visitTypeVariable(TypeVariable t, Void p) { |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
1107 |
/* TODO, this may not be an optimimal fix. |
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
1108 |
* if we have an annotated type @DA T, then erasure returns a |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1109 |
* none, in this case we use asElement instead. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1110 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1111 |
if (isAnnotated(t)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1112 |
return visit(typeUtils.asElement(t).asType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1113 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1114 |
return visit(typeUtils.erasure(t)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1115 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1116 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1117 |
@Override |
47988
fb0b9913ff7e
8182108: javadoc makes up type variables for grandparent types
ksrini
parents:
47453
diff
changeset
|
1118 |
public TypeElement visitWildcard(WildcardType t, Void p) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1119 |
return visit(typeUtils.erasure(t)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1120 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1121 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1122 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1123 |
public TypeElement visitError(ErrorType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1124 |
return (TypeElement)t.asElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1125 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1126 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1127 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1128 |
protected TypeElement defaultAction(TypeMirror e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1129 |
return super.defaultAction(e, p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1130 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1131 |
}.visit(t); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1132 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1133 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1134 |
public TypeMirror getComponentType(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1135 |
while (isArrayType(t)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1136 |
t = ((ArrayType) t).getComponentType(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1137 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1138 |
return t; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1139 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1140 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1141 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1142 |
* Return the type's dimension information, as a string. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1143 |
* <p> |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1144 |
* For example, a two dimensional array of String returns "{@code [][]}". |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1145 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1146 |
* @return the type's dimension information as a string. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1147 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1148 |
public String getDimension(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1149 |
return new SimpleTypeVisitor9<String, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1150 |
StringBuilder dimension = new StringBuilder(""); |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1151 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1152 |
public String visitArray(ArrayType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1153 |
dimension.append("[]"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1154 |
return visit(t.getComponentType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1155 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1156 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1157 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1158 |
protected String defaultAction(TypeMirror e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1159 |
return dimension.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1160 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1161 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1162 |
}.visit(t); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1163 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1164 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1165 |
public TypeElement getSuperClass(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1166 |
if (isInterface(te) || isAnnotationType(te) || |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1167 |
te.asType().equals(getObjectType())) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1168 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1169 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1170 |
TypeMirror superclass = te.getSuperclass(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1171 |
if (isNoType(superclass) && isClass(te)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1172 |
superclass = getObjectType(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1173 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1174 |
return asTypeElement(superclass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1175 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1176 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1177 |
public TypeElement getFirstVisibleSuperClassAsTypeElement(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1178 |
if (isAnnotationType(te) || isInterface(te) || |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1179 |
te.asType().equals(getObjectType())) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1180 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1181 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1182 |
TypeMirror firstVisibleSuperClass = getFirstVisibleSuperClass(te); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1183 |
return firstVisibleSuperClass == null ? null : asTypeElement(firstVisibleSuperClass); |
10 | 1184 |
} |
1185 |
||
1186 |
/** |
|
1187 |
* Given a class, return the closest visible super class. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1188 |
* @param type the TypeMirror to be interrogated |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1189 |
* @return the closest visible super class. Return null if it cannot |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1190 |
* be found. |
10 | 1191 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1192 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1193 |
public TypeMirror getFirstVisibleSuperClass(TypeMirror type) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1194 |
return getFirstVisibleSuperClass(asTypeElement(type)); |
10 | 1195 |
} |
1196 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1197 |
|
10 | 1198 |
/** |
1199 |
* Given a class, return the closest visible super class. |
|
1200 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1201 |
* @param te the TypeElement to be interrogated |
10 | 1202 |
* @return the closest visible super class. Return null if it cannot |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1203 |
* be found.. |
10 | 1204 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1205 |
public TypeMirror getFirstVisibleSuperClass(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1206 |
TypeMirror superType = te.getSuperclass(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1207 |
if (isNoType(superType)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1208 |
superType = getObjectType(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1209 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1210 |
TypeElement superClass = asTypeElement(superType); |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1211 |
// skip "hidden" classes |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
1212 |
while ((superClass != null && hasHiddenTag(superClass)) |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1213 |
|| (superClass != null && !isPublic(superClass) && !isLinkable(superClass))) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1214 |
TypeMirror supersuperType = superClass.getSuperclass(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1215 |
TypeElement supersuperClass = asTypeElement(supersuperType); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1216 |
if (supersuperClass == null |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1217 |
|| supersuperClass.getQualifiedName().equals(superClass.getQualifiedName())) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1218 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1219 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1220 |
superType = supersuperType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1221 |
superClass = supersuperClass; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1222 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1223 |
if (te.asType().equals(superType)) { |
10 | 1224 |
return null; |
1225 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1226 |
return superType; |
10 | 1227 |
} |
1228 |
||
1229 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1230 |
* Given a TypeElement, return the name of its type (Class, Interface, etc.). |
10 | 1231 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1232 |
* @param te the TypeElement to check. |
10 | 1233 |
* @param lowerCaseOnly true if you want the name returned in lower case. |
14447
6f87132c2e54
8000612: Discrepancy between resources provided in javadoc resource files and resources required by code
jjg
parents:
14368
diff
changeset
|
1234 |
* If false, the first letter of the name is capitalized. |
10 | 1235 |
* @return |
1236 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1237 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1238 |
public String getTypeElementName(TypeElement te, boolean lowerCaseOnly) { |
10 | 1239 |
String typeName = ""; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1240 |
if (isInterface(te)) { |
10 | 1241 |
typeName = "doclet.Interface"; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1242 |
} else if (isException(te)) { |
10 | 1243 |
typeName = "doclet.Exception"; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1244 |
} else if (isError(te)) { |
10 | 1245 |
typeName = "doclet.Error"; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1246 |
} else if (isAnnotationType(te)) { |
10 | 1247 |
typeName = "doclet.AnnotationType"; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1248 |
} else if (isEnum(te)) { |
10 | 1249 |
typeName = "doclet.Enum"; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1250 |
} else if (isOrdinaryClass(te)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1251 |
typeName = "doclet.Class"; |
10 | 1252 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1253 |
typeName = lowerCaseOnly ? toLowerCase(typeName) : typeName; |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
52174
diff
changeset
|
1254 |
return typeNameMap.computeIfAbsent(typeName, resources::getText); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1255 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1256 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1257 |
private final Map<String, String> typeNameMap = new HashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1258 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1259 |
public String getTypeName(TypeMirror t, boolean fullyQualified) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1260 |
return new SimpleTypeVisitor9<String, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1261 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1262 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1263 |
public String visitArray(ArrayType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1264 |
return visit(t.getComponentType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1265 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1266 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1267 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1268 |
public String visitDeclared(DeclaredType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1269 |
TypeElement te = asTypeElement(t); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1270 |
return fullyQualified |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1271 |
? te.getQualifiedName().toString() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1272 |
: getSimpleName(te); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1273 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1274 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1275 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1276 |
public String visitExecutable(ExecutableType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1277 |
return t.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1278 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1279 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1280 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1281 |
public String visitPrimitive(PrimitiveType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1282 |
return t.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1283 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1284 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1285 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1286 |
public String visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1287 |
return getSimpleName(t.asElement()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1288 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1289 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1290 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1291 |
public String visitWildcard(javax.lang.model.type.WildcardType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1292 |
return t.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1293 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1294 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1295 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1296 |
protected String defaultAction(TypeMirror e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1297 |
return e.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1298 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1299 |
}.visit(t); |
10 | 1300 |
} |
1301 |
||
1302 |
/** |
|
17571 | 1303 |
* Replace all tabs in a string with the appropriate number of spaces. |
1304 |
* The string may be a multi-line string. |
|
1305 |
* @param text the text for which the tabs should be expanded |
|
1306 |
* @return the text with all tabs expanded |
|
10 | 1307 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1308 |
public String replaceTabs(String text) { |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
1309 |
if (!text.contains("\t")) |
17571 | 1310 |
return text; |
1311 |
||
1312 |
final int tabLength = configuration.sourcetab; |
|
1313 |
final String whitespace = configuration.tabSpaces; |
|
1314 |
final int textLength = text.length(); |
|
1315 |
StringBuilder result = new StringBuilder(textLength); |
|
1316 |
int pos = 0; |
|
1317 |
int lineLength = 0; |
|
1318 |
for (int i = 0; i < textLength; i++) { |
|
1319 |
char ch = text.charAt(i); |
|
1320 |
switch (ch) { |
|
1321 |
case '\n': case '\r': |
|
1322 |
lineLength = 0; |
|
1323 |
break; |
|
1324 |
case '\t': |
|
1325 |
result.append(text, pos, i); |
|
1326 |
int spaceCount = tabLength - lineLength % tabLength; |
|
1327 |
result.append(whitespace, 0, spaceCount); |
|
1328 |
lineLength += spaceCount; |
|
1329 |
pos = i + 1; |
|
1330 |
break; |
|
1331 |
default: |
|
1332 |
lineLength++; |
|
1333 |
} |
|
10 | 1334 |
} |
17571 | 1335 |
result.append(text, pos, textLength); |
1336 |
return result.toString(); |
|
10 | 1337 |
} |
1338 |
||
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36043
diff
changeset
|
1339 |
public CharSequence normalizeNewlines(CharSequence text) { |
19119 | 1340 |
StringBuilder sb = new StringBuilder(); |
1341 |
final int textLength = text.length(); |
|
1342 |
final String NL = DocletConstants.NL; |
|
1343 |
int pos = 0; |
|
1344 |
for (int i = 0; i < textLength; i++) { |
|
1345 |
char ch = text.charAt(i); |
|
1346 |
switch (ch) { |
|
1347 |
case '\n': |
|
1348 |
sb.append(text, pos, i); |
|
1349 |
sb.append(NL); |
|
1350 |
pos = i + 1; |
|
1351 |
break; |
|
1352 |
case '\r': |
|
1353 |
sb.append(text, pos, i); |
|
1354 |
sb.append(NL); |
|
1355 |
if (i + 1 < textLength && text.charAt(i + 1) == '\n') |
|
1356 |
i++; |
|
1357 |
pos = i + 1; |
|
1358 |
break; |
|
1359 |
} |
|
1360 |
} |
|
1361 |
sb.append(text, pos, textLength); |
|
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36043
diff
changeset
|
1362 |
return sb; |
19119 | 1363 |
} |
1364 |
||
10 | 1365 |
/** |
1366 |
* The documentation for values() and valueOf() in Enums are set by the |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1367 |
* doclet only iff the user or overridden methods are missing. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1368 |
* @param elem |
10 | 1369 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1370 |
public void setEnumDocumentation(TypeElement elem) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1371 |
for (Element e : getMethods(elem)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1372 |
ExecutableElement ee = (ExecutableElement)e; |
41452 | 1373 |
if (!getFullBody(e).isEmpty()) // ignore if already set |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1374 |
continue; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1375 |
if (ee.getSimpleName().contentEquals("values") && ee.getParameters().isEmpty()) { |
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1376 |
removeCommentHelper(ee); // purge previous entry |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
52174
diff
changeset
|
1377 |
configuration.cmtUtils.setEnumValuesTree(e); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1378 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1379 |
if (ee.getSimpleName().contentEquals("valueOf") && ee.getParameters().size() == 1) { |
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1380 |
removeCommentHelper(ee); // purge previous entry |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
52174
diff
changeset
|
1381 |
configuration.cmtUtils.setEnumValueOfTree(e); |
10 | 1382 |
} |
1383 |
} |
|
1384 |
} |
|
1385 |
||
1386 |
/** |
|
50025
caf05d64138f
8200094: Turkish locale reports NPE No enum constant com.sun.source.doctree.DocTree.Kind.SÄ°NCE
pmuthuswamy
parents:
49879
diff
changeset
|
1387 |
* Returns a locale independent upper cased String. That is, it |
caf05d64138f
8200094: Turkish locale reports NPE No enum constant com.sun.source.doctree.DocTree.Kind.SÄ°NCE
pmuthuswamy
parents:
49879
diff
changeset
|
1388 |
* always uses US locale, this is a clone of the one in StringUtils. |
caf05d64138f
8200094: Turkish locale reports NPE No enum constant com.sun.source.doctree.DocTree.Kind.SÄ°NCE
pmuthuswamy
parents:
49879
diff
changeset
|
1389 |
* @param s to convert |
caf05d64138f
8200094: Turkish locale reports NPE No enum constant com.sun.source.doctree.DocTree.Kind.SÄ°NCE
pmuthuswamy
parents:
49879
diff
changeset
|
1390 |
* @return converted String |
caf05d64138f
8200094: Turkish locale reports NPE No enum constant com.sun.source.doctree.DocTree.Kind.SÄ°NCE
pmuthuswamy
parents:
49879
diff
changeset
|
1391 |
*/ |
caf05d64138f
8200094: Turkish locale reports NPE No enum constant com.sun.source.doctree.DocTree.Kind.SÄ°NCE
pmuthuswamy
parents:
49879
diff
changeset
|
1392 |
public static String toUpperCase(String s) { |
caf05d64138f
8200094: Turkish locale reports NPE No enum constant com.sun.source.doctree.DocTree.Kind.SÄ°NCE
pmuthuswamy
parents:
49879
diff
changeset
|
1393 |
return s.toUpperCase(Locale.US); |
caf05d64138f
8200094: Turkish locale reports NPE No enum constant com.sun.source.doctree.DocTree.Kind.SÄ°NCE
pmuthuswamy
parents:
49879
diff
changeset
|
1394 |
} |
caf05d64138f
8200094: Turkish locale reports NPE No enum constant com.sun.source.doctree.DocTree.Kind.SÄ°NCE
pmuthuswamy
parents:
49879
diff
changeset
|
1395 |
|
caf05d64138f
8200094: Turkish locale reports NPE No enum constant com.sun.source.doctree.DocTree.Kind.SÄ°NCE
pmuthuswamy
parents:
49879
diff
changeset
|
1396 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1397 |
* Returns a locale independent lower cased String. That is, it |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1398 |
* always uses US locale, this is a clone of the one in StringUtils. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1399 |
* @param s to convert |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1400 |
* @return converted String |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1401 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1402 |
public static String toLowerCase(String s) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1403 |
return s.toLowerCase(Locale.US); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1404 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1405 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1406 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1407 |
* Return true if the given Element is deprecated. |
10 | 1408 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1409 |
* @param e the Element to check. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1410 |
* @return true if the given Element is deprecated. |
10 | 1411 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1412 |
public boolean isDeprecated(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1413 |
if (isPackage(e)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1414 |
return configuration.workArounds.isDeprecated0(e); |
10 | 1415 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1416 |
return elementUtils.isDeprecated(e); |
10 | 1417 |
} |
15385 | 1418 |
|
1419 |
/** |
|
42816
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1420 |
* Return true if the given Element is deprecated for removal. |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1421 |
* |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1422 |
* @param e the Element to check. |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1423 |
* @return true if the given Element is deprecated for removal. |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1424 |
*/ |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1425 |
public boolean isDeprecatedForRemoval(Element e) { |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1426 |
List<? extends AnnotationMirror> annotationList = e.getAnnotationMirrors(); |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1427 |
JavacTypes jctypes = ((DocEnvImpl) configuration.docEnv).toolEnv.typeutils; |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1428 |
for (AnnotationMirror anno : annotationList) { |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1429 |
if (jctypes.isSameType(anno.getAnnotationType().asElement().asType(), getDeprecatedType())) { |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1430 |
Map<? extends ExecutableElement, ? extends AnnotationValue> pairs = anno.getElementValues(); |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1431 |
if (!pairs.isEmpty()) { |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1432 |
for (ExecutableElement element : pairs.keySet()) { |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1433 |
if (element.getSimpleName().contentEquals("forRemoval")) { |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1434 |
return Boolean.parseBoolean((pairs.get(element)).toString()); |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1435 |
} |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1436 |
} |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1437 |
} |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1438 |
} |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1439 |
} |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1440 |
return false; |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1441 |
} |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1442 |
|
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42277
diff
changeset
|
1443 |
/** |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1444 |
* A convenience method to get property name from the name of the |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1445 |
* getter or setter method. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1446 |
* @param e the input method. |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1447 |
* @return the name of the property of the given setter of getter. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1448 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1449 |
public String propertyName(ExecutableElement e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1450 |
String name = getSimpleName(e); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1451 |
String propertyName = null; |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1452 |
if (name.startsWith("get") || name.startsWith("set")) { |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1453 |
propertyName = name.substring(3); |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1454 |
} else if (name.startsWith("is")) { |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1455 |
propertyName = name.substring(2); |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1456 |
} |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1457 |
if ((propertyName == null) || propertyName.isEmpty()){ |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1458 |
return ""; |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1459 |
} |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19667
diff
changeset
|
1460 |
return propertyName.substring(0, 1).toLowerCase(configuration.getLocale()) |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1461 |
+ propertyName.substring(1); |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1462 |
} |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1463 |
|
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1464 |
/** |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1465 |
* Returns true if the element is included, contains @hidden tag, |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1466 |
* or if javafx flag is present and element contains @treatAsPrivate |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1467 |
* tag. |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1468 |
* @param e the queried element |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1469 |
* @return true if it exists, false otherwise |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1470 |
*/ |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
1471 |
public boolean hasHiddenTag(Element e) { |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1472 |
// prevent needless tests on elements which are not included |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1473 |
if (!isIncluded(e)) { |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1474 |
return false; |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1475 |
} |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1476 |
if (configuration.javafx && |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1477 |
hasBlockTag(e, DocTree.Kind.UNKNOWN_BLOCK_TAG, "treatAsPrivate")) { |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1478 |
return true; |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1479 |
} |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1480 |
return hasBlockTag(e, DocTree.Kind.HIDDEN); |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1481 |
} |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1482 |
|
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1483 |
/** |
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1484 |
* Returns true if the method has no comments, or a lone @inheritDoc. |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1485 |
* @param m a method |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1486 |
* @return true if there are no comments, false otherwise |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1487 |
*/ |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1488 |
public boolean isSimpleOverride(ExecutableElement m) { |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1489 |
if (!configuration.summarizeOverriddenMethods || |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1490 |
!isIncluded(m)) { |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1491 |
return false; |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1492 |
} |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1493 |
|
52174
8f93292c2a51
8211901: javadoc generates broken links on deprecated items page
pmuthuswamy
parents:
52144
diff
changeset
|
1494 |
if (!getBlockTags(m).isEmpty() || isDeprecated(m)) |
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1495 |
return false; |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1496 |
|
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1497 |
List<? extends DocTree> fullBody = getFullBody(m); |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1498 |
return fullBody.isEmpty() || |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1499 |
(fullBody.size() == 1 && fullBody.get(0).getKind().equals(Kind.INHERIT_DOC)); |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1500 |
} |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1501 |
|
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47299
diff
changeset
|
1502 |
/** |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1503 |
* In case of JavaFX mode on, filters out classes that are private, |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1504 |
* package private, these are not documented in JavaFX mode, also |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1505 |
* remove those classes that have @hidden or @treatAsPrivate comment tag. |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1506 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1507 |
* @param classlist a collection of TypeElements |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1508 |
* @param javafx set to true if in JavaFX mode. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1509 |
* @return list of filtered classes. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1510 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1511 |
public SortedSet<TypeElement> filterOutPrivateClasses(Iterable<TypeElement> classlist, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1512 |
boolean javafx) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1513 |
SortedSet<TypeElement> filteredOutClasses = |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1514 |
new TreeSet<>(makeGeneralPurposeComparator()); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1515 |
if (!javafx) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1516 |
for (Element te : classlist) { |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
1517 |
if (!hasHiddenTag(te)) { |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1518 |
filteredOutClasses.add((TypeElement)te); |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
1519 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1520 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1521 |
return filteredOutClasses; |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1522 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1523 |
for (Element e : classlist) { |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
1524 |
if (isPrivate(e) || isPackagePrivate(e) || hasHiddenTag(e)) { |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1525 |
continue; |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1526 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1527 |
filteredOutClasses.add((TypeElement)e); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1528 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1529 |
return filteredOutClasses; |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1530 |
} |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1531 |
|
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15385
diff
changeset
|
1532 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1533 |
* Compares two elements. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1534 |
* @param e1 first Element |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1535 |
* @param e2 second Element |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1536 |
* @return a true if they are the same, false otherwise. |
15385 | 1537 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1538 |
public boolean elementsEqual(Element e1, Element e2) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1539 |
if (e1.getKind() != e2.getKind()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1540 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1541 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1542 |
String s1 = getSimpleName(e1); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1543 |
String s2 = getSimpleName(e2); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1544 |
if (compareStrings(s1, s2) == 0) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1545 |
String f1 = getFullyQualifiedName(e1, true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1546 |
String f2 = getFullyQualifiedName(e2, true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1547 |
return compareStrings(f1, f2) == 0; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1548 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1549 |
return false; |
15385 | 1550 |
} |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1551 |
|
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1552 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1553 |
* A general purpose case insensitive String comparator, which compares |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1554 |
* two Strings using a Collator strength of "TERTIARY". |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1555 |
* |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1556 |
* @param s1 first String to compare. |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1557 |
* @param s2 second String to compare. |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1558 |
* @return a negative integer, zero, or a positive integer as the first |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1559 |
* argument is less than, equal to, or greater than the second. |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1560 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1561 |
public int compareStrings(String s1, String s2) { |
25004
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1562 |
return compareStrings(true, s1, s2); |
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1563 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1564 |
|
25004
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1565 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1566 |
* A general purpose case sensitive String comparator, which |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1567 |
* compares two Strings using a Collator strength of "SECONDARY". |
25004
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1568 |
* |
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1569 |
* @param s1 first String to compare. |
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1570 |
* @param s2 second String to compare. |
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1571 |
* @return a negative integer, zero, or a positive integer as the first |
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1572 |
* argument is less than, equal to, or greater than the second. |
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1573 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1574 |
public int compareCaseCompare(String s1, String s2) { |
25004
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1575 |
return compareStrings(false, s1, s2); |
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1576 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1577 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1578 |
private DocCollator tertiaryCollator = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1579 |
private DocCollator secondaryCollator = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1580 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1581 |
private int compareStrings(boolean caseSensitive, String s1, String s2) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1582 |
if (caseSensitive) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1583 |
if (tertiaryCollator == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1584 |
tertiaryCollator = new DocCollator(configuration.locale, Collator.TERTIARY); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1585 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1586 |
return tertiaryCollator.compare(s1, s2); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1587 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1588 |
if (secondaryCollator == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1589 |
secondaryCollator = new DocCollator(configuration.locale, Collator.SECONDARY); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1590 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1591 |
return secondaryCollator.compare(s1, s2); |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1592 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1593 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1594 |
private static class DocCollator { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1595 |
private final Map<String, CollationKey> keys; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1596 |
private final Collator instance; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1597 |
private final int MAX_SIZE = 1000; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1598 |
private DocCollator(Locale locale, int strength) { |
52144
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1599 |
instance = createCollator(locale); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1600 |
instance.setStrength(strength); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1601 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1602 |
keys = new LinkedHashMap<String, CollationKey>(MAX_SIZE + 1, 0.75f, true) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1603 |
private static final long serialVersionUID = 1L; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1604 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1605 |
protected boolean removeEldestEntry(Entry<String, CollationKey> eldest) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1606 |
return size() > MAX_SIZE; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1607 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1608 |
}; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1609 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1610 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1611 |
CollationKey getKey(String s) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1612 |
return keys.computeIfAbsent(s, instance :: getCollationKey); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1613 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1614 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1615 |
public int compare(String s1, String s2) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1616 |
return getKey(s1).compareTo(getKey(s2)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1617 |
} |
52144
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1618 |
|
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1619 |
private Collator createCollator(Locale locale) { |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1620 |
Collator baseCollator = Collator.getInstance(locale); |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1621 |
if (baseCollator instanceof RuleBasedCollator) { |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1622 |
// Extend collator to sort signatures with additional args and var-args in a well-defined order: |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1623 |
// () < (int) < (int, int) < (int...) |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1624 |
try { |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1625 |
return new RuleBasedCollator(((RuleBasedCollator) baseCollator).getRules() |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1626 |
+ "& ')' < ',' < '.','['"); |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1627 |
} catch (ParseException e) { |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1628 |
throw new RuntimeException(e); |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1629 |
} |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1630 |
} |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1631 |
return baseCollator; |
f53671e05660
8210683: Search result display order reversed for overloaded entries
hannesw
parents:
51190
diff
changeset
|
1632 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1633 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1634 |
|
46078 | 1635 |
private Comparator<Element> moduleComparator = null; |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25874
diff
changeset
|
1636 |
/** |
36526 | 1637 |
* Comparator for ModuleElements, simply compares the fully qualified names |
37752
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1638 |
* @return a Comparator |
36526 | 1639 |
*/ |
1640 |
public Comparator<Element> makeModuleComparator() { |
|
46078 | 1641 |
if (moduleComparator == null) { |
1642 |
moduleComparator = new Utils.ElementComparator() { |
|
1643 |
@Override |
|
1644 |
public int compare(Element mod1, Element mod2) { |
|
1645 |
return compareFullyQualifiedNames(mod1, mod2); |
|
1646 |
} |
|
1647 |
}; |
|
1648 |
} |
|
1649 |
return moduleComparator; |
|
36526 | 1650 |
} |
1651 |
||
46078 | 1652 |
private Comparator<Element> allClassesComparator = null; |
36526 | 1653 |
/** |
37752
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1654 |
* Returns a Comparator for all classes, compares the simple names of |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1655 |
* TypeElement, if equal then the fully qualified names. |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1656 |
* |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1657 |
* @return Comparator |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1658 |
*/ |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1659 |
public Comparator<Element> makeAllClassesComparator() { |
46078 | 1660 |
if (allClassesComparator == null) { |
1661 |
allClassesComparator = new Utils.ElementComparator() { |
|
1662 |
@Override |
|
1663 |
public int compare(Element e1, Element e2) { |
|
1664 |
int result = compareNames(e1, e2); |
|
1665 |
if (result == 0) |
|
1666 |
result = compareFullyQualifiedNames(e1, e2); |
|
1667 |
||
1668 |
return result; |
|
1669 |
} |
|
1670 |
}; |
|
1671 |
} |
|
1672 |
return allClassesComparator; |
|
37752
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1673 |
} |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1674 |
|
46078 | 1675 |
private Comparator<Element> packageComparator = null; |
37752
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1676 |
/** |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1677 |
* Returns a Comparator for packages, by comparing the fully qualified names. |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1678 |
* |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1679 |
* @return a Comparator |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1680 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1681 |
public Comparator<Element> makePackageComparator() { |
46078 | 1682 |
if (packageComparator == null) { |
1683 |
packageComparator = new Utils.ElementComparator() { |
|
1684 |
@Override |
|
1685 |
public int compare(Element pkg1, Element pkg2) { |
|
1686 |
return compareFullyQualifiedNames(pkg1, pkg2); |
|
1687 |
} |
|
1688 |
}; |
|
1689 |
} |
|
1690 |
return packageComparator; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1691 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1692 |
|
47299 | 1693 |
private Comparator<Element> deprecatedComparator = null; |
1694 |
/** |
|
1695 |
* Returns a Comparator for deprecated items listed on deprecated list page, by comparing the |
|
1696 |
* fully qualified names. |
|
1697 |
* |
|
1698 |
* @return a Comparator |
|
1699 |
*/ |
|
1700 |
public Comparator<Element> makeDeprecatedComparator() { |
|
1701 |
if (deprecatedComparator == null) { |
|
1702 |
deprecatedComparator = new Utils.ElementComparator() { |
|
1703 |
@Override |
|
1704 |
public int compare(Element e1, Element e2) { |
|
1705 |
return compareFullyQualifiedNames(e1, e2); |
|
1706 |
} |
|
1707 |
}; |
|
1708 |
} |
|
1709 |
return deprecatedComparator; |
|
1710 |
} |
|
1711 |
||
46078 | 1712 |
private Comparator<SerialFieldTree> serialFieldTreeComparator = null; |
37752
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1713 |
/** |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1714 |
* Returns a Comparator for SerialFieldTree. |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1715 |
* @return a Comparator |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1716 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1717 |
public Comparator<SerialFieldTree> makeSerialFieldTreeComparator() { |
46078 | 1718 |
if (serialFieldTreeComparator == null) { |
1719 |
serialFieldTreeComparator = (SerialFieldTree o1, SerialFieldTree o2) -> { |
|
1720 |
String s1 = o1.getName().toString(); |
|
1721 |
String s2 = o2.getName().toString(); |
|
1722 |
return s1.compareTo(s2); |
|
1723 |
}; |
|
1724 |
} |
|
1725 |
return serialFieldTreeComparator; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1726 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1727 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1728 |
/** |
37752
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1729 |
* Returns a general purpose comparator. |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1730 |
* @return a Comparator |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25874
diff
changeset
|
1731 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1732 |
public Comparator<Element> makeGeneralPurposeComparator() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1733 |
return makeClassUseComparator(); |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25874
diff
changeset
|
1734 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1735 |
|
46078 | 1736 |
private Comparator<Element> overrideUseComparator = null; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1737 |
/** |
37752
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1738 |
* Returns a Comparator for overrides and implements, |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1739 |
* used primarily on methods, compares the name first, |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1740 |
* then compares the simple names of the enclosing |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1741 |
* TypeElement and the fully qualified name of the enclosing TypeElement. |
4243173b58db
8155061: javadoc incorrectly sorted items in All Classes list and Index files
ksrini
parents:
37009
diff
changeset
|
1742 |
* @return a Comparator |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1743 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1744 |
public Comparator<Element> makeOverrideUseComparator() { |
46078 | 1745 |
if (overrideUseComparator == null) { |
1746 |
overrideUseComparator = new Utils.ElementComparator() { |
|
1747 |
@Override |
|
1748 |
public int compare(Element o1, Element o2) { |
|
1749 |
int result = compareStrings(getSimpleName(o1), getSimpleName(o2)); |
|
1750 |
if (result != 0) { |
|
1751 |
return result; |
|
1752 |
} |
|
1753 |
if (!isTypeElement(o1) && !isTypeElement(o2) && !isPackage(o1) && !isPackage(o2)) { |
|
1754 |
TypeElement t1 = getEnclosingTypeElement(o1); |
|
1755 |
TypeElement t2 = getEnclosingTypeElement(o2); |
|
1756 |
result = compareStrings(getSimpleName(t1), getSimpleName(t2)); |
|
1757 |
if (result != 0) |
|
1758 |
return result; |
|
1759 |
} |
|
1760 |
result = compareStrings(getFullyQualifiedName(o1), getFullyQualifiedName(o2)); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1761 |
if (result != 0) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1762 |
return result; |
46078 | 1763 |
return compareElementTypeKinds(o1, o2); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1764 |
} |
46078 | 1765 |
}; |
1766 |
} |
|
1767 |
return overrideUseComparator; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1768 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1769 |
|
46078 | 1770 |
private Comparator<Element> indexUseComparator = null; |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1771 |
/** |
46078 | 1772 |
* Returns a Comparator for index file presentations, and are sorted as follows. |
1773 |
* If comparing modules and/or packages then simply compare the qualified names, |
|
1774 |
* if comparing a module or a package with a type/member then compare the |
|
1775 |
* FullyQualifiedName of the module or a package with the SimpleName of the entity, |
|
1776 |
* otherwise: |
|
43570
c7b68caf3ab4
8169813: The index pages are sorted in a confusing manner
bpatel
parents:
43261
diff
changeset
|
1777 |
* 1. compare the ElementKind ex: Module, Package, Interface etc. |
c7b68caf3ab4
8169813: The index pages are sorted in a confusing manner
bpatel
parents:
43261
diff
changeset
|
1778 |
* 2a. if equal and if the type is of ExecutableElement(Constructor, Methods), |
25449
3c14a2e16bd6
8049393: [javadoc] parameters are not sorted correctly
ksrini
parents:
25300
diff
changeset
|
1779 |
* a case insensitive comparison of parameter the type signatures |
43570
c7b68caf3ab4
8169813: The index pages are sorted in a confusing manner
bpatel
parents:
43261
diff
changeset
|
1780 |
* 2b. if equal, case sensitive comparison of the type signatures |
c7b68caf3ab4
8169813: The index pages are sorted in a confusing manner
bpatel
parents:
43261
diff
changeset
|
1781 |
* 3. finally, if equal, compare the FQNs of the entities |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1782 |
* @return a comparator for index file use |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1783 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1784 |
public Comparator<Element> makeIndexUseComparator() { |
46078 | 1785 |
if (indexUseComparator == null) { |
1786 |
indexUseComparator = new Utils.ElementComparator() { |
|
1787 |
/** |
|
1788 |
* Compares two elements. |
|
1789 |
* |
|
1790 |
* @param e1 - an element. |
|
1791 |
* @param e2 - an element. |
|
1792 |
* @return a negative integer, zero, or a positive integer as the first |
|
1793 |
* argument is less than, equal to, or greater than the second. |
|
1794 |
*/ |
|
1795 |
@Override |
|
1796 |
public int compare(Element e1, Element e2) { |
|
1797 |
int result; |
|
1798 |
// first, compare names as appropriate |
|
1799 |
if ((isModule(e1) || isPackage(e1)) && (isModule(e2) || isPackage(e2))) { |
|
1800 |
result = compareFullyQualifiedNames(e1, e2); |
|
1801 |
} else if (isModule(e1) || isPackage(e1)) { |
|
1802 |
result = compareStrings(getFullyQualifiedName(e1), getSimpleName(e2)); |
|
1803 |
} else if (isModule(e2) || isPackage(e2)) { |
|
1804 |
result = compareStrings(getSimpleName(e1), getFullyQualifiedName(e2)); |
|
1805 |
} else { |
|
1806 |
result = compareNames(e1, e2); |
|
1807 |
} |
|
45771
e447c20c3ff9
8182736: javadoc generates bad names and broken module graph links
jjg
parents:
44385
diff
changeset
|
1808 |
if (result != 0) { |
e447c20c3ff9
8182736: javadoc generates bad names and broken module graph links
jjg
parents:
44385
diff
changeset
|
1809 |
return result; |
e447c20c3ff9
8182736: javadoc generates bad names and broken module graph links
jjg
parents:
44385
diff
changeset
|
1810 |
} |
46078 | 1811 |
// if names are the same, compare element kinds |
1812 |
result = compareElementTypeKinds(e1, e2); |
|
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1813 |
if (result != 0) { |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1814 |
return result; |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1815 |
} |
46078 | 1816 |
// if element kinds are the same, and are methods, |
1817 |
// compare the method parameters |
|
1818 |
if (hasParameters(e1)) { |
|
1819 |
List<? extends VariableElement> parameters1 = ((ExecutableElement)e1).getParameters(); |
|
1820 |
List<? extends VariableElement> parameters2 = ((ExecutableElement)e2).getParameters(); |
|
1821 |
result = compareParameters(false, parameters1, parameters2); |
|
1822 |
if (result != 0) { |
|
1823 |
return result; |
|
1824 |
} |
|
1825 |
result = compareParameters(true, parameters1, parameters2); |
|
1826 |
if (result != 0) { |
|
1827 |
return result; |
|
1828 |
} |
|
25300
3b8a5067fe29
8047162: [javadoc] index files are non deterministic
ksrini
parents:
25004
diff
changeset
|
1829 |
} |
46078 | 1830 |
// else fall back on fully qualified names |
1831 |
return compareFullyQualifiedNames(e1, e2); |
|
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1832 |
} |
46078 | 1833 |
}; |
1834 |
} |
|
1835 |
return indexUseComparator; |
|
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1836 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1837 |
|
46078 | 1838 |
private Comparator<TypeMirror> typeMirrorClassUseComparator = null; |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1839 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1840 |
* Compares the FullyQualifiedNames of two TypeMirrors |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1841 |
* @return |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
1842 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1843 |
public Comparator<TypeMirror> makeTypeMirrorClassUseComparator() { |
46078 | 1844 |
if (typeMirrorClassUseComparator == null) { |
1845 |
typeMirrorClassUseComparator = (TypeMirror type1, TypeMirror type2) -> { |
|
1846 |
String s1 = getQualifiedTypeName(type1); |
|
1847 |
String s2 = getQualifiedTypeName(type2); |
|
1848 |
return compareStrings(s1, s2); |
|
1849 |
}; |
|
1850 |
} |
|
1851 |
return typeMirrorClassUseComparator; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1852 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1853 |
|
46078 | 1854 |
private Comparator<TypeMirror> typeMirrorIndexUseComparator = null; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1855 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1856 |
* Compares the SimpleNames of TypeMirrors if equal then the |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1857 |
* FullyQualifiedNames of TypeMirrors. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1858 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1859 |
* @return |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1860 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1861 |
public Comparator<TypeMirror> makeTypeMirrorIndexUseComparator() { |
46078 | 1862 |
if (typeMirrorIndexUseComparator == null) { |
1863 |
typeMirrorIndexUseComparator = (TypeMirror t1, TypeMirror t2) -> { |
|
1864 |
int result = compareStrings(getTypeName(t1, false), getTypeName(t2, false)); |
|
1865 |
if (result != 0) |
|
1866 |
return result; |
|
1867 |
return compareStrings(getQualifiedTypeName(t1), getQualifiedTypeName(t2)); |
|
1868 |
}; |
|
1869 |
} |
|
1870 |
return typeMirrorIndexUseComparator; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1871 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1872 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1873 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1874 |
* Get the qualified type name of a TypeMiror compatible with the Element's |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1875 |
* getQualified name, returns the qualified name of the Reference type |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1876 |
* otherwise the primitive name. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1877 |
* @param t the type whose name is to be obtained. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1878 |
* @return the fully qualified name of Reference type or the primitive name |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1879 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1880 |
public String getQualifiedTypeName(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1881 |
return new SimpleTypeVisitor9<String, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1882 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1883 |
public String visitDeclared(DeclaredType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1884 |
return getFullyQualifiedName(t.asElement()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1885 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1886 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1887 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1888 |
public String visitArray(ArrayType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1889 |
return visit(t.getComponentType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1890 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1891 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1892 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1893 |
public String visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1894 |
// The knee jerk reaction is to do this but don't!, as we would like |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1895 |
// it to be compatible with the old world, now if we decide to do so |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1896 |
// care must be taken to avoid collisions. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1897 |
// return getFullyQualifiedName(t.asElement()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1898 |
return t.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1899 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1900 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
1901 |
@Override |
43868
cdf2965de35b
8173804: javadoc throws UnsupportedOperationException: should not happen
ksrini
parents:
43570
diff
changeset
|
1902 |
protected String defaultAction(TypeMirror t, Void p) { |
cdf2965de35b
8173804: javadoc throws UnsupportedOperationException: should not happen
ksrini
parents:
43570
diff
changeset
|
1903 |
return t.toString(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1904 |
} |
43868
cdf2965de35b
8173804: javadoc throws UnsupportedOperationException: should not happen
ksrini
parents:
43570
diff
changeset
|
1905 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1906 |
}.visit(t); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1907 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1908 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1909 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1910 |
* A generic utility which returns the fully qualified names of an entity, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1911 |
* if the entity is not qualifiable then its enclosing entity, it is upto |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1912 |
* the caller to add the elements name as required. |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36043
diff
changeset
|
1913 |
* @param e the element to get FQN for. |
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36043
diff
changeset
|
1914 |
* @return the name |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1915 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1916 |
public String getFullyQualifiedName(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1917 |
return getFullyQualifiedName(e, true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1918 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1919 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1920 |
public String getFullyQualifiedName(Element e, final boolean outer) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1921 |
return new SimpleElementVisitor9<String, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1922 |
@Override |
45771
e447c20c3ff9
8182736: javadoc generates bad names and broken module graph links
jjg
parents:
44385
diff
changeset
|
1923 |
public String visitModule(ModuleElement e, Void p) { |
e447c20c3ff9
8182736: javadoc generates bad names and broken module graph links
jjg
parents:
44385
diff
changeset
|
1924 |
return e.getQualifiedName().toString(); |
e447c20c3ff9
8182736: javadoc generates bad names and broken module graph links
jjg
parents:
44385
diff
changeset
|
1925 |
} |
e447c20c3ff9
8182736: javadoc generates bad names and broken module graph links
jjg
parents:
44385
diff
changeset
|
1926 |
|
e447c20c3ff9
8182736: javadoc generates bad names and broken module graph links
jjg
parents:
44385
diff
changeset
|
1927 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1928 |
public String visitPackage(PackageElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1929 |
return e.getQualifiedName().toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1930 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1931 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1932 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1933 |
public String visitType(TypeElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1934 |
return e.getQualifiedName().toString(); |
25004
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
1935 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1936 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1937 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1938 |
protected String defaultAction(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1939 |
return outer ? visit(e.getEnclosingElement()) : e.getSimpleName().toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1940 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1941 |
}.visit(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1942 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1943 |
|
46078 | 1944 |
private Comparator<Element> classUseComparator = null; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1945 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1946 |
* Comparator for ClassUse presentations, and sorts as follows: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1947 |
* 1. member names |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1948 |
* 2. then fully qualified member names |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1949 |
* 3. then parameter types if applicable |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1950 |
* 4. finally the element kinds ie. package, class, interface etc. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1951 |
* @return a comparator to sort classes and members for class use |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1952 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1953 |
public Comparator<Element> makeClassUseComparator() { |
46078 | 1954 |
if (classUseComparator == null) { |
1955 |
classUseComparator = new Utils.ElementComparator() { |
|
1956 |
/** |
|
1957 |
* Compares two Elements. |
|
1958 |
* |
|
1959 |
* @param e1 - an element. |
|
1960 |
* @param e2 - an element. |
|
1961 |
* @return a negative integer, zero, or a positive integer as the first |
|
1962 |
* argument is less than, equal to, or greater than the second. |
|
1963 |
*/ |
|
1964 |
@Override |
|
1965 |
public int compare(Element e1, Element e2) { |
|
1966 |
int result = compareNames(e1, e2); |
|
1967 |
if (result != 0) { |
|
1968 |
return result; |
|
1969 |
} |
|
1970 |
result = compareFullyQualifiedNames(e1, e2); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1971 |
if (result != 0) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1972 |
return result; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1973 |
} |
46078 | 1974 |
if (hasParameters(e1) && hasParameters(e2)) { |
1975 |
@SuppressWarnings("unchecked") |
|
1976 |
List<VariableElement> parameters1 = (List<VariableElement>)((ExecutableElement)e1).getParameters(); |
|
1977 |
@SuppressWarnings("unchecked") |
|
1978 |
List<VariableElement> parameters2 = (List<VariableElement>)((ExecutableElement)e2).getParameters(); |
|
1979 |
result = compareParameters(false, parameters1, parameters2); |
|
1980 |
if (result != 0) { |
|
1981 |
return result; |
|
1982 |
} |
|
1983 |
result = compareParameters(true, parameters1, parameters2); |
|
1984 |
} |
|
1985 |
if (result != 0) { |
|
1986 |
return result; |
|
1987 |
} |
|
1988 |
return compareElementTypeKinds(e1, e2); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1989 |
} |
46078 | 1990 |
}; |
1991 |
} |
|
1992 |
return classUseComparator; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1993 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1994 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1995 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1996 |
* A general purpose comparator to sort Element entities, basically provides the building blocks |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1997 |
* for creating specific comparators for an use-case. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
1998 |
*/ |
46078 | 1999 |
private abstract class ElementComparator implements Comparator<Element> { |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2000 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2001 |
* compares two parameter arrays by first comparing the length of the arrays, and |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2002 |
* then each Type of the parameter in the array. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2003 |
* @param params1 the first parameter array. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2004 |
* @param params2 the first parameter array. |
25004
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
2005 |
* @return a negative integer, zero, or a positive integer as the first |
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
2006 |
* argument is less than, equal to, or greater than the second. |
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
2007 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2008 |
final EnumMap<ElementKind, Integer> elementKindOrder; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2009 |
public ElementComparator() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2010 |
elementKindOrder = new EnumMap<>(ElementKind.class); |
40511 | 2011 |
elementKindOrder.put(ElementKind.MODULE, 0); |
2012 |
elementKindOrder.put(ElementKind.PACKAGE, 1); |
|
2013 |
elementKindOrder.put(ElementKind.CLASS, 2); |
|
2014 |
elementKindOrder.put(ElementKind.ENUM, 3); |
|
2015 |
elementKindOrder.put(ElementKind.ENUM_CONSTANT, 4); |
|
2016 |
elementKindOrder.put(ElementKind.INTERFACE, 5); |
|
2017 |
elementKindOrder.put(ElementKind.ANNOTATION_TYPE, 6); |
|
2018 |
elementKindOrder.put(ElementKind.FIELD, 7); |
|
2019 |
elementKindOrder.put(ElementKind.CONSTRUCTOR, 8); |
|
2020 |
elementKindOrder.put(ElementKind.METHOD, 9); |
|
25004
b33effe4f252
8042829: [javadoc] index-file output is not sorted correctly
ksrini
parents:
24394
diff
changeset
|
2021 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2022 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2023 |
protected int compareParameters(boolean caseSensitive, List<? extends VariableElement> params1, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2024 |
List<? extends VariableElement> params2) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2025 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2026 |
return compareStrings(caseSensitive, getParametersAsString(params1), |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2027 |
getParametersAsString(params2)); |
25449
3c14a2e16bd6
8049393: [javadoc] parameters are not sorted correctly
ksrini
parents:
25300
diff
changeset
|
2028 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2029 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2030 |
String getParametersAsString(List<? extends VariableElement> params) { |
25449
3c14a2e16bd6
8049393: [javadoc] parameters are not sorted correctly
ksrini
parents:
25300
diff
changeset
|
2031 |
StringBuilder sb = new StringBuilder(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2032 |
for (VariableElement param : params) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2033 |
TypeMirror t = param.asType(); |
25449
3c14a2e16bd6
8049393: [javadoc] parameters are not sorted correctly
ksrini
parents:
25300
diff
changeset
|
2034 |
// prefix P for primitive and R for reference types, thus items will |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2035 |
// be ordered lexically and correctly. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2036 |
sb.append(getTypeCode(t)).append("-").append(t).append("-"); |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2037 |
} |
25449
3c14a2e16bd6
8049393: [javadoc] parameters are not sorted correctly
ksrini
parents:
25300
diff
changeset
|
2038 |
return sb.toString(); |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2039 |
} |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2040 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2041 |
private String getTypeCode(TypeMirror t) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2042 |
return new SimpleTypeVisitor9<String, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2043 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2044 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2045 |
public String visitPrimitive(PrimitiveType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2046 |
return "P"; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2047 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2048 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2049 |
public String visitArray(ArrayType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2050 |
return visit(t.getComponentType()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2051 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2052 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2053 |
protected String defaultAction(TypeMirror e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2054 |
return "R"; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2055 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2056 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2057 |
}.visit(t); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2058 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2059 |
|
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2060 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2061 |
* Compares two Elements, typically the name of a method, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2062 |
* field or constructor. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2063 |
* @param e1 the first Element. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2064 |
* @param e2 the second Element. |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2065 |
* @return a negative integer, zero, or a positive integer as the first |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2066 |
* argument is less than, equal to, or greater than the second. |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2067 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2068 |
protected int compareNames(Element e1, Element e2) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2069 |
return compareStrings(getSimpleName(e1), getSimpleName(e2)); |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2070 |
} |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2071 |
|
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2072 |
/** |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2073 |
* Compares the fully qualified names of the entities |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2074 |
* @param e1 the first Element. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2075 |
* @param e2 the first Element. |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2076 |
* @return a negative integer, zero, or a positive integer as the first |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2077 |
* argument is less than, equal to, or greater than the second. |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
2078 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2079 |
protected int compareFullyQualifiedNames(Element e1, Element e2) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2080 |
// add simplename to be compatible |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2081 |
String thisElement = getFullyQualifiedName(e1); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2082 |
String thatElement = getFullyQualifiedName(e2); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2083 |
return compareStrings(thisElement, thatElement); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2084 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2085 |
protected int compareElementTypeKinds(Element e1, Element e2) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2086 |
return Integer.compare(elementKindOrder.get(e1.getKind()), |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2087 |
elementKindOrder.get(e2.getKind())); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2088 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2089 |
boolean hasParameters(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2090 |
return new SimpleElementVisitor9<Boolean, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2091 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2092 |
public Boolean visitExecutable(ExecutableElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2093 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2094 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2095 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2096 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2097 |
protected Boolean defaultAction(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2098 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2099 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2100 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2101 |
}.visit(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2102 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2103 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2104 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2105 |
* The fully qualified names of the entities, used solely by the comparator. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2106 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2107 |
* @return a negative integer, zero, or a positive integer as the first argument is less |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2108 |
* than, equal to, or greater than the second. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2109 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2110 |
private String getFullyQualifiedName(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2111 |
return new SimpleElementVisitor9<String, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2112 |
@Override |
36526 | 2113 |
public String visitModule(ModuleElement e, Void p) { |
2114 |
return e.getQualifiedName().toString(); |
|
2115 |
} |
|
2116 |
||
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2117 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2118 |
public String visitPackage(PackageElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2119 |
return e.getQualifiedName().toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2120 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2121 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2122 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2123 |
public String visitExecutable(ExecutableElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2124 |
// For backward compatibility |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2125 |
return getFullyQualifiedName(e.getEnclosingElement()) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2126 |
+ "." + e.getSimpleName().toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2127 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2128 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2129 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2130 |
public String visitType(TypeElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2131 |
return e.getQualifiedName().toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2132 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2133 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2134 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2135 |
protected String defaultAction(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2136 |
return getEnclosingTypeElement(e).getQualifiedName().toString() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2137 |
+ "." + e.getSimpleName().toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2138 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2139 |
}.visit(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2140 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2141 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2142 |
|
50856
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2143 |
/** |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2144 |
* Returns a Comparator for SearchIndexItems representing types. Items are |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2145 |
* compared by short name, or full string representation if names are equal. |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2146 |
* |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2147 |
* @return a Comparator |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2148 |
*/ |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2149 |
public Comparator<SearchIndexItem> makeTypeSearchIndexComparator() { |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2150 |
return (SearchIndexItem sii1, SearchIndexItem sii2) -> { |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2151 |
int result = compareStrings(sii1.getSimpleName(), sii2.getSimpleName()); |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2152 |
if (result == 0) { |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2153 |
// TreeSet needs this to be consistent with equal so we do |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2154 |
// a plain comparison of string representations as fallback. |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2155 |
result = sii1.toString().compareTo(sii2.toString()); |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2156 |
} |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2157 |
return result; |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2158 |
}; |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2159 |
} |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2160 |
|
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2161 |
private Comparator<SearchIndexItem> genericSearchIndexComparator = null; |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2162 |
/** |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2163 |
* Returns a Comparator for SearchIndexItems representing modules, packages, or members. |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2164 |
* Items are compared by label (member name plus signature for members, package name for |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2165 |
* packages, and module name for modules). If labels are equal then full string |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2166 |
* representation is compared. |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2167 |
* |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2168 |
* @return a Comparator |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2169 |
*/ |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2170 |
public Comparator<SearchIndexItem> makeGenericSearchIndexComparator() { |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2171 |
if (genericSearchIndexComparator == null) { |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2172 |
genericSearchIndexComparator = (SearchIndexItem sii1, SearchIndexItem sii2) -> { |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2173 |
int result = compareStrings(sii1.getLabel(), sii2.getLabel()); |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2174 |
if (result == 0) { |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2175 |
// TreeSet needs this to be consistent with equal so we do |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2176 |
// a plain comparison of string representations as fallback. |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2177 |
result = sii1.toString().compareTo(sii2.toString()); |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2178 |
} |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2179 |
return result; |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2180 |
}; |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2181 |
} |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2182 |
return genericSearchIndexComparator; |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2183 |
} |
1857ca5aca37
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules
hannesw
parents:
50247
diff
changeset
|
2184 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2185 |
public Iterable<TypeElement> getEnclosedTypeElements(PackageElement pkg) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2186 |
List<TypeElement> out = getInterfaces(pkg); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2187 |
out.addAll(getClasses(pkg)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2188 |
out.addAll(getEnums(pkg)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2189 |
out.addAll(getAnnotationTypes(pkg)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2190 |
return out; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2191 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2192 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2193 |
// Element related methods |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2194 |
public List<Element> getAnnotationMembers(TypeElement aClass) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2195 |
List<Element> members = getAnnotationFields(aClass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2196 |
members.addAll(getAnnotationMethods(aClass)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2197 |
return members; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2198 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2199 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2200 |
public List<Element> getAnnotationFields(TypeElement aClass) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2201 |
return getItems0(aClass, true, FIELD); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2202 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2203 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2204 |
List<Element> getAnnotationFieldsUnfiltered(TypeElement aClass) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2205 |
return getItems0(aClass, true, FIELD); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2206 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2207 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2208 |
public List<Element> getAnnotationMethods(TypeElement aClass) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2209 |
return getItems0(aClass, true, METHOD); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2210 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2211 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2212 |
public List<TypeElement> getAnnotationTypes(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2213 |
return convertToTypeElement(getItems(e, true, ANNOTATION_TYPE)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2214 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2215 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2216 |
public List<TypeElement> getAnnotationTypesUnfiltered(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2217 |
return convertToTypeElement(getItems(e, false, ANNOTATION_TYPE)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2218 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2219 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2220 |
public List<VariableElement> getFields(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2221 |
return convertToVariableElement(getItems(e, true, FIELD)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2222 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2223 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2224 |
public List<VariableElement> getFieldsUnfiltered(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2225 |
return convertToVariableElement(getItems(e, false, FIELD)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2226 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2227 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2228 |
public List<TypeElement> getClasses(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2229 |
return convertToTypeElement(getItems(e, true, CLASS)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2230 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2231 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2232 |
public List<TypeElement> getClassesUnfiltered(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2233 |
return convertToTypeElement(getItems(e, false, CLASS)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2234 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2235 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2236 |
public List<ExecutableElement> getConstructors(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2237 |
return convertToExecutableElement(getItems(e, true, CONSTRUCTOR)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2238 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2239 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2240 |
public List<ExecutableElement> getMethods(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2241 |
return convertToExecutableElement(getItems(e, true, METHOD)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2242 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2243 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2244 |
List<ExecutableElement> getMethodsUnfiltered(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2245 |
return convertToExecutableElement(getItems(e, false, METHOD)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2246 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2247 |
|
42000
8b7412f7eecd
8167967: javadoc should identify the ordinal value of enum constants
ksrini
parents:
41452
diff
changeset
|
2248 |
public int getOrdinalValue(VariableElement member) { |
8b7412f7eecd
8167967: javadoc should identify the ordinal value of enum constants
ksrini
parents:
41452
diff
changeset
|
2249 |
if (member == null || member.getKind() != ENUM_CONSTANT) { |
8b7412f7eecd
8167967: javadoc should identify the ordinal value of enum constants
ksrini
parents:
41452
diff
changeset
|
2250 |
throw new IllegalArgumentException("must be an enum constant: " + member); |
8b7412f7eecd
8167967: javadoc should identify the ordinal value of enum constants
ksrini
parents:
41452
diff
changeset
|
2251 |
} |
8b7412f7eecd
8167967: javadoc should identify the ordinal value of enum constants
ksrini
parents:
41452
diff
changeset
|
2252 |
return member.getEnclosingElement().getEnclosedElements().indexOf(member); |
8b7412f7eecd
8167967: javadoc should identify the ordinal value of enum constants
ksrini
parents:
41452
diff
changeset
|
2253 |
} |
8b7412f7eecd
8167967: javadoc should identify the ordinal value of enum constants
ksrini
parents:
41452
diff
changeset
|
2254 |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2255 |
private Map<ModuleElement, Set<PackageElement>> modulePackageMap = null; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2256 |
public Map<ModuleElement, Set<PackageElement>> getModulePackageMap() { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2257 |
if (modulePackageMap == null) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2258 |
modulePackageMap = new HashMap<>(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2259 |
Set<PackageElement> pkgs = configuration.getIncludedPackageElements(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2260 |
pkgs.forEach((pkg) -> { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2261 |
ModuleElement mod = elementUtils.getModuleOf(pkg); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2262 |
modulePackageMap.computeIfAbsent(mod, m -> new HashSet<>()).add(pkg); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2263 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2264 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2265 |
return modulePackageMap; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2266 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2267 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2268 |
public Map<ModuleElement, String> getDependentModules(ModuleElement mdle) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2269 |
Map<ModuleElement, String> result = new TreeMap<>(makeModuleComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2270 |
Deque<ModuleElement> queue = new ArrayDeque<>(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2271 |
// get all the requires for the element in question |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2272 |
for (RequiresDirective rd : ElementFilter.requiresIn(mdle.getDirectives())) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2273 |
ModuleElement dep = rd.getDependency(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2274 |
// add the dependency to work queue |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2275 |
if (!result.containsKey(dep)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2276 |
if (rd.isTransitive()) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2277 |
queue.addLast(dep); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2278 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2279 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2280 |
// add all exports for the primary module |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2281 |
result.put(rd.getDependency(), getModifiers(rd)); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2282 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2283 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2284 |
// add only requires public for subsequent module dependencies |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2285 |
for (ModuleElement m = queue.poll(); m != null; m = queue.poll()) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2286 |
for (RequiresDirective rd : ElementFilter.requiresIn(m.getDirectives())) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2287 |
ModuleElement dep = rd.getDependency(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2288 |
if (!result.containsKey(dep)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2289 |
if (rd.isTransitive()) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2290 |
result.put(dep, getModifiers(rd)); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2291 |
queue.addLast(dep); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2292 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2293 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2294 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2295 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2296 |
return result; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2297 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2298 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2299 |
public String getModifiers(RequiresDirective rd) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2300 |
StringBuilder modifiers = new StringBuilder(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2301 |
String sep=""; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2302 |
if (rd.isTransitive()) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2303 |
modifiers.append("transitive"); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2304 |
sep = " "; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2305 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2306 |
if (rd.isStatic()) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2307 |
modifiers.append(sep); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2308 |
modifiers.append("static"); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2309 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2310 |
return (modifiers.length() == 0) ? " " : modifiers.toString(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2311 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
2312 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2313 |
public long getLineNumber(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2314 |
TreePath path = getTreePath(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2315 |
if (path == null) { // maybe null if synthesized |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2316 |
TypeElement encl = getEnclosingTypeElement(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2317 |
path = getTreePath(encl); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2318 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2319 |
CompilationUnitTree cu = path.getCompilationUnit(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2320 |
LineMap lineMap = cu.getLineMap(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2321 |
DocSourcePositions spos = docTrees.getSourcePositions(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2322 |
long pos = spos.getStartPosition(cu, path.getLeaf()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2323 |
return lineMap.getLineNumber(pos); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2324 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2325 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2326 |
public List<ExecutableElement> convertToExecutableElement(List<Element> list) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2327 |
List<ExecutableElement> out = new ArrayList<>(list.size()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2328 |
for (Element e : list) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2329 |
out.add((ExecutableElement)e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2330 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2331 |
return out; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2332 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2333 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2334 |
public List<TypeElement> convertToTypeElement(List<Element> list) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2335 |
List<TypeElement> out = new ArrayList<>(list.size()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2336 |
for (Element e : list) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2337 |
out.add((TypeElement)e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2338 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2339 |
return out; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2340 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2341 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2342 |
public List<VariableElement> convertToVariableElement(List<Element> list) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2343 |
List<VariableElement> out = new ArrayList<>(list.size()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2344 |
for (Element e : list) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2345 |
out.add((VariableElement) e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2346 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2347 |
return out; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2348 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2349 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2350 |
public List<TypeElement> getInterfaces(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2351 |
return convertToTypeElement(getItems(e, true, INTERFACE)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2352 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2353 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2354 |
public List<TypeElement> getInterfacesUnfiltered(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2355 |
return convertToTypeElement(getItems(e, false, INTERFACE)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2356 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2357 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2358 |
public List<Element> getEnumConstants(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2359 |
return getItems(e, true, ENUM_CONSTANT); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2360 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2361 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2362 |
public List<TypeElement> getEnums(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2363 |
return convertToTypeElement(getItems(e, true, ENUM)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2364 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2365 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2366 |
public List<TypeElement> getEnumsUnfiltered(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2367 |
return convertToTypeElement(getItems(e, false, ENUM)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2368 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2369 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2370 |
public SortedSet<TypeElement> getAllClassesUnfiltered(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2371 |
List<TypeElement> clist = getClassesUnfiltered(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2372 |
clist.addAll(getInterfacesUnfiltered(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2373 |
clist.addAll(getAnnotationTypesUnfiltered(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2374 |
SortedSet<TypeElement> oset = new TreeSet<>(makeGeneralPurposeComparator()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2375 |
oset.addAll(clist); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2376 |
return oset; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2377 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2378 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2379 |
private final HashMap<Element, SortedSet<TypeElement>> cachedClasses = new HashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2380 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2381 |
* Returns a list containing classes and interfaces, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2382 |
* including annotation types. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2383 |
* @param e Element |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2384 |
* @return List |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2385 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2386 |
public SortedSet<TypeElement> getAllClasses(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2387 |
SortedSet<TypeElement> oset = cachedClasses.get(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2388 |
if (oset != null) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2389 |
return oset; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2390 |
List<TypeElement> clist = getClasses(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2391 |
clist.addAll(getInterfaces(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2392 |
clist.addAll(getAnnotationTypes(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2393 |
clist.addAll(getEnums(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2394 |
oset = new TreeSet<>(makeGeneralPurposeComparator()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2395 |
oset.addAll(clist); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2396 |
cachedClasses.put(e, oset); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2397 |
return oset; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2398 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2399 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2400 |
/* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2401 |
* Get all the elements unfiltered and filter them finally based |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2402 |
* on its visibility, this works differently from the other getters. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2403 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2404 |
private List<TypeElement> getInnerClasses(Element e, boolean filter) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2405 |
List<TypeElement> olist = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2406 |
for (TypeElement te : getClassesUnfiltered(e)) { |
42277 | 2407 |
if (!filter || configuration.docEnv.isSelected(te)) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2408 |
olist.add(te); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2409 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2410 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2411 |
for (TypeElement te : getInterfacesUnfiltered(e)) { |
42277 | 2412 |
if (!filter || configuration.docEnv.isSelected(te)) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2413 |
olist.add(te); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2414 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2415 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2416 |
for (TypeElement te : getAnnotationTypesUnfiltered(e)) { |
42277 | 2417 |
if (!filter || configuration.docEnv.isSelected(te)) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2418 |
olist.add(te); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2419 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2420 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2421 |
for (TypeElement te : getEnumsUnfiltered(e)) { |
42277 | 2422 |
if (!filter || configuration.docEnv.isSelected(te)) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2423 |
olist.add(te); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2424 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2425 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2426 |
return olist; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2427 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2428 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2429 |
public List<TypeElement> getInnerClasses(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2430 |
return getInnerClasses(e, true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2431 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2432 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2433 |
public List<TypeElement> getInnerClassesUnfiltered(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2434 |
return getInnerClasses(e, false); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2435 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2436 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2437 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2438 |
* Returns a list of classes that are not errors or exceptions |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2439 |
* @param e Element |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2440 |
* @return List |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2441 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2442 |
public List<TypeElement> getOrdinaryClasses(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2443 |
return getClasses(e).stream() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2444 |
.filter(te -> (!isException(te) && !isError(te))) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2445 |
.collect(Collectors.toList()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2446 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2447 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2448 |
public List<TypeElement> getErrors(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2449 |
return getClasses(e) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2450 |
.stream() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2451 |
.filter(this::isError) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2452 |
.collect(Collectors.toList()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2453 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2454 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2455 |
public List<TypeElement> getExceptions(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2456 |
return getClasses(e) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2457 |
.stream() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2458 |
.filter(this::isException) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2459 |
.collect(Collectors.toList()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2460 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2461 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2462 |
List<Element> getItems(Element e, boolean filter, ElementKind select) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2463 |
List<Element> elements = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2464 |
return new SimpleElementVisitor9<List<Element>, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2465 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2466 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2467 |
public List<Element> visitPackage(PackageElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2468 |
recursiveGetItems(elements, e, filter, select); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2469 |
return elements; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2470 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2471 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2472 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2473 |
protected List<Element> defaultAction(Element e0, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2474 |
return getItems0(e0, filter, select); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2475 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2476 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2477 |
}.visit(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2478 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2479 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2480 |
EnumSet<ElementKind> nestedKinds = EnumSet.of(ANNOTATION_TYPE, CLASS, ENUM, INTERFACE); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2481 |
void recursiveGetItems(Collection<Element> list, Element e, boolean filter, ElementKind... select) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2482 |
list.addAll(getItems0(e, filter, select)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2483 |
List<Element> classes = getItems0(e, filter, nestedKinds); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2484 |
for (Element c : classes) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2485 |
list.addAll(getItems0(c, filter, select)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2486 |
if (isTypeElement(c)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2487 |
recursiveGetItems(list, c, filter, select); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2488 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2489 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2490 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2491 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2492 |
private List<Element> getItems0(Element te, boolean filter, ElementKind... select) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2493 |
EnumSet<ElementKind> kinds = EnumSet.copyOf(Arrays.asList(select)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2494 |
return getItems0(te, filter, kinds); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2495 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2496 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2497 |
private List<Element> getItems0(Element te, boolean filter, Set<ElementKind> kinds) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2498 |
List<Element> elements = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2499 |
for (Element e : te.getEnclosedElements()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2500 |
if (kinds.contains(e.getKind())) { |
42277 | 2501 |
if (!filter || shouldDocument(e)) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2502 |
elements.add(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2503 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2504 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2505 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2506 |
return elements; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2507 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2508 |
|
42277 | 2509 |
private SimpleElementVisitor9<Boolean, Void> shouldDocumentVisitor = null; |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
2510 |
|
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
2511 |
protected boolean shouldDocument(Element e) { |
42277 | 2512 |
if (shouldDocumentVisitor == null) { |
2513 |
shouldDocumentVisitor = new SimpleElementVisitor9<Boolean, Void>() { |
|
2514 |
private boolean hasSource(TypeElement e) { |
|
2515 |
return configuration.docEnv.getFileKind(e) == |
|
2516 |
javax.tools.JavaFileObject.Kind.SOURCE; |
|
2517 |
} |
|
2518 |
||
2519 |
// handle types |
|
2520 |
@Override |
|
2521 |
public Boolean visitType(TypeElement e, Void p) { |
|
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
2522 |
// treat inner classes etc as members |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
2523 |
if (e.getNestingKind().isNested()) { |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
2524 |
return defaultAction(e, p); |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
2525 |
} |
42277 | 2526 |
return configuration.docEnv.isSelected(e) && hasSource(e); |
2527 |
} |
|
2528 |
||
2529 |
// handle everything else |
|
2530 |
@Override |
|
2531 |
protected Boolean defaultAction(Element e, Void p) { |
|
2532 |
return configuration.docEnv.isSelected(e); |
|
2533 |
} |
|
2534 |
||
2535 |
@Override |
|
2536 |
public Boolean visitUnknown(Element e, Void p) { |
|
2537 |
throw new AssertionError("unkown element: " + p); |
|
2538 |
} |
|
2539 |
}; |
|
2540 |
} |
|
2541 |
return shouldDocumentVisitor.visit(e); |
|
2542 |
} |
|
2543 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2544 |
/* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2545 |
* nameCache is maintained for improving the comparator |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2546 |
* performance, noting that the Collator used by the comparators |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2547 |
* use Strings, as of this writing. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2548 |
* TODO: when those APIs handle charSequences, the use of |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2549 |
* this nameCache must be re-investigated and removed. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2550 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2551 |
private final Map<Element, String> nameCache = new LinkedHashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2552 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2553 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2554 |
* Returns the name of the element after the last dot of the package name. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2555 |
* This emulates the behavior of the old doclet. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2556 |
* @param e an element whose name is required |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2557 |
* @return the name |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2558 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2559 |
public String getSimpleName(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2560 |
return nameCache.computeIfAbsent(e, this::getSimpleName0); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2561 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2562 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2563 |
private SimpleElementVisitor9<String, Void> snvisitor = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2564 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2565 |
private String getSimpleName0(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2566 |
if (snvisitor == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2567 |
snvisitor = new SimpleElementVisitor9<String, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2568 |
@Override |
40511 | 2569 |
public String visitModule(ModuleElement e, Void p) { |
45771
e447c20c3ff9
8182736: javadoc generates bad names and broken module graph links
jjg
parents:
44385
diff
changeset
|
2570 |
return e.getQualifiedName().toString(); // temp fix for 8182736 |
40511 | 2571 |
} |
2572 |
||
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2573 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2574 |
public String visitType(TypeElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2575 |
StringBuilder sb = new StringBuilder(e.getSimpleName()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2576 |
Element enclosed = e.getEnclosingElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2577 |
while (enclosed != null |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2578 |
&& (enclosed.getKind().isClass() || enclosed.getKind().isInterface())) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2579 |
sb.insert(0, enclosed.getSimpleName() + "."); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2580 |
enclosed = enclosed.getEnclosingElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2581 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2582 |
return sb.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2583 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2584 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2585 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2586 |
public String visitExecutable(ExecutableElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2587 |
if (e.getKind() == CONSTRUCTOR || e.getKind() == STATIC_INIT) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2588 |
return e.getEnclosingElement().getSimpleName().toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2589 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2590 |
return e.getSimpleName().toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2591 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2592 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2593 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2594 |
protected String defaultAction(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2595 |
return e.getSimpleName().toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2596 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2597 |
}; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2598 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2599 |
return snvisitor.visit(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2600 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2601 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2602 |
public TypeElement getEnclosingTypeElement(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2603 |
if (e.getKind() == ElementKind.PACKAGE) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2604 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2605 |
Element encl = e.getEnclosingElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2606 |
ElementKind kind = encl.getKind(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2607 |
if (kind == ElementKind.PACKAGE) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2608 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2609 |
while (!(kind.isClass() || kind.isInterface())) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2610 |
encl = encl.getEnclosingElement(); |
50247
e91322fc41c5
8188248: NullPointerException on generic methods
pmuthuswamy
parents:
50025
diff
changeset
|
2611 |
kind = encl.getKind(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2612 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2613 |
return (TypeElement)encl; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2614 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2615 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2616 |
private ConstantValueExpression cve = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2617 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2618 |
public String constantValueExpresion(VariableElement ve) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2619 |
if (cve == null) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2620 |
cve = new ConstantValueExpression(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2621 |
return cve.constantValueExpression(configuration.workArounds, ve); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2622 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2623 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2624 |
private static class ConstantValueExpression { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2625 |
public String constantValueExpression(WorkArounds workArounds, VariableElement ve) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2626 |
return new TypeKindVisitor9<String, Object>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2627 |
/* TODO: we need to fix this correctly. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2628 |
* we have a discrepancy here, note the use of getConstValue |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2629 |
* vs. getConstantValue, at some point we need to use |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2630 |
* getConstantValue. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2631 |
* In the legacy world byte and char primitives appear as Integer values, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2632 |
* thus a byte value of 127 will appear as 127, but in the new world, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2633 |
* a byte value appears as Byte thus 0x7f will be printed, similarly |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2634 |
* chars will be translated to \n, \r etc. however, in the new world, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2635 |
* they will be printed as decimal values. The new world is correct, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2636 |
* and we should fix this by using getConstantValue and the visitor to |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2637 |
* address this in the future. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2638 |
*/ |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2639 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2640 |
public String visitPrimitiveAsBoolean(PrimitiveType t, Object val) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2641 |
return (int)val == 0 ? "false" : "true"; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2642 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2643 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2644 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2645 |
public String visitPrimitiveAsDouble(PrimitiveType t, Object val) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2646 |
return sourceForm(((Double)val), 'd'); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2647 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2648 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2649 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2650 |
public String visitPrimitiveAsFloat(PrimitiveType t, Object val) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2651 |
return sourceForm(((Float)val).doubleValue(), 'f'); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2652 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2653 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2654 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2655 |
public String visitPrimitiveAsLong(PrimitiveType t, Object val) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2656 |
return val + "L"; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2657 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2658 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2659 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2660 |
protected String defaultAction(TypeMirror e, Object val) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2661 |
if (val == null) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2662 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2663 |
else if (val instanceof Character) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2664 |
return sourceForm(((Character)val)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2665 |
else if (val instanceof Byte) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2666 |
return sourceForm(((Byte)val)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2667 |
else if (val instanceof String) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2668 |
return sourceForm((String)val); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2669 |
return val.toString(); // covers int, short |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2670 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2671 |
}.visit(ve.asType(), workArounds.getConstValue(ve)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2672 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2673 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2674 |
// where |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2675 |
private String sourceForm(double v, char suffix) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2676 |
if (Double.isNaN(v)) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2677 |
return "0" + suffix + "/0" + suffix; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2678 |
if (v == Double.POSITIVE_INFINITY) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2679 |
return "1" + suffix + "/0" + suffix; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2680 |
if (v == Double.NEGATIVE_INFINITY) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2681 |
return "-1" + suffix + "/0" + suffix; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2682 |
return v + (suffix == 'f' || suffix == 'F' ? "" + suffix : ""); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2683 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2684 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2685 |
private String sourceForm(char c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2686 |
StringBuilder buf = new StringBuilder(8); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2687 |
buf.append('\''); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2688 |
sourceChar(c, buf); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2689 |
buf.append('\''); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2690 |
return buf.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2691 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2692 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2693 |
private String sourceForm(byte c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2694 |
return "0x" + Integer.toString(c & 0xff, 16); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2695 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2696 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2697 |
private String sourceForm(String s) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2698 |
StringBuilder buf = new StringBuilder(s.length() + 5); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2699 |
buf.append('\"'); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2700 |
for (int i=0; i<s.length(); i++) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2701 |
char c = s.charAt(i); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2702 |
sourceChar(c, buf); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2703 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2704 |
buf.append('\"'); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2705 |
return buf.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2706 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2707 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2708 |
private void sourceChar(char c, StringBuilder buf) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2709 |
switch (c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2710 |
case '\b': buf.append("\\b"); return; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2711 |
case '\t': buf.append("\\t"); return; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2712 |
case '\n': buf.append("\\n"); return; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2713 |
case '\f': buf.append("\\f"); return; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2714 |
case '\r': buf.append("\\r"); return; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2715 |
case '\"': buf.append("\\\""); return; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2716 |
case '\'': buf.append("\\\'"); return; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2717 |
case '\\': buf.append("\\\\"); return; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2718 |
default: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2719 |
if (isPrintableAscii(c)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2720 |
buf.append(c); return; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2721 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2722 |
unicodeEscape(c, buf); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2723 |
return; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2724 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2725 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2726 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2727 |
private void unicodeEscape(char c, StringBuilder buf) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2728 |
final String chars = "0123456789abcdef"; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2729 |
buf.append("\\u"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2730 |
buf.append(chars.charAt(15 & (c>>12))); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2731 |
buf.append(chars.charAt(15 & (c>>8))); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2732 |
buf.append(chars.charAt(15 & (c>>4))); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2733 |
buf.append(chars.charAt(15 & (c>>0))); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2734 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2735 |
private boolean isPrintableAscii(char c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2736 |
return c >= ' ' && c <= '~'; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2737 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2738 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2739 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2740 |
public boolean isEnclosingPackageIncluded(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2741 |
return isIncluded(containingPackage(te)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2742 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2743 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2744 |
public boolean isIncluded(Element e) { |
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
38617
diff
changeset
|
2745 |
return configuration.docEnv.isIncluded(e); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2746 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2747 |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2748 |
private SimpleElementVisitor9<Boolean, Void> specifiedVisitor = null; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2749 |
public boolean isSpecified(Element e) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2750 |
if (specifiedVisitor == null) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2751 |
specifiedVisitor = new SimpleElementVisitor9<Boolean, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2752 |
@Override |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2753 |
public Boolean visitModule(ModuleElement e, Void p) { |
42277 | 2754 |
return configuration.getSpecifiedModuleElements().contains(e); |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2755 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2756 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2757 |
@Override |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2758 |
public Boolean visitPackage(PackageElement e, Void p) { |
42277 | 2759 |
return configuration.getSpecifiedPackageElements().contains(e); |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2760 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2761 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2762 |
@Override |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2763 |
public Boolean visitType(TypeElement e, Void p) { |
42277 | 2764 |
return configuration.getSpecifiedTypeElements().contains(e); |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2765 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2766 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40605
diff
changeset
|
2767 |
@Override |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2768 |
protected Boolean defaultAction(Element e, Void p) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2769 |
return false; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2770 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2771 |
}; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2772 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2773 |
return specifiedVisitor.visit(e); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2774 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40303
diff
changeset
|
2775 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2776 |
/** |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2777 |
* Get the package name for a given package element. An unnamed package is returned as <Unnamed> |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2778 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2779 |
* @param pkg |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2780 |
* @return |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2781 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2782 |
public String getPackageName(PackageElement pkg) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2783 |
if (pkg == null || pkg.isUnnamed()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2784 |
return DocletConstants.DEFAULT_PACKAGE_NAME; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2785 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2786 |
return pkg.getQualifiedName().toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2787 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2788 |
|
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2789 |
/** |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2790 |
* Get the module name for a given module element. An unnamed module is returned as <Unnamed> |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2791 |
* |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2792 |
* @param mdle a ModuleElement |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2793 |
* @return |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2794 |
*/ |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2795 |
public String getModuleName(ModuleElement mdle) { |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2796 |
if (mdle == null || mdle.isUnnamed()) { |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2797 |
return DocletConstants.DEFAULT_ELEMENT_NAME; |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2798 |
} |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2799 |
return mdle.getQualifiedName().toString(); |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2800 |
} |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48213
diff
changeset
|
2801 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2802 |
public boolean isAttribute(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2803 |
return isKind(doctree, ATTRIBUTE); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2804 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2805 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2806 |
public boolean isAuthor(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2807 |
return isKind(doctree, AUTHOR); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2808 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2809 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2810 |
public boolean isComment(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2811 |
return isKind(doctree, COMMENT); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2812 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2813 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2814 |
public boolean isDeprecated(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2815 |
return isKind(doctree, DEPRECATED); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2816 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2817 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2818 |
public boolean isDocComment(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2819 |
return isKind(doctree, DOC_COMMENT); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2820 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2821 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2822 |
public boolean isDocRoot(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2823 |
return isKind(doctree, DOC_ROOT); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2824 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2825 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2826 |
public boolean isEndElement(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2827 |
return isKind(doctree, END_ELEMENT); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2828 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2829 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2830 |
public boolean isEntity(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2831 |
return isKind(doctree, ENTITY); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2832 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2833 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2834 |
public boolean isErroneous(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2835 |
return isKind(doctree, ERRONEOUS); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2836 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2837 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2838 |
public boolean isException(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2839 |
return isKind(doctree, EXCEPTION); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2840 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2841 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2842 |
public boolean isIdentifier(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2843 |
return isKind(doctree, IDENTIFIER); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2844 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2845 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2846 |
public boolean isInheritDoc(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2847 |
return isKind(doctree, INHERIT_DOC); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2848 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2849 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2850 |
public boolean isLink(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2851 |
return isKind(doctree, LINK); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2852 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2853 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2854 |
public boolean isLinkPlain(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2855 |
return isKind(doctree, LINK_PLAIN); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2856 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2857 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2858 |
public boolean isLiteral(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2859 |
return isKind(doctree, LITERAL); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2860 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2861 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2862 |
public boolean isOther(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2863 |
return doctree.getKind() == DocTree.Kind.OTHER; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2864 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2865 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2866 |
public boolean isParam(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2867 |
return isKind(doctree, PARAM); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2868 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2869 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2870 |
public boolean isReference(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2871 |
return isKind(doctree, REFERENCE); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2872 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2873 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2874 |
public boolean isReturn(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2875 |
return isKind(doctree, RETURN); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2876 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2877 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2878 |
public boolean isSee(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2879 |
return isKind(doctree, SEE); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2880 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2881 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2882 |
public boolean isSerial(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2883 |
return isKind(doctree, SERIAL); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2884 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2885 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2886 |
public boolean isSerialData(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2887 |
return isKind(doctree, SERIAL_DATA); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2888 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2889 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2890 |
public boolean isSerialField(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2891 |
return isKind(doctree, SERIAL_FIELD); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2892 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2893 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2894 |
public boolean isSince(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2895 |
return isKind(doctree, SINCE); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2896 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2897 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2898 |
public boolean isStartElement(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2899 |
return isKind(doctree, START_ELEMENT); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2900 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2901 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2902 |
public boolean isText(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2903 |
return isKind(doctree, TEXT); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2904 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2905 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2906 |
public boolean isThrows(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2907 |
return isKind(doctree, THROWS); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2908 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2909 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2910 |
public boolean isUnknownBlockTag(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2911 |
return isKind(doctree, UNKNOWN_BLOCK_TAG); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2912 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2913 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2914 |
public boolean isUnknownInlineTag(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2915 |
return isKind(doctree, UNKNOWN_INLINE_TAG); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2916 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2917 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2918 |
public boolean isValue(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2919 |
return isKind(doctree, VALUE); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2920 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2921 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2922 |
public boolean isVersion(DocTree doctree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2923 |
return isKind(doctree, VERSION); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2924 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2925 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2926 |
private boolean isKind(DocTree doctree, DocTree.Kind match) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2927 |
return doctree.getKind() == match; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2928 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2929 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2930 |
private final WeakSoftHashMap wksMap = new WeakSoftHashMap(this); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2931 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2932 |
public CommentHelper getCommentHelper(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2933 |
return wksMap.computeIfAbsent(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2934 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2935 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2936 |
public void removeCommentHelper(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2937 |
wksMap.remove(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2938 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2939 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2940 |
public List<? extends DocTree> filteredList(List<? extends DocTree> dlist, DocTree.Kind... select) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2941 |
List<DocTree> list = new ArrayList<>(dlist.size()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2942 |
if (select == null) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2943 |
return dlist; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2944 |
for (DocTree dt : dlist) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2945 |
if (dt.getKind() != ERRONEOUS) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2946 |
for (DocTree.Kind kind : select) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2947 |
if (dt.getKind() == kind) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2948 |
list.add(dt); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2949 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2950 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2951 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2952 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2953 |
return list; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2954 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2955 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2956 |
private List<? extends DocTree> getBlockTags0(Element element, DocTree.Kind... kinds) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2957 |
DocCommentTree dcTree = getDocCommentTree(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2958 |
if (dcTree == null) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2959 |
return Collections.emptyList(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2960 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2961 |
return filteredList(dcTree.getBlockTags(), kinds); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2962 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2963 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2964 |
public List<? extends DocTree> getBlockTags(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2965 |
return getBlockTags0(element, (Kind[]) null); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2966 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2967 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2968 |
public List<? extends DocTree> getBlockTags(Element element, DocTree.Kind... kinds) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2969 |
return getBlockTags0(element, kinds); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2970 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2971 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2972 |
public List<? extends DocTree> getBlockTags(Element element, String tagName) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2973 |
DocTree.Kind kind = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2974 |
switch (tagName) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2975 |
case "author": |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2976 |
case "deprecated": |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
2977 |
case "hidden": |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2978 |
case "param": |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2979 |
case "return": |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2980 |
case "see": |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2981 |
case "serial": |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2982 |
case "since": |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2983 |
case "throws": |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2984 |
case "exception": |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2985 |
case "version": |
50025
caf05d64138f
8200094: Turkish locale reports NPE No enum constant com.sun.source.doctree.DocTree.Kind.SÄ°NCE
pmuthuswamy
parents:
49879
diff
changeset
|
2986 |
kind = DocTree.Kind.valueOf(toUpperCase(tagName)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2987 |
return getBlockTags(element, kind); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2988 |
case "serialData": |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2989 |
kind = SERIAL_DATA; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2990 |
return getBlockTags(element, kind); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2991 |
case "serialField": |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2992 |
kind = SERIAL_FIELD; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2993 |
return getBlockTags(element, kind); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2994 |
default: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2995 |
kind = DocTree.Kind.UNKNOWN_BLOCK_TAG; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2996 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2997 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2998 |
List<? extends DocTree> blockTags = getBlockTags(element, kind); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
2999 |
List<DocTree> out = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3000 |
String tname = tagName.startsWith("@") ? tagName.substring(1) : tagName; |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3001 |
CommentHelper ch = getCommentHelper(element); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3002 |
for (DocTree dt : blockTags) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3003 |
if (ch.getTagName(dt).equals(tname)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3004 |
out.add(dt); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3005 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3006 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3007 |
return out; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3008 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3009 |
|
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3010 |
public boolean hasBlockTag(Element element, DocTree.Kind kind) { |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3011 |
return hasBlockTag(element, kind, null); |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3012 |
} |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3013 |
|
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3014 |
public boolean hasBlockTag(Element element, DocTree.Kind kind, final String tagName) { |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3015 |
CommentHelper ch = getCommentHelper(element); |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3016 |
String tname = tagName != null && tagName.startsWith("@") |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3017 |
? tagName.substring(1) |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3018 |
: tagName; |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3019 |
for (DocTree dt : getBlockTags(element, kind)) { |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3020 |
if (dt.getKind() == kind) { |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3021 |
if (tname == null || ch.getTagName(dt).equals(tname)) { |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3022 |
return true; |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3023 |
} |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3024 |
} |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3025 |
} |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3026 |
return false; |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3027 |
} |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
3028 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3029 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3030 |
* Gets a TreePath for an Element. Note this method is called very |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3031 |
* frequently, care must be taken to ensure this method is lithe |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3032 |
* and efficient. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3033 |
* @param e an Element |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3034 |
* @return TreePath |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3035 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3036 |
public TreePath getTreePath(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3037 |
DocCommentDuo duo = dcTreeCache.get(e); |
55196
7586561128e3
8222091: Javadoc does not handle package annotations correctly on package-info.java
hannesw
parents:
52644
diff
changeset
|
3038 |
if (duo != null && duo.treePath != null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3039 |
return duo.treePath; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3040 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3041 |
duo = configuration.cmtUtils.getSyntheticCommentDuo(e); |
55196
7586561128e3
8222091: Javadoc does not handle package annotations correctly on package-info.java
hannesw
parents:
52644
diff
changeset
|
3042 |
if (duo != null && duo.treePath != null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3043 |
return duo.treePath; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3044 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3045 |
Map<Element, TreePath> elementToTreePath = configuration.workArounds.getElementToTreePath(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3046 |
TreePath path = elementToTreePath.get(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3047 |
if (path != null || elementToTreePath.containsKey(e)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3048 |
// expedite the path and one that is a null |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3049 |
return path; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3050 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3051 |
return elementToTreePath.computeIfAbsent(e, docTrees::getPath); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3052 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3053 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3054 |
private final Map<Element, DocCommentDuo> dcTreeCache = new LinkedHashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3055 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3056 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3057 |
* Retrieves the doc comments for a given element. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3058 |
* @param element |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3059 |
* @return DocCommentTree for the Element |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3060 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3061 |
public DocCommentTree getDocCommentTree0(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3062 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3063 |
DocCommentDuo duo = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3064 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3065 |
ElementKind kind = element.getKind(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3066 |
if (kind == ElementKind.PACKAGE || kind == ElementKind.OTHER) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3067 |
duo = dcTreeCache.get(element); // local cache |
55196
7586561128e3
8222091: Javadoc does not handle package annotations correctly on package-info.java
hannesw
parents:
52644
diff
changeset
|
3068 |
if (duo == null && kind == ElementKind.PACKAGE) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3069 |
// package-info.java |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3070 |
duo = getDocCommentTuple(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3071 |
} |
55196
7586561128e3
8222091: Javadoc does not handle package annotations correctly on package-info.java
hannesw
parents:
52644
diff
changeset
|
3072 |
if (duo == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3073 |
// package.html or overview.html |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3074 |
duo = configuration.cmtUtils.getHtmlCommentDuo(element); // html source |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3075 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3076 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3077 |
duo = configuration.cmtUtils.getSyntheticCommentDuo(element); |
55196
7586561128e3
8222091: Javadoc does not handle package annotations correctly on package-info.java
hannesw
parents:
52644
diff
changeset
|
3078 |
if (duo == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3079 |
duo = dcTreeCache.get(element); // local cache |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3080 |
} |
55196
7586561128e3
8222091: Javadoc does not handle package annotations correctly on package-info.java
hannesw
parents:
52644
diff
changeset
|
3081 |
if (duo == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3082 |
duo = getDocCommentTuple(element); // get the real mccoy |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3083 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3084 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3085 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3086 |
DocCommentTree docCommentTree = isValidDuo(duo) ? duo.dcTree : null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3087 |
TreePath path = isValidDuo(duo) ? duo.treePath : null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3088 |
if (!dcTreeCache.containsKey(element)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3089 |
if (docCommentTree != null && path != null) { |
43261 | 3090 |
if (!configuration.isAllowScriptInComments()) { |
3091 |
try { |
|
3092 |
javaScriptScanner.scan(docCommentTree, path, p -> { |
|
3093 |
throw new JavaScriptScanner.Fault(); |
|
3094 |
}); |
|
3095 |
} catch (JavaScriptScanner.Fault jsf) { |
|
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
52174
diff
changeset
|
3096 |
String text = resources.getText("doclet.JavaScript_in_comment"); |
43261 | 3097 |
throw new UncheckedDocletException(new SimpleDocletException(text, jsf)); |
3098 |
} |
|
3099 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3100 |
configuration.workArounds.runDocLint(path); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3101 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3102 |
dcTreeCache.put(element, duo); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3103 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3104 |
return docCommentTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3105 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3106 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3107 |
private DocCommentDuo getDocCommentTuple(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3108 |
// prevent nasty things downstream with overview element |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3109 |
if (element.getKind() != ElementKind.OTHER) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3110 |
TreePath path = getTreePath(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3111 |
if (path != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3112 |
DocCommentTree docCommentTree = docTrees.getDocCommentTree(path); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3113 |
return new DocCommentDuo(path, docCommentTree); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3114 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3115 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3116 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3117 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3118 |
|
43261 | 3119 |
public void checkJavaScriptInOption(String name, String value) { |
3120 |
if (!configuration.isAllowScriptInComments()) { |
|
3121 |
DocCommentTree dct = configuration.cmtUtils.parse( |
|
3122 |
URI.create("option://" + name.replace("-", "")), "<body>" + value + "</body>"); |
|
48028
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47988
diff
changeset
|
3123 |
|
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47988
diff
changeset
|
3124 |
if (dct == null) |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47988
diff
changeset
|
3125 |
return; |
9e022f580a9d
8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents:
47988
diff
changeset
|
3126 |
|
43261 | 3127 |
try { |
3128 |
javaScriptScanner.scan(dct, null, p -> { |
|
3129 |
throw new JavaScriptScanner.Fault(); |
|
3130 |
}); |
|
3131 |
} catch (JavaScriptScanner.Fault jsf) { |
|
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
52174
diff
changeset
|
3132 |
String text = resources.getText("doclet.JavaScript_in_option", name); |
43261 | 3133 |
throw new UncheckedDocletException(new SimpleDocletException(text, jsf)); |
3134 |
} |
|
3135 |
} |
|
3136 |
} |
|
3137 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3138 |
boolean isValidDuo(DocCommentDuo duo) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3139 |
return duo != null && duo.dcTree != null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3140 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3141 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3142 |
public DocCommentTree getDocCommentTree(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3143 |
CommentHelper ch = wksMap.get(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3144 |
if (ch != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3145 |
return ch.dctree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3146 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3147 |
DocCommentTree dcTree = getDocCommentTree0(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3148 |
if (dcTree != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3149 |
wksMap.put(element, new CommentHelper(configuration, element, getTreePath(element), dcTree)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3150 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3151 |
return dcTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3152 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3153 |
|
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
48028
diff
changeset
|
3154 |
public List<? extends DocTree> getPreamble(Element element) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
48028
diff
changeset
|
3155 |
DocCommentTree docCommentTree = getDocCommentTree(element); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
48028
diff
changeset
|
3156 |
return docCommentTree == null |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
48028
diff
changeset
|
3157 |
? Collections.emptyList() |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
48028
diff
changeset
|
3158 |
: docCommentTree.getPreamble(); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
48028
diff
changeset
|
3159 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
48028
diff
changeset
|
3160 |
|
41452 | 3161 |
public List<? extends DocTree> getFullBody(Element element) { |
3162 |
DocCommentTree docCommentTree = getDocCommentTree(element); |
|
3163 |
return (docCommentTree == null) |
|
3164 |
? Collections.emptyList() |
|
3165 |
: docCommentTree.getFullBody(); |
|
3166 |
} |
|
3167 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3168 |
public List<? extends DocTree> getBody(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3169 |
DocCommentTree docCommentTree = getDocCommentTree(element); |
41452 | 3170 |
return (docCommentTree == null) |
3171 |
? Collections.emptyList() |
|
3172 |
: docCommentTree.getFullBody(); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3173 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3174 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3175 |
public List<? extends DocTree> getDeprecatedTrees(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3176 |
return getBlockTags(element, DEPRECATED); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3177 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3178 |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
3179 |
public List<? extends DocTree> getProvidesTrees(Element element) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
3180 |
return getBlockTags(element, PROVIDES); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
3181 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
3182 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3183 |
public List<? extends DocTree> getSeeTrees(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3184 |
return getBlockTags(element, SEE); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3185 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3186 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3187 |
public List<? extends DocTree> getSerialTrees(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3188 |
return getBlockTags(element, SERIAL); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3189 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3190 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3191 |
public List<? extends DocTree> getSerialFieldTrees(VariableElement field) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3192 |
return getBlockTags(field, DocTree.Kind.SERIAL_FIELD); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3193 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3194 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3195 |
public List<? extends DocTree> getThrowsTrees(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3196 |
return getBlockTags(element, DocTree.Kind.EXCEPTION, DocTree.Kind.THROWS); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3197 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3198 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3199 |
public List<? extends DocTree> getTypeParamTrees(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3200 |
return getParamTrees(element, true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3201 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3202 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3203 |
public List<? extends DocTree> getParamTrees(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3204 |
return getParamTrees(element, false); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3205 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3206 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3207 |
private List<? extends DocTree> getParamTrees(Element element, boolean isTypeParameters) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3208 |
List<DocTree> out = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3209 |
for (DocTree dt : getBlockTags(element, PARAM)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3210 |
ParamTree pt = (ParamTree) dt; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3211 |
if (pt.isTypeParameter() == isTypeParameters) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3212 |
out.add(dt); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3213 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3214 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3215 |
return out; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3216 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3217 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3218 |
public List<? extends DocTree> getReturnTrees(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3219 |
List<DocTree> out = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3220 |
for (DocTree dt : getBlockTags(element, RETURN)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3221 |
out.add(dt); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3222 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3223 |
return out; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3224 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3225 |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
3226 |
public List<? extends DocTree> getUsesTrees(Element element) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
3227 |
return getBlockTags(element, USES); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
3228 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42827
diff
changeset
|
3229 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3230 |
public List<? extends DocTree> getFirstSentenceTrees(Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3231 |
DocCommentTree dcTree = getDocCommentTree(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3232 |
if (dcTree == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3233 |
return Collections.emptyList(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3234 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3235 |
List<DocTree> out = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3236 |
for (DocTree dt : dcTree.getFirstSentence()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3237 |
out.add(dt); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3238 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3239 |
return out; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3240 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3241 |
|
40511 | 3242 |
public ModuleElement containingModule(Element e) { |
3243 |
return elementUtils.getModuleOf(e); |
|
3244 |
} |
|
3245 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3246 |
public PackageElement containingPackage(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3247 |
return elementUtils.getPackageOf(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3248 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3249 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3250 |
public TypeElement getTopMostContainingTypeElement(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3251 |
if (isPackage(e)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3252 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3253 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3254 |
TypeElement outer = getEnclosingTypeElement(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3255 |
if (outer == null) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3256 |
return (TypeElement)e; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3257 |
while (outer != null && outer.getNestingKind().isNested()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3258 |
outer = getEnclosingTypeElement(outer); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3259 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3260 |
return outer; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3261 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3262 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3263 |
static class WeakSoftHashMap implements Map<Element, CommentHelper> { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3264 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3265 |
private final WeakHashMap<Element, SoftReference<CommentHelper>> wkMap; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3266 |
private final Utils utils; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3267 |
public WeakSoftHashMap(Utils utils) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3268 |
wkMap = new WeakHashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3269 |
this.utils = utils; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3270 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3271 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3272 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3273 |
public boolean containsKey(Object key) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3274 |
return wkMap.containsKey(key); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3275 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3276 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3277 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3278 |
public Collection<CommentHelper> values() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3279 |
Set<CommentHelper> out = new LinkedHashSet<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3280 |
for (SoftReference<CommentHelper> v : wkMap.values()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3281 |
out.add(v.get()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3282 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3283 |
return out; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3284 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3285 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3286 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3287 |
public boolean containsValue(Object value) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3288 |
return wkMap.containsValue(new SoftReference<>((CommentHelper)value)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3289 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3290 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3291 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3292 |
public CommentHelper remove(Object key) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3293 |
SoftReference<CommentHelper> value = wkMap.remove(key); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3294 |
return value == null ? null : value.get(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3295 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3296 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3297 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3298 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3299 |
public CommentHelper put(Element key, CommentHelper value) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3300 |
SoftReference<CommentHelper> nvalue = wkMap.put(key, new SoftReference<>(value)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3301 |
return nvalue == null ? null : nvalue.get(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3302 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3303 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3304 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3305 |
public CommentHelper get(Object key) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3306 |
SoftReference<CommentHelper> value = wkMap.get(key); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3307 |
return value == null ? null : value.get(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3308 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3309 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3310 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3311 |
public int size() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3312 |
return wkMap.size(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3313 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3314 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3315 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3316 |
public boolean isEmpty() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3317 |
return wkMap.isEmpty(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3318 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3319 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3320 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3321 |
public void clear() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3322 |
wkMap.clear(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3323 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3324 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3325 |
public CommentHelper computeIfAbsent(Element key) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3326 |
if (wkMap.containsKey(key)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3327 |
SoftReference<CommentHelper> value = wkMap.get(key); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3328 |
if (value != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3329 |
CommentHelper cvalue = value.get(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3330 |
if (cvalue != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3331 |
return cvalue; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3332 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3333 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3334 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3335 |
CommentHelper newValue = new CommentHelper(utils.configuration, key, utils.getTreePath(key), |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3336 |
utils.getDocCommentTree(key)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3337 |
wkMap.put(key, new SoftReference<>(newValue)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3338 |
return newValue; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3339 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3340 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3341 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3342 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3343 |
public void putAll(Map<? extends Element, ? extends CommentHelper> map) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3344 |
for (Map.Entry<? extends Element, ? extends CommentHelper> entry : map.entrySet()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3345 |
put(entry.getKey(), entry.getValue()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3346 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3347 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3348 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3349 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3350 |
public Set<Element> keySet() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3351 |
return wkMap.keySet(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3352 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3353 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3354 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3355 |
public Set<Entry<Element, CommentHelper>> entrySet() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3356 |
Set<Entry<Element, CommentHelper>> out = new LinkedHashSet<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3357 |
for (Element e : wkMap.keySet()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3358 |
SimpleEntry<Element, CommentHelper> n = new SimpleEntry<>(e, get(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3359 |
out.add(n); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3360 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
3361 |
return out; |
24220
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
3362 |
} |
eb213562268d
8039410: [javadoc] fix class-use items to be deterministic and index ordering
ksrini
parents:
22165
diff
changeset
|
3363 |
} |
46079
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3364 |
|
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3365 |
/** |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3366 |
* A simple pair container. |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3367 |
* @param <K> first a value |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3368 |
* @param <L> second another value |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3369 |
*/ |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3370 |
public static class Pair<K, L> { |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3371 |
public final K first; |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3372 |
public final L second; |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3373 |
|
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3374 |
public Pair(K first, L second) { |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3375 |
this.first = first; |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3376 |
this.second = second; |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3377 |
} |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
3378 |
|
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
3379 |
public String toString() { |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
3380 |
StringBuffer out = new StringBuffer(); |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
3381 |
out.append(first + ":" + second); |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
3382 |
return out.toString(); |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48759
diff
changeset
|
3383 |
} |
46079
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
46078
diff
changeset
|
3384 |
} |
10 | 3385 |
} |