Thu, 04 Feb 2010 10:14:28 -0800
6923080: TreeScanner.visitNewClass should scan tree.typeargs
Reviewed-by: darcy
duke@1 | 1 | /* |
duke@1 | 2 | * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. |
duke@1 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 4 | * |
duke@1 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@1 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@1 | 7 | * published by the Free Software Foundation. Sun designates this |
duke@1 | 8 | * particular file as subject to the "Classpath" exception as provided |
duke@1 | 9 | * by Sun in the LICENSE file that accompanied this code. |
duke@1 | 10 | * |
duke@1 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 15 | * accompanied this code). |
duke@1 | 16 | * |
duke@1 | 17 | * You should have received a copy of the GNU General Public License version |
duke@1 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 20 | * |
duke@1 | 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@1 | 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@1 | 23 | * have any questions. |
duke@1 | 24 | */ |
duke@1 | 25 | |
duke@1 | 26 | package com.sun.javadoc; |
duke@1 | 27 | |
duke@1 | 28 | |
duke@1 | 29 | /** |
duke@1 | 30 | * Represents a java class or interface and provides access to |
duke@1 | 31 | * information about the class, the class's comment and tags, and the |
duke@1 | 32 | * members of the class. A ClassDoc only exists if it was |
duke@1 | 33 | * processed in this run of javadoc. References to classes |
duke@1 | 34 | * which may or may not have been processed in this run are |
duke@1 | 35 | * referred to using Type (which can be converted to ClassDoc, |
duke@1 | 36 | * if possible). |
duke@1 | 37 | * |
duke@1 | 38 | * @see Type |
duke@1 | 39 | * |
duke@1 | 40 | * @since 1.2 |
duke@1 | 41 | * @author Kaiyang Liu (original) |
duke@1 | 42 | * @author Robert Field (rewrite) |
duke@1 | 43 | */ |
duke@1 | 44 | public interface ClassDoc extends ProgramElementDoc, Type { |
duke@1 | 45 | |
duke@1 | 46 | /** |
duke@1 | 47 | * Return true if this class is abstract. Return true |
duke@1 | 48 | * for all interfaces. |
duke@1 | 49 | */ |
duke@1 | 50 | boolean isAbstract(); |
duke@1 | 51 | |
duke@1 | 52 | /** |
duke@1 | 53 | * Return true if this class implements or interface extends |
duke@1 | 54 | * <code>java.io.Serializable</code>. |
duke@1 | 55 | * |
duke@1 | 56 | * Since <code>java.io.Externalizable</code> extends |
duke@1 | 57 | * <code>java.io.Serializable</code>, |
duke@1 | 58 | * Externalizable objects are also Serializable. |
duke@1 | 59 | */ |
duke@1 | 60 | boolean isSerializable(); |
duke@1 | 61 | |
duke@1 | 62 | /** |
duke@1 | 63 | * Return true if this class implements or interface extends |
duke@1 | 64 | * <code>java.io.Externalizable</code>. |
duke@1 | 65 | */ |
duke@1 | 66 | boolean isExternalizable(); |
duke@1 | 67 | |
duke@1 | 68 | /** |
duke@1 | 69 | * Return the serialization methods for this class or |
duke@1 | 70 | * interface. |
duke@1 | 71 | * |
duke@1 | 72 | * @return an array of MethodDoc objects that represents |
duke@1 | 73 | * the serialization methods for this class or interface. |
duke@1 | 74 | */ |
duke@1 | 75 | MethodDoc[] serializationMethods(); |
duke@1 | 76 | |
duke@1 | 77 | /** |
duke@1 | 78 | * Return the Serializable fields of this class or interface. |
duke@1 | 79 | * <p> |
duke@1 | 80 | * Return either a list of default fields documented by |
duke@1 | 81 | * <code>serial</code> tag<br> |
duke@1 | 82 | * or return a single <code>FieldDoc</code> for |
duke@1 | 83 | * <code>serialPersistentField</code> member. |
duke@1 | 84 | * There should be a <code>serialField</code> tag for |
duke@1 | 85 | * each Serializable field defined by an <code>ObjectStreamField</code> |
duke@1 | 86 | * array component of <code>serialPersistentField</code>. |
duke@1 | 87 | * |
duke@1 | 88 | * @return an array of <code>FieldDoc</code> objects for the Serializable |
duke@1 | 89 | * fields of this class or interface. |
duke@1 | 90 | * |
duke@1 | 91 | * @see #definesSerializableFields() |
duke@1 | 92 | * @see SerialFieldTag |
duke@1 | 93 | */ |
duke@1 | 94 | FieldDoc[] serializableFields(); |
duke@1 | 95 | |
duke@1 | 96 | /** |
duke@1 | 97 | * Return true if Serializable fields are explicitly defined with |
duke@1 | 98 | * the special class member <code>serialPersistentFields</code>. |
duke@1 | 99 | * |
duke@1 | 100 | * @see #serializableFields() |
duke@1 | 101 | * @see SerialFieldTag |
duke@1 | 102 | */ |
duke@1 | 103 | boolean definesSerializableFields(); |
duke@1 | 104 | |
duke@1 | 105 | /** |
duke@1 | 106 | * Return the superclass of this class. Return null if this is an |
duke@1 | 107 | * interface. |
duke@1 | 108 | * |
duke@1 | 109 | * <p> <i>This method cannot accommodate certain generic type constructs. |
duke@1 | 110 | * The <code>superclassType</code> method should be used instead.</i> |
duke@1 | 111 | * |
duke@1 | 112 | * @return the ClassDoc for the superclass of this class, null if |
duke@1 | 113 | * there is no superclass. |
duke@1 | 114 | * @see #superclassType |
duke@1 | 115 | */ |
duke@1 | 116 | ClassDoc superclass(); |
duke@1 | 117 | |
duke@1 | 118 | /** |
duke@1 | 119 | * Return the superclass of this class. Return null if this is an |
duke@1 | 120 | * interface. A superclass is represented by either a |
duke@1 | 121 | * <code>ClassDoc</code> or a <code>ParametrizedType</code>. |
duke@1 | 122 | * |
duke@1 | 123 | * @return the superclass of this class, or null if there is no superclass. |
duke@1 | 124 | * @since 1.5 |
duke@1 | 125 | */ |
duke@1 | 126 | Type superclassType(); |
duke@1 | 127 | |
duke@1 | 128 | /** |
duke@1 | 129 | * Test whether this class is a subclass of the specified class. |
duke@1 | 130 | * If this is an interface, return false for all classes except |
duke@1 | 131 | * <code>java.lang.Object</code> (we must keep this unexpected |
duke@1 | 132 | * behavior for compatibility reasons). |
duke@1 | 133 | * |
duke@1 | 134 | * @param cd the candidate superclass. |
duke@1 | 135 | * @return true if cd is a superclass of this class. |
duke@1 | 136 | */ |
duke@1 | 137 | boolean subclassOf(ClassDoc cd); |
duke@1 | 138 | |
duke@1 | 139 | /** |
duke@1 | 140 | * Return interfaces implemented by this class or interfaces extended |
duke@1 | 141 | * by this interface. Includes only directly-declared interfaces, not |
duke@1 | 142 | * inherited interfaces. |
duke@1 | 143 | * Return an empty array if there are no interfaces. |
duke@1 | 144 | * |
duke@1 | 145 | * <p> <i>This method cannot accommodate certain generic type constructs. |
duke@1 | 146 | * The <code>interfaceTypes</code> method should be used instead.</i> |
duke@1 | 147 | * |
duke@1 | 148 | * @return an array of ClassDoc objects representing the interfaces. |
duke@1 | 149 | * @see #interfaceTypes |
duke@1 | 150 | */ |
duke@1 | 151 | ClassDoc[] interfaces(); |
duke@1 | 152 | |
duke@1 | 153 | /** |
duke@1 | 154 | * Return interfaces implemented by this class or interfaces extended |
duke@1 | 155 | * by this interface. Includes only directly-declared interfaces, not |
duke@1 | 156 | * inherited interfaces. |
duke@1 | 157 | * Return an empty array if there are no interfaces. |
duke@1 | 158 | * |
duke@1 | 159 | * @return an array of interfaces, each represented by a |
duke@1 | 160 | * <code>ClassDoc</code> or a <code>ParametrizedType</code>. |
duke@1 | 161 | * @since 1.5 |
duke@1 | 162 | */ |
duke@1 | 163 | Type[] interfaceTypes(); |
duke@1 | 164 | |
duke@1 | 165 | /** |
duke@1 | 166 | * Return the formal type parameters of this class or interface. |
duke@1 | 167 | * Return an empty array if there are none. |
duke@1 | 168 | * |
duke@1 | 169 | * @return the formal type parameters of this class or interface. |
duke@1 | 170 | * @since 1.5 |
duke@1 | 171 | */ |
duke@1 | 172 | TypeVariable[] typeParameters(); |
duke@1 | 173 | |
duke@1 | 174 | /** |
duke@1 | 175 | * Return the type parameter tags of this class or interface. |
duke@1 | 176 | * Return an empty array if there are none. |
duke@1 | 177 | * |
duke@1 | 178 | * @return the type parameter tags of this class or interface. |
duke@1 | 179 | * @since 1.5 |
duke@1 | 180 | */ |
duke@1 | 181 | ParamTag[] typeParamTags(); |
duke@1 | 182 | |
duke@1 | 183 | /** |
duke@1 | 184 | * Return |
duke@1 | 185 | * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a> |
duke@1 | 186 | * fields in this class or interface. |
duke@1 | 187 | * Excludes enum constants if this is an enum type. |
duke@1 | 188 | * |
duke@1 | 189 | * @return an array of FieldDoc objects representing the included |
duke@1 | 190 | * fields in this class or interface. |
duke@1 | 191 | */ |
duke@1 | 192 | FieldDoc[] fields(); |
duke@1 | 193 | |
duke@1 | 194 | /** |
duke@1 | 195 | * Return fields in this class or interface, filtered to the specified |
duke@1 | 196 | * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access |
duke@1 | 197 | * modifier option</a>. |
duke@1 | 198 | * Excludes enum constants if this is an enum type. |
duke@1 | 199 | * |
duke@1 | 200 | * @param filter Specify true to filter according to the specified access |
duke@1 | 201 | * modifier option. |
duke@1 | 202 | * Specify false to include all fields regardless of |
duke@1 | 203 | * access modifier option. |
duke@1 | 204 | * @return an array of FieldDoc objects representing the included |
duke@1 | 205 | * fields in this class or interface. |
duke@1 | 206 | */ |
duke@1 | 207 | FieldDoc[] fields(boolean filter); |
duke@1 | 208 | |
duke@1 | 209 | /** |
duke@1 | 210 | * Return the enum constants if this is an enum type. |
duke@1 | 211 | * Return an empty array if there are no enum constants, or if |
duke@1 | 212 | * this is not an enum type. |
duke@1 | 213 | * |
duke@1 | 214 | * @return the enum constants if this is an enum type. |
duke@1 | 215 | */ |
duke@1 | 216 | FieldDoc[] enumConstants(); |
duke@1 | 217 | |
duke@1 | 218 | /** |
duke@1 | 219 | * Return |
duke@1 | 220 | * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a> |
duke@1 | 221 | * methods in this class or interface. |
duke@1 | 222 | * Same as <code>methods(true)</code>. |
duke@1 | 223 | * |
duke@1 | 224 | * @return an array of MethodDoc objects representing the included |
duke@1 | 225 | * methods in this class or interface. Does not include |
duke@1 | 226 | * constructors or annotation type elements. |
duke@1 | 227 | */ |
duke@1 | 228 | MethodDoc[] methods(); |
duke@1 | 229 | |
duke@1 | 230 | /** |
duke@1 | 231 | * Return methods in this class or interface, filtered to the specified |
duke@1 | 232 | * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access |
duke@1 | 233 | * modifier option</a>. Does not include constructors or annotation |
duke@1 | 234 | * type elements. |
duke@1 | 235 | * |
duke@1 | 236 | * @param filter Specify true to filter according to the specified access |
duke@1 | 237 | * modifier option. |
duke@1 | 238 | * Specify false to include all methods regardless of |
duke@1 | 239 | * access modifier option. |
duke@1 | 240 | * @return an array of MethodDoc objects representing the included |
duke@1 | 241 | * methods in this class or interface. |
duke@1 | 242 | */ |
duke@1 | 243 | MethodDoc[] methods(boolean filter); |
duke@1 | 244 | |
duke@1 | 245 | /** |
duke@1 | 246 | * Return |
duke@1 | 247 | * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a> |
duke@1 | 248 | * constructors in this class. An array containing the default |
duke@1 | 249 | * no-arg constructor is returned if no other constructors exist. |
duke@1 | 250 | * Return empty array if this is an interface. |
duke@1 | 251 | * |
duke@1 | 252 | * @return an array of ConstructorDoc objects representing the included |
duke@1 | 253 | * constructors in this class. |
duke@1 | 254 | */ |
duke@1 | 255 | ConstructorDoc[] constructors(); |
duke@1 | 256 | |
duke@1 | 257 | /** |
duke@1 | 258 | * Return constructors in this class, filtered to the specified |
duke@1 | 259 | * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access |
duke@1 | 260 | * modifier option</a>. Return an array containing the default |
duke@1 | 261 | * no-arg constructor if no other constructors exist. |
duke@1 | 262 | * |
duke@1 | 263 | * @param filter Specify true to filter according to the specified access |
duke@1 | 264 | * modifier option. |
duke@1 | 265 | * Specify false to include all constructors regardless of |
duke@1 | 266 | * access modifier option. |
duke@1 | 267 | * @return an array of ConstructorDoc objects representing the included |
duke@1 | 268 | * constructors in this class. |
duke@1 | 269 | */ |
duke@1 | 270 | ConstructorDoc[] constructors(boolean filter); |
duke@1 | 271 | |
duke@1 | 272 | |
duke@1 | 273 | /** |
duke@1 | 274 | * Return |
duke@1 | 275 | * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a> |
duke@1 | 276 | * nested classes and interfaces within this class or interface. |
duke@1 | 277 | * This includes both static and non-static nested classes. |
duke@1 | 278 | * (This method should have been named <code>nestedClasses()</code>, |
duke@1 | 279 | * as inner classes are technically non-static.) Anonymous and local classes |
duke@1 | 280 | * or interfaces are not included. |
duke@1 | 281 | * |
duke@1 | 282 | * @return an array of ClassDoc objects representing the included classes |
duke@1 | 283 | * and interfaces defined in this class or interface. |
duke@1 | 284 | */ |
duke@1 | 285 | ClassDoc[] innerClasses(); |
duke@1 | 286 | |
duke@1 | 287 | /** |
duke@1 | 288 | * Return nested classes and interfaces within this class or interface |
duke@1 | 289 | * filtered to the specified |
duke@1 | 290 | * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">access |
duke@1 | 291 | * modifier option</a>. |
duke@1 | 292 | * This includes both static and non-static nested classes. |
duke@1 | 293 | * Anonymous and local classes are not included. |
duke@1 | 294 | * |
duke@1 | 295 | * @param filter Specify true to filter according to the specified access |
duke@1 | 296 | * modifier option. |
duke@1 | 297 | * Specify false to include all nested classes regardless of |
duke@1 | 298 | * access modifier option. |
duke@1 | 299 | * @return a filtered array of ClassDoc objects representing the included |
duke@1 | 300 | * classes and interfaces defined in this class or interface. |
duke@1 | 301 | */ |
duke@1 | 302 | ClassDoc[] innerClasses(boolean filter); |
duke@1 | 303 | |
duke@1 | 304 | /** |
duke@1 | 305 | * Find the specified class or interface within the context of this class doc. |
duke@1 | 306 | * Search order: 1) qualified name, 2) nested in this class or interface, |
duke@1 | 307 | * 3) in this package, 4) in the class imports, 5) in the package imports. |
duke@1 | 308 | * Return the ClassDoc if found, null if not found. |
duke@1 | 309 | */ |
duke@1 | 310 | ClassDoc findClass(String className); |
duke@1 | 311 | |
duke@1 | 312 | /** |
duke@1 | 313 | * Get the list of classes and interfaces declared as imported. |
duke@1 | 314 | * These are called "single-type-import declarations" in the |
duke@1 | 315 | * Java Language Specification. |
duke@1 | 316 | * |
duke@1 | 317 | * @return an array of ClassDoc representing the imported classes. |
duke@1 | 318 | * |
duke@1 | 319 | * @deprecated Import declarations are implementation details that |
duke@1 | 320 | * should not be exposed here. In addition, not all imported |
duke@1 | 321 | * classes are imported through single-type-import declarations. |
duke@1 | 322 | */ |
duke@1 | 323 | @Deprecated |
duke@1 | 324 | ClassDoc[] importedClasses(); |
duke@1 | 325 | |
duke@1 | 326 | /** |
duke@1 | 327 | * Get the list of packages declared as imported. |
duke@1 | 328 | * These are called "type-import-on-demand declarations" in the |
duke@1 | 329 | * Java Language Specification. |
duke@1 | 330 | * |
duke@1 | 331 | * @return an array of PackageDoc representing the imported packages. |
duke@1 | 332 | * |
duke@1 | 333 | * @deprecated Import declarations are implementation details that |
duke@1 | 334 | * should not be exposed here. In addition, this method's |
duke@1 | 335 | * return type does not allow for all type-import-on-demand |
duke@1 | 336 | * declarations to be returned. |
duke@1 | 337 | */ |
duke@1 | 338 | @Deprecated |
duke@1 | 339 | PackageDoc[] importedPackages(); |
duke@1 | 340 | } |