/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Represents a java class and provides access to information
* about the class, the class' comment and tags, and the
* members of the class. A ClassDocImpl only exists if it was
* processed in this run of javadoc. References to classes
* which may or may not have been processed in this run are
* referred to using Type (which can be converted to ClassDocImpl,
* if possible).
*
* @see Type
*
* @since 1.2
* @author Robert Field
* @author Neal Gafter (rewrite)
* @author Scott Seligman (generics, enums, annotations)
*/
/**
* Constructor
*/
}
/**
* Constructor
*/
}
/**
* Returns the flags in terms of javac's flags
*/
protected long getFlags() {
}
/**
* Returns the flags of a ClassSymbol in terms of javac's flags
*/
while (true) {
try {
} catch (CompletionFailure ex) {
// quietly ignore completion failures
}
}
}
/**
* Is a ClassSymbol an annotation type?
*/
}
/**
* Identify the containing class
*/
}
/**
* Return true if this is a class, not an interface.
*/
public boolean isClass() {
}
/**
* Return true if this is a ordinary class,
* not an enumeration, exception, an error, or an interface.
*/
public boolean isOrdinaryClass() {
return false;
}
return false;
}
}
return true;
}
/**
* Return true if this is an enumeration.
* (For legacy doclets, return false.)
*/
public boolean isEnum() {
&&
}
/**
* Return true if this is an interface, but not an annotation type.
* Overridden by AnnotationTypeDocImpl.
*/
public boolean isInterface() {
}
/**
* Return true if this is an exception class
*/
public boolean isException() {
return false;
}
return true;
}
}
return false;
}
/**
* Return true if this is an error class
*/
public boolean isError() {
return false;
}
return true;
}
}
return false;
}
/**
* Return true if this is a throwable class
*/
public boolean isThrowable() {
return false;
}
return true;
}
}
return false;
}
/**
* Return true if this class is abstract
*/
public boolean isAbstract() {
}
/**
* Returns true if this class was synthesized by the compiler.
*/
public boolean isSynthetic() {
}
/**
* Return true if this class is included in the active set.
* A ClassDoc is included iff either it is specified on the
* commandline, or if it's containing package is specified
* on the command line, or if it is a member class of an
* included class.
*/
public boolean isIncluded() {
if (isIncluded) {
return true;
}
// Class is nameable from top-level and
// the class and all enclosing classes
// pass the modifier filter.
if (containingPackage().isIncluded()) {
return isIncluded=true;
}
return isIncluded=true;
}
}
return false;
}
/**
* Return the package that this class is contained in.
*/
if (p.setDocPath == false) {
try {
} catch (IOException e) {
}
// fall back on older semantics of looking in same directory as
// source file for this class
po instanceof SourcePositionImpl) {
}
}
}
}
}
p.setDocPath(docPath);
}
return p;
}
/**
* Return the class name without package qualifier - but with
* enclosing class qualifier - as a String.
* <pre>
* Examples:
* for java.util.Hashtable
* return Hashtable
* for java.util.Map.Entry
* return Map.Entry
* </pre>
*/
return getClassName(tsym, false);
}
/**
* Return the qualified class name as a String.
* <pre>
* Example:
* for java.util.Hashtable
* return java.util.Hashtable
* if no qualifier, just return flat name
* </pre>
*/
return getClassName(tsym, true);
}
/**
* Return unqualified name of type excluding any dimension information.
* <p>
* For example, a two dimensional array of String returns 'String'.
*/
return name();
}
/**
* Return qualified name of type excluding any dimension information.
*<p>
* For example, a two dimensional array of String
* returns 'java.lang.String'.
*/
return qualifiedName();
}
/**
* Return the simple name of this type.
*/
}
/**
* Return the qualified name and any type parameters.
* Each parameter is a type variable with optional bounds.
*/
}
/**
* Return the class name as a string. If "full" is true the name is
* qualified, otherwise it is qualified by its enclosing class(es) only.
*/
if (full) {
return c.getQualifiedName().toString();
} else {
String n = "";
}
return n;
}
}
/**
* Return the class name with any type parameters as a string.
* Each parameter is a type variable with optional bounds.
* If "full" is true all names are qualified, otherwise they are
* qualified by their enclosing class(es) only.
*/
StringBuilder s = new StringBuilder();
if (!c.isInner()) { // if c is not an inner class
} else {
// c is an inner class, so include type params of outer.
.append('.')
}
return s.toString();
}
/**
* Is this class (or any enclosing class) generic? That is, does
* it have type parameters?
*/
}
/**
* Return the formal type parameters of this class or interface.
* Return an empty array if there are none.
*/
if (env.legacyDoclet) {
return new TypeVariable[0];
}
return res;
}
/**
* Return the type parameter tags of this class or interface.
*/
return (env.legacyDoclet)
? new ParamTag[0]
: comment().typeParamTags();
}
/**
* Return the modifier string for this class. If it's an interface
* exclude 'abstract' keyword from the modifier string
*/
}
public int modifierSpecifier() {
int modifiers = getModifiers();
return (isInterface() || isAnnotationType())
: modifiers;
}
/**
* Return the superclass of this class
*
* @return the ClassDocImpl for the superclass of this class, null
* if there is no superclass.
*/
return env.getClassDoc(c);
}
/**
* Return the superclass of this class. Return null if this is an
* interface. A superclass is represented by either a
* <code>ClassDoc</code> or a <code>ParameterizedType</code>.
*/
if (isInterface() || isAnnotationType() ||
return null;
}
/**
* Test whether this class is a subclass of the specified class.
*
* @param cd the candidate superclass.
* @return true if cd is a superclass of this class.
*/
}
/**
* Return interfaces implemented by this class or interfaces
* extended by this interface.
*
* @return An array of ClassDocImpl representing the interfaces.
* Return an empty array if there are no interfaces.
*/
}
//### Cache ta here?
}
/**
* Return interfaces implemented by this class or interfaces extended
* by this interface. Includes only directly-declared interfaces, not
* inherited interfaces.
* Return an empty array if there are no interfaces.
*/
//### Cache result here?
}
/**
* Return fields in class.
* @param filter include only the included fields if filter==true
*/
}
/**
* Return included fields in class.
*/
return fields(true, false);
}
/**
* Return the enum constants if this is an enum type.
*/
return fields(false, true);
}
/**
* Return fields in class.
* @param filter if true, return only the included fields
* @param enumConstants if true, return the enum constants instead
*/
if (isEnum == enumConstants &&
}
}
}
}
/**
* Return methods in class.
* This method is overridden by AnnotationTypeDocImpl.
*
* @param filter include only the included methods if filter==true
* @return an array of MethodDocImpl for representing the visible
* methods in this class. Does not include constructors.
*/
}
}
}
//### Cache methods here?
}
/**
* Return included methods in class.
*
* @return an array of MethodDocImpl for representing the visible
* methods in this class. Does not include constructors.
*/
return methods(true);
}
/**
* Return constructors in class.
*
* @param filter include only the included constructors if filter==true
* @return an array of ConstructorDocImpl for representing the visible
* constructors in this class.
*/
}
}
}
//### Cache constructors here?
}
/**
* Return included constructors in class.
*
* @return an array of ConstructorDocImpl for representing the visible
* constructors in this class.
*/
return constructors(true);
}
/**
* Adds all inner classes of this class, and their
* inner classes recursively, to the list l.
*/
try {
if (isSynthetic()) return;
// sometimes synthetic classes are not marked synthetic
if (l.contains(this)) return;
l.append(this);
e = e.sibling) {
if (c.isSynthetic()) continue;
}
}
// this extra step preserves the ordering from oldjavadoc
}
} catch (CompletionFailure e) {
// quietly ignore completion failures
}
}
/**
* Return inner classes within this class.
*
* @param filter include only the included inner classes if filter==true.
* @return an array of ClassDocImpl for representing the visible
* classes defined in this class. Anonymous and local classes
* are not included.
*/
}
}
}
//### Cache classes here?
}
/**
* Return included inner classes within this class.
*
* @return an array of ClassDocImpl for representing the visible
* classes defined in this class. Anonymous and local classes
* are not included.
*/
return innerClasses(true);
}
/**
* Find a class within the context of this class.
* Search order: qualified name, in this class (inner),
* in this package, in the class imports, in the package
* imports.
* Return the ClassDocImpl if found, null if not found.
*/
//### The specified search order is not the normal rule the
//### compiler would use. Leave as specified or change it?
if (searchResult == null) {
//Expand search space to include enclosing class.
}
}
return searchResult;
}
// search by qualified name first
return cd;
}
// search inner classes
//### Add private entry point to avoid creating array?
//### Replicate code in innerClasses here to avoid consing?
//### This is from original javadoc but it looks suspicious to me...
//### I believe it is attempting to compensate for the confused
//### convention of including the nested class qualifiers in the
//### 'name' of the inner class, rather than the true simple name.
return icd;
} else {
return innercd;
}
}
}
// check in this package
return cd;
}
// make sure that this symbol has been completed
}
// search imports
//### This information is available only for source classes.
return c;
}
}
return c;
}
}
}
return null; // not found
}
// wildcard
return true;
}
int i = 0;
return false;
}
// For vararg method, "T..." matches type T[].
}
return false;
}
}
return true;
}
// where
return
||
||
}
/**
* Find a method in this class scope.
* Search order: this class, interfaces, superclasses, outerclasses.
* Note that this is not necessarily what the compiler would do!
*
* @param methodName the unqualified name to search for.
* @param paramTypeArray the array of Strings for method parameter types.
* @return the first MethodDocImpl which matches, null if not found.
*/
// Use hash table 'searched' to avoid searching same class twice.
//### It is not clear how this could happen.
}
//### Note that this search is not necessarily what the compiler would do!
// do not match constructors
return null;
}
return null;
}
//DEBUG
/*---------------------------------*
System.out.print("searching " + this + " for " + methodName);
if (paramTypes == null) {
System.out.println("()");
} else {
System.out.print("(");
for (int k=0; k < paramTypes.length; k++) {
System.out.print(paramTypes[k]);
if ((k + 1) < paramTypes.length) {
System.out.print(", ");
}
}
System.out.println(")");
}
*---------------------------------*/
// search current class
//### Using modifier filter here isn't really correct,
//### but emulates the old behavior. Instead, we should
//### apply the normal rules of visibility and inheritance.
if (paramTypes == null) {
// If no parameters specified, we are allowed to return
// any method with a matching name. In practice, the old
// code returned the first method, which is now the last!
// In order to provide textually identical results, we
// attempt to emulate the old behavior.
//### Should intern methodName as Name.
}
}
}
}
} else {
//### Should intern methodName as Name.
}
}
}
}
//### If we found a MethodDoc above, but which did not pass
//### the modifier filter, we should return failure here!
// search superclass
return mdi;
}
}
// search interfaces
return mdi;
}
}
// search enclosing class
return mdi;
}
}
//###(gj) As a temporary measure until type variables are better
//### handled, try again without the parameter types.
//### This should most often find the right method, and occassionally
//### find the wrong one.
//if (paramTypes != null) {
// return findMethod(methodName, null);
//}
return null;
}
/**
* Find constructor in this class.
*
* @param constrName the unqualified name to search for.
* @param paramTypeArray the array of Strings for constructor parameters.
* @return the first ConstructorDocImpl which matches, null if not found.
*/
String[] paramTypes) {
for (Scope.Entry e = tsym.members().lookup(names.fromString("<init>")); e.scope != null; e = e.next()) {
}
}
}
//###(gj) As a temporary measure until type variables are better
//### handled, try again without the parameter types.
//### This will often find the right constructor, and occassionally
//### find the wrong one.
//if (paramTypes != null) {
// return findConstructor(constrName, null);
//}
return null;
}
/**
* Find a field in this class scope.
* Search order: this class, outerclasses, interfaces,
* superclasses. IMP: If see tag is defined in an inner class,
* which extends a super class and if outerclass and the super
* class have a visible field in common then Java compiler cribs
* about the ambiguity, but the following code will search in the
* above given search order.
*
* @param fieldName the unqualified name to search for.
* @return the first FieldDocImpl which matches, null if not found.
*/
}
return null;
}
for (Scope.Entry e = tsym.members().lookup(names.fromString(fieldName)); e.scope != null; e = e.next()) {
//### Should intern fieldName as Name.
}
}
//### If we found a FieldDoc above, but which did not pass
//### the modifier filter, we should return failure here!
return fdi;
}
}
// search superclass
return fdi;
}
}
// search interfaces
return fdi;
}
}
return null;
}
/**
* Get the list of classes declared as imported.
* These are called "single-type-import declarations" in the JLS.
* This method is deprecated in the ClassDoc interface.
*
* @return an array of ClassDocImpl representing the imported classes.
*
* @deprecated Import declarations are implementation details that
* should not be exposed here. In addition, not all imported
* classes are imported through single-type-import declarations.
*/
// information is not available for binary classfiles
}
}
}
}
/**
* Get the list of packages declared as imported.
* These are called "type-import-on-demand declarations" in the JLS.
* This method is deprecated in the ClassDoc interface.
*
* @return an array of PackageDocImpl representing the imported packages.
*
* ###NOTE: the syntax supports importing all inner classes from a class as well.
* @deprecated Import declarations are implementation details that
* should not be exposed here. In addition, this method's
* return type does not allow for all type-import-on-demand
* declarations to be returned.
*/
// information is not available for binary classfiles
//### Add the implicit "import java.lang.*" to the result
}
}
}
}
/**
* Return the type's dimension information.
* Always return "", as this is not an array type.
*/
return "";
}
/**
* Return this type as a class, which it already is.
*/
return this;
}
/**
* Return null (unless overridden), as this is not an annotation type.
*/
return null;
}
/**
* Return null, as this is not a class instantiation.
*/
return null;
}
/**
* Return null, as this is not a type variable.
*/
return null;
}
/**
* Return null, as this is not a wildcard type.
*/
return null;
}
/**
* Return false, as this is not a primitive type.
*/
public boolean isPrimitive() {
return false;
}
//--- Serialization ---
//### These methods ignore modifier filter.
/**
* Return true if this class implements <code>java.io.Serializable</code>.
*
* Since <code>java.io.Externalizable</code> extends
* <code>java.io.Serializable</code>,
* Externalizable objects are also Serializable.
*/
public boolean isSerializable() {
try {
} catch (CompletionFailure ex) {
// quietly ignore completion failures
return false;
}
}
/**
* Return true if this class implements
* <code>java.io.Externalizable</code>.
*/
public boolean isExternalizable() {
try {
} catch (CompletionFailure ex) {
// quietly ignore completion failures
return false;
}
}
/**
* Return the serialization methods for this class.
*
* @return an array of <code>MethodDocImpl</code> that represents
* the serialization methods for this class.
*/
if (serializedForm == null) {
}
//### Clone this?
return serializedForm.methods();
}
/**
* Return the Serializable fields of class.<p>
*
* Return either a list of default fields documented by
* <code>serial</code> tag<br>
* or return a single <code>FieldDoc</code> for
* <code>serialPersistentField</code> member.
* There should be a <code>serialField</code> tag for
* each Serializable field defined by an <code>ObjectStreamField</code>
* array component of <code>serialPersistentField</code>.
*
* @returns an array of <code>FieldDoc</code> for the Serializable fields
* of this class.
*
* @see #definesSerializableFields()
* @see SerialFieldTagImpl
*/
if (serializedForm == null) {
}
//### Clone this?
return serializedForm.fields();
}
/**
* Return true if Serializable fields are explicitly defined with
* the special class member <code>serialPersistentFields</code>.
*
* @see #serializableFields()
* @see SerialFieldTagImpl
*/
public boolean definesSerializableFields() {
if (!isSerializable() || isExternalizable()) {
return false;
} else {
if (serializedForm == null) {
}
//### Clone this?
return serializedForm.definesSerializableFields();
}
}
/**
* Determine if a class is a RuntimeException.
* <p>
* Used only by ThrowsTagImpl.
*/
boolean isRuntimeException() {
}
/**
* Return the source position of the entity, or null if
* no position is available.
*/
lineMap);
}
}