author | ksrini |
Thu, 19 Oct 2017 20:27:47 -0700 | |
changeset 47395 | 2ea4edfdef8e |
parent 47216 | 71c04702a3d5 |
child 48759 | ffa68af7da87 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
45417 | 2 |
* Copyright (c) 1998, 2017, 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 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
25 |
package jdk.javadoc.internal.doclets.toolkit.util; |
10 | 26 |
|
14258 | 27 |
import java.util.*; |
28 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
29 |
import javax.lang.model.element.AnnotationMirror; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
30 |
import javax.lang.model.element.Element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
31 |
import javax.lang.model.element.ExecutableElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
32 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
33 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
34 |
import javax.lang.model.element.TypeParameterElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
35 |
import javax.lang.model.element.VariableElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
36 |
import javax.lang.model.type.ArrayType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
37 |
import javax.lang.model.type.DeclaredType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
38 |
import javax.lang.model.type.ErrorType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
39 |
import javax.lang.model.type.TypeMirror; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
40 |
import javax.lang.model.type.TypeVariable; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
41 |
import javax.lang.model.type.WildcardType; |
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47216
diff
changeset
|
42 |
import javax.lang.model.util.ElementFilter; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
43 |
import javax.lang.model.util.Elements; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
44 |
import javax.lang.model.util.SimpleElementVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
45 |
import javax.lang.model.util.SimpleTypeVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
46 |
import javax.lang.model.util.Types; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
47 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
48 |
import jdk.javadoc.doclet.DocletEnvironment; |
45417 | 49 |
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration; |
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47216
diff
changeset
|
50 |
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.Kind; |
10 | 51 |
|
52 |
/** |
|
53 |
* Map all class uses for a given class. |
|
54 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
55 |
* <p> |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
56 |
* <b>This is NOT part of any supported API. If you write code that depends on this, you do so at |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
57 |
* your own risk. This code and its internal interfaces are subject to change or deletion without |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
58 |
* notice.</b> |
10 | 59 |
* |
60 |
* @author Robert G. Field |
|
61 |
*/ |
|
62 |
public class ClassUseMapper { |
|
63 |
||
64 |
private final ClassTree classtree; |
|
65 |
||
66 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
67 |
* Mapping of TypeElements to set of PackageElements used by that class. |
10 | 68 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
69 |
public final Map<TypeElement, Set<PackageElement>> classToPackage; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
70 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
71 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
72 |
* Mapping of TypeElements representing annotations to a set of PackageElements that use the annotation. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
73 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
74 |
public final Map<TypeElement, List<PackageElement>> classToPackageAnnotations = new HashMap<>(); |
10 | 75 |
|
76 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
77 |
* Mapping of TypeElements to a set of TypeElements used by that class. |
10 | 78 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
79 |
public final Map<TypeElement, Set<TypeElement>> classToClass = new HashMap<>(); |
10 | 80 |
|
81 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
82 |
* Mapping of TypeElements to a list of TypeElements which are direct or indirect subClasses of |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
83 |
* that class. |
10 | 84 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
85 |
public final Map<TypeElement, List<TypeElement>> classToSubclass = new HashMap<>(); |
10 | 86 |
|
87 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
88 |
* Mapping of TypeElements to list of TypeElements which are direct or indirect subInterfaces of |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
89 |
* that interface. |
10 | 90 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
91 |
public final Map<TypeElement, List<TypeElement>> classToSubinterface = new HashMap<>(); |
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 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
94 |
* Mapping of TypeElements to list of TypeElements which implement this interface. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
95 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
96 |
public Map<TypeElement, List<TypeElement>> classToImplementingClass = new HashMap<>(); |
10 | 97 |
|
98 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
99 |
* Mapping of TypeElements to list of VariableElements declared as that class. |
10 | 100 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
101 |
public final Map<TypeElement, List<VariableElement>> classToField = new HashMap<>(); |
10 | 102 |
|
103 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
104 |
* Mapping of TypeElements to list of ExecutableElements returning that class. |
10 | 105 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
106 |
public final Map<TypeElement, List<ExecutableElement>> classToMethodReturn = new HashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
107 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
108 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
109 |
* Mapping of TypeElements to list of ExecutableElements having that class as an arg. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
110 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
111 |
public final Map<TypeElement, List<ExecutableElement>> classToMethodArgs = new HashMap<>(); |
10 | 112 |
|
113 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
114 |
* Mapping of TypeElements to list of ExecutableElements which throws that class. |
10 | 115 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
116 |
public final Map<TypeElement, List<ExecutableElement>> classToMethodThrows = new HashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
117 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
118 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
119 |
* Mapping of TypeElements to list of ExecutableElements (constructors) having that |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
120 |
* class as an arg. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
121 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
122 |
public final Map<TypeElement, List<ExecutableElement>> classToConstructorArgs = new HashMap<>(); |
10 | 123 |
|
124 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
125 |
* Mapping of TypeElements to list of constructors which throws that class. |
10 | 126 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
127 |
public final Map<TypeElement, List<ExecutableElement>> classToConstructorThrows = new HashMap<>(); |
10 | 128 |
|
129 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
130 |
* The mapping of TypeElements representing annotations to constructors that use them. |
10 | 131 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
132 |
public final Map<TypeElement, List<ExecutableElement>> classToConstructorAnnotations = new HashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
133 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
134 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
135 |
* The mapping of TypeElement representing annotations to constructor parameters that use them. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
136 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
137 |
public final Map<TypeElement, List<ExecutableElement>> classToConstructorParamAnnotation = new HashMap<>(); |
10 | 138 |
|
139 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
140 |
* The mapping of TypeElements to constructor arguments that use them as type parameters. |
10 | 141 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
142 |
public final Map<TypeElement, List<ExecutableElement>> classToConstructorArgTypeParam = new HashMap<>(); |
10 | 143 |
|
144 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
145 |
* The mapping of TypeElement to TypeElement that use them as type parameters. |
10 | 146 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
147 |
public final Map<TypeElement, List<TypeElement>> classToClassTypeParam = new HashMap<>(); |
10 | 148 |
|
149 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
150 |
* The mapping of TypeElement representing annotation to TypeElements that use them. |
10 | 151 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
152 |
public final Map<TypeElement, List<TypeElement>> classToClassAnnotations = new HashMap<>(); |
10 | 153 |
|
154 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
155 |
* The mapping of TypeElement to methods that use them as type parameters. |
10 | 156 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
157 |
public final Map<TypeElement, List<ExecutableElement>> classToMethodTypeParam = new HashMap<>(); |
10 | 158 |
|
159 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
160 |
* The mapping of TypeElement to method arguments that use them as type parameters. |
10 | 161 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
162 |
public final Map<TypeElement, List<ExecutableElement>> classToMethodArgTypeParam = new HashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
163 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
164 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
165 |
* The mapping of TypeElement representing annotation to methods that use them. |
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 final Map<TypeElement, List<ExecutableElement>> classToMethodAnnotations = new HashMap<>(); |
10 | 168 |
|
169 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
170 |
* The mapping of TypeElements to methods that have return type with type parameters |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
171 |
* of that class. |
10 | 172 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
173 |
public final Map<TypeElement, List<ExecutableElement>> classToMethodReturnTypeParam = new HashMap<>(); |
10 | 174 |
|
175 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
176 |
* The mapping of TypeElements representing annotations to method parameters that use them. |
10 | 177 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
178 |
public final Map<TypeElement, List<ExecutableElement>> classToMethodParamAnnotation = new HashMap<>(); |
10 | 179 |
|
180 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
181 |
* The mapping of TypeElements to fields that use them as type parameters. |
10 | 182 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
183 |
public final Map<TypeElement, List<VariableElement>> classToFieldTypeParam = new HashMap<>(); |
10 | 184 |
|
185 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
186 |
* The mapping of TypeElements representing annotation to fields that use them. |
10 | 187 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
188 |
public final Map<TypeElement, List<VariableElement>> annotationToField = new HashMap<>(); |
10 | 189 |
|
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
35426
diff
changeset
|
190 |
private final DocletEnvironment docEnv; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
191 |
private final Elements elementUtils; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
192 |
private final Types typeUtils; |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25874
diff
changeset
|
193 |
private final Utils utils; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
194 |
|
45417 | 195 |
public ClassUseMapper(HtmlConfiguration configuration, ClassTree classtree) { |
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
35426
diff
changeset
|
196 |
docEnv = configuration.docEnv; |
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
35426
diff
changeset
|
197 |
elementUtils = docEnv.getElementUtils(); |
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
35426
diff
changeset
|
198 |
typeUtils = docEnv.getTypeUtils(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
199 |
utils = configuration.utils; |
10 | 200 |
this.classtree = classtree; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
201 |
classToPackage = new TreeMap<>(utils.makeClassUseComparator()); |
10 | 202 |
// Map subclassing, subinterfacing implementing, ... |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
203 |
for (TypeElement te : classtree.baseClasses()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
204 |
subclasses(te); |
10 | 205 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
206 |
for (TypeElement intfc : classtree.baseInterfaces()) { |
10 | 207 |
// does subinterfacing as side-effect |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
208 |
implementingClasses(intfc); |
10 | 209 |
} |
210 |
// Map methods, fields, constructors using a class. |
|
42277 | 211 |
Set<TypeElement> classes = configuration.getIncludedTypeElements(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
212 |
for (TypeElement aClass : classes) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
213 |
PackageElement pkg = elementUtils.getPackageOf(aClass); |
10 | 214 |
mapAnnotations(classToPackageAnnotations, pkg, pkg); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
215 |
mapTypeParameters(classToClassTypeParam, aClass, aClass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
216 |
mapAnnotations(classToClassAnnotations, aClass, aClass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
217 |
List<VariableElement> fields = utils.getFields(aClass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
218 |
for (VariableElement fd : fields) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
219 |
mapTypeParameters(classToFieldTypeParam, fd, fd); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
220 |
mapAnnotations(annotationToField, fd, fd); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
221 |
SimpleTypeVisitor9<Void, VariableElement> stv = new SimpleTypeVisitor9<Void, VariableElement>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
222 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
223 |
public Void visitArray(ArrayType t, VariableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
224 |
return visit(t.getComponentType(), p); |
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 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
227 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
228 |
public Void visitDeclared(DeclaredType t, VariableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
229 |
add(classToField, (TypeElement) t.asElement(), p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
230 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
231 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
232 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
233 |
public Void visitTypeVariable(TypeVariable t, VariableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
234 |
return visit(typeUtils.erasure(t), p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
235 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
236 |
}; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
237 |
stv.visit(fd.asType(), fd); |
10 | 238 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
239 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
240 |
List<ExecutableElement> ctors = utils.getConstructors(aClass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
241 |
for (ExecutableElement ctor : ctors) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
242 |
mapAnnotations(classToConstructorAnnotations, ctor, ctor); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
243 |
mapExecutable(ctor); |
10 | 244 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
245 |
|
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47216
diff
changeset
|
246 |
VisibleMemberMap vmm = configuration.getVisibleMemberMap(aClass, Kind.METHODS); |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47216
diff
changeset
|
247 |
List<ExecutableElement> methods = ElementFilter.methodsIn(vmm.getMembers(aClass)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
248 |
for (ExecutableElement method : methods) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
249 |
mapExecutable(method); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
250 |
mapTypeParameters(classToMethodTypeParam, method, method); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
251 |
mapAnnotations(classToMethodAnnotations, method, method); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
252 |
SimpleTypeVisitor9<Void, ExecutableElement> stv = new SimpleTypeVisitor9<Void, ExecutableElement>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
253 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
254 |
public Void visitArray(ArrayType t, ExecutableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
255 |
TypeMirror componentType = t.getComponentType(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
256 |
return visit(utils.isTypeVariable(componentType) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
257 |
? typeUtils.erasure(componentType) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
258 |
: componentType, p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
259 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
260 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
261 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
262 |
public Void visitDeclared(DeclaredType t, ExecutableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
263 |
mapTypeParameters(classToMethodReturnTypeParam, t, p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
264 |
add(classToMethodReturn, (TypeElement) t.asElement(), p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
265 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
266 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
267 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
268 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
269 |
protected Void defaultAction(TypeMirror e, ExecutableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
270 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
271 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
272 |
}; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
273 |
stv.visit(method.getReturnType(), method); |
10 | 274 |
} |
275 |
} |
|
276 |
} |
|
277 |
||
278 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
279 |
* Return all subClasses of a class AND fill-in classToSubclass map. |
10 | 280 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
281 |
private Collection<TypeElement> subclasses(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
282 |
Collection<TypeElement> ret = classToSubclass.get(te); |
10 | 283 |
if (ret == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
284 |
ret = new TreeSet<>(utils.makeClassUseComparator()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
285 |
Set<TypeElement> subs = classtree.subClasses(te); |
10 | 286 |
if (subs != null) { |
287 |
ret.addAll(subs); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
288 |
for (TypeElement sub : subs) { |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
19667
diff
changeset
|
289 |
ret.addAll(subclasses(sub)); |
10 | 290 |
} |
291 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
292 |
addAll(classToSubclass, te, ret); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
293 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
294 |
return ret; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
295 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
296 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
297 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
298 |
* Return all subInterfaces of an interface AND fill-in classToSubinterface map. |
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 |
private Collection<TypeElement> subinterfaces(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
301 |
Collection<TypeElement> ret = classToSubinterface.get(te); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
302 |
if (ret == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
303 |
ret = new TreeSet<>(utils.makeClassUseComparator()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
304 |
Set<TypeElement> subs = classtree.subInterfaces(te); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
305 |
if (subs != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
306 |
ret.addAll(subs); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
307 |
for (TypeElement sub : subs) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
308 |
ret.addAll(subinterfaces(sub)); |
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 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
311 |
addAll(classToSubinterface, te, ret); |
10 | 312 |
} |
313 |
return ret; |
|
314 |
} |
|
315 |
||
316 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
317 |
* Return all implementing classes of an interface (including all subClasses of implementing |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
318 |
* classes and all classes implementing subInterfaces) AND fill-in both classToImplementingClass |
10 | 319 |
* and classToSubinterface maps. |
320 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
321 |
private Collection<TypeElement> implementingClasses(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
322 |
Collection<TypeElement> ret = classToImplementingClass.get(te); |
10 | 323 |
if (ret == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
324 |
ret = new TreeSet<>(utils.makeClassUseComparator()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
325 |
Set<TypeElement> impl = classtree.implementingClasses(te); |
10 | 326 |
if (impl != null) { |
327 |
ret.addAll(impl); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
328 |
for (TypeElement anImpl : impl) { |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
19667
diff
changeset
|
329 |
ret.addAll(subclasses(anImpl)); |
10 | 330 |
} |
331 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
332 |
for (TypeElement intfc : subinterfaces(te)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
333 |
ret.addAll(implementingClasses(intfc)); |
10 | 334 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
335 |
addAll(classToImplementingClass, te, ret); |
10 | 336 |
} |
337 |
return ret; |
|
338 |
} |
|
339 |
||
340 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
341 |
* Determine classes used by a method or constructor, so they can be inverse mapped. |
10 | 342 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
343 |
private void mapExecutable(ExecutableElement ee) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
344 |
final boolean isConstructor = utils.isConstructor(ee); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
345 |
Set<TypeMirror> classArgs = new TreeSet<>(utils.makeTypeMirrorClassUseComparator()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
346 |
for (VariableElement param : ee.getParameters()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
347 |
TypeMirror pType = param.asType(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
348 |
// primitives don't get mapped and type variables are mapped elsewhere |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
349 |
if (!pType.getKind().isPrimitive() && !utils.isTypeVariable(pType)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
350 |
// no duplicates please |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
351 |
if (classArgs.add(pType)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
352 |
new SimpleTypeVisitor9<Void, ExecutableElement>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
353 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
354 |
public Void visitArray(ArrayType t, ExecutableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
355 |
return visit(t.getComponentType(), p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
356 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
357 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
358 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
359 |
public Void visitDeclared(DeclaredType t, ExecutableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
360 |
add(isConstructor |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
361 |
? classToConstructorArgs |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
362 |
: classToMethodArgs, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
363 |
(TypeElement) t.asElement(), p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
364 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
365 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
366 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
367 |
public Void visitTypeVariable(TypeVariable t, ExecutableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
368 |
visit(typeUtils.erasure(t), p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
369 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
370 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
371 |
}.visit(pType, ee); |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25874
diff
changeset
|
372 |
mapTypeParameters(isConstructor |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
373 |
? classToConstructorArgTypeParam |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
374 |
: classToMethodArgTypeParam, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
375 |
pType, ee); |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25874
diff
changeset
|
376 |
} |
10 | 377 |
} |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25874
diff
changeset
|
378 |
mapAnnotations(isConstructor |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
379 |
? classToConstructorParamAnnotation |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
380 |
: classToMethodParamAnnotation, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
381 |
param, ee); |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25874
diff
changeset
|
382 |
|
10 | 383 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
384 |
for (TypeMirror anException : ee.getThrownTypes()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
385 |
SimpleTypeVisitor9<Void, ExecutableElement> stv = new SimpleTypeVisitor9<Void, ExecutableElement>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
386 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
387 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
388 |
public Void visitArray(ArrayType t, ExecutableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
389 |
super.visit(t.getComponentType(), p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
390 |
return null; |
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 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
393 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
394 |
public Void visitDeclared(DeclaredType t, ExecutableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
395 |
add(isConstructor ? classToConstructorThrows : classToMethodThrows, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
396 |
(TypeElement) t.asElement(), p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
397 |
return null; |
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 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
400 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
401 |
public Void visitError(ErrorType t, ExecutableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
402 |
add(isConstructor ? classToConstructorThrows : classToMethodThrows, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
403 |
(TypeElement) t.asElement(), p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
404 |
return null; |
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 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
407 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
408 |
protected Void defaultAction(TypeMirror e, ExecutableElement p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
409 |
throw new AssertionError("this should not happen"); |
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 |
}; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
412 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
413 |
stv.visit(typeUtils.erasure(anException), ee); |
10 | 414 |
} |
415 |
} |
|
416 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
417 |
private <T> List<T> refList(Map<TypeElement, List<T>> map, Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
418 |
List<T> list = map.get(element); |
10 | 419 |
if (list == null) { |
22163 | 420 |
list = new ArrayList<>(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
421 |
map.put((TypeElement) element, list); |
10 | 422 |
} |
423 |
return list; |
|
424 |
} |
|
425 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
426 |
private Set<PackageElement> packageSet(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
427 |
Set<PackageElement> pkgSet = classToPackage.get(te); |
10 | 428 |
if (pkgSet == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
429 |
pkgSet = new TreeSet<>(utils.makeClassUseComparator()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
430 |
classToPackage.put(te, pkgSet); |
10 | 431 |
} |
432 |
return pkgSet; |
|
433 |
} |
|
434 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
435 |
private Set<TypeElement> classSet(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
436 |
Set<TypeElement> clsSet = classToClass.get(te); |
10 | 437 |
if (clsSet == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
438 |
clsSet = new TreeSet<>(utils.makeClassUseComparator()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
439 |
classToClass.put(te, clsSet); |
10 | 440 |
} |
441 |
return clsSet; |
|
442 |
} |
|
443 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
444 |
private <T extends Element> void add(Map<TypeElement, List<T>> map, TypeElement te, T ref) { |
10 | 445 |
// add to specified map |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
446 |
refList(map, te).add(ref); |
10 | 447 |
// add ref's package to package map and class map |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
448 |
packageSet(te).add(elementUtils.getPackageOf(ref)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
449 |
TypeElement entry = (utils.isField((Element) ref) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
450 |
|| utils.isConstructor((Element) ref) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
451 |
|| utils.isMethod((Element) ref)) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
452 |
? (TypeElement) ref.getEnclosingElement() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
453 |
: (TypeElement) ref; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
454 |
classSet(te).add(entry); |
10 | 455 |
} |
456 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
457 |
private void addAll(Map<TypeElement, List<TypeElement>> map, TypeElement te, Collection<TypeElement> refs) { |
10 | 458 |
if (refs == null) { |
459 |
return; |
|
460 |
} |
|
461 |
// add to specified map |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
462 |
refList(map, te).addAll(refs); |
10 | 463 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
464 |
Set<PackageElement> pkgSet = packageSet(te); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
465 |
Set<TypeElement> clsSet = classSet(te); |
10 | 466 |
// add ref's package to package map and class map |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
467 |
for (TypeElement cls : refs) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
468 |
pkgSet.add(utils.containingPackage(cls)); |
868 | 469 |
clsSet.add(cls); |
10 | 470 |
} |
471 |
} |
|
472 |
||
473 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
474 |
* Map the TypeElements to the members that use them as type parameters. |
10 | 475 |
* |
476 |
* @param map the map the insert the information into. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
477 |
* @param element the te whose type parameters are being checked. |
10 | 478 |
* @param holder the holder that owns the type parameters. |
479 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
480 |
private <T extends Element> void mapTypeParameters(final Map<TypeElement, List<T>> map, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
481 |
Element element, final T holder) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
482 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
483 |
SimpleElementVisitor9<Void, Void> elementVisitor |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
484 |
= new SimpleElementVisitor9<Void, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
485 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
486 |
private void addParameters(TypeParameterElement e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
487 |
for (TypeMirror type : utils.getBounds(e)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
488 |
addTypeParameterToMap(map, type, holder); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
489 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
490 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
491 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
492 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
493 |
public Void visitType(TypeElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
494 |
for (TypeParameterElement param : e.getTypeParameters()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
495 |
addParameters(param); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
496 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
497 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
498 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
499 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
500 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
501 |
public Void visitExecutable(ExecutableElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
502 |
for (TypeParameterElement param : e.getTypeParameters()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
503 |
addParameters(param); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
504 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
505 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
506 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
507 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
508 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
509 |
protected Void defaultAction(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
510 |
mapTypeParameters(map, e.asType(), holder); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
511 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
512 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
513 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
514 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
515 |
public Void visitTypeParameter(TypeParameterElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
516 |
addParameters(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
517 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
518 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
519 |
}; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
520 |
elementVisitor.visit(element); |
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 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
523 |
private <T extends Element> void mapTypeParameters(final Map<TypeElement, List<T>> map, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
524 |
TypeMirror aType, final T holder) { |
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 |
SimpleTypeVisitor9<Void, Void> tv = new SimpleTypeVisitor9<Void, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
527 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
528 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
529 |
public Void visitWildcard(WildcardType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
530 |
TypeMirror bound = t.getExtendsBound(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
531 |
if (bound != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
532 |
addTypeParameterToMap(map, bound, holder); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
533 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
534 |
bound = t.getSuperBound(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
535 |
if (bound != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
536 |
addTypeParameterToMap(map, bound, holder); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
537 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
538 |
return null; |
10 | 539 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
540 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
541 |
// ParameterizedType |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
542 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
543 |
public Void visitDeclared(DeclaredType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
544 |
for (TypeMirror targ : t.getTypeArguments()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
545 |
addTypeParameterToMap(map, targ, holder); |
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 null; |
10 | 548 |
} |
35426
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 |
tv.visit(aType); |
10 | 551 |
} |
552 |
||
553 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
554 |
* Map the AnnotationType to the members that use them as type parameters. |
10 | 555 |
* |
556 |
* @param map the map the insert the information into. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
557 |
* @param element whose type parameters are being checked. |
10 | 558 |
* @param holder the holder that owns the type parameters. |
559 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
560 |
private <T extends Element> void mapAnnotations(final Map<TypeElement, List<T>> map, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
561 |
Element e, final T holder) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
562 |
new SimpleElementVisitor9<Void, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
563 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
564 |
void addAnnotations(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
565 |
for (AnnotationMirror a : e.getAnnotationMirrors()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
566 |
add(map, (TypeElement) a.getAnnotationType().asElement(), holder); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
567 |
} |
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 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
570 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
571 |
public Void visitPackage(PackageElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
572 |
for (AnnotationMirror a : e.getAnnotationMirrors()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
573 |
refList(map, a.getAnnotationType().asElement()).add(holder); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
574 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
575 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
576 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
577 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
578 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
579 |
protected Void defaultAction(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
580 |
addAnnotations(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
581 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
582 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
583 |
}.visit(e); |
10 | 584 |
} |
585 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
586 |
private <T extends Element> void addTypeParameterToMap(final Map<TypeElement, List<T>> map, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
587 |
TypeMirror type, final T holder) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
588 |
new SimpleTypeVisitor9<Void, Void>() { |
868 | 589 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
590 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
591 |
protected Void defaultAction(TypeMirror e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
592 |
return super.defaultAction(e, p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
593 |
} |
868 | 594 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40508
diff
changeset
|
595 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
596 |
public Void visitDeclared(DeclaredType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
597 |
add(map, (TypeElement) t.asElement(), holder); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
598 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
26270
diff
changeset
|
599 |
} |
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 |
}.visit(type); |
10 | 602 |
mapTypeParameters(map, type, holder); |
603 |
} |
|
604 |
} |