122 |
return rc; |
return rc; |
123 |
} |
} |
124 |
|
|
|
|
|
|
/** |
|
|
* Find a class within the context of this class. |
|
|
* |
|
|
* @todo check this against java lang spec. (class id hiding) |
|
|
*/ |
|
|
public ClassDoc _findClass(String className) { |
|
|
|
|
|
//Debug.log(9,"findClass("+className+")"); |
|
|
ClassDoc rc; |
|
|
//Debug.log(9,"trying by name"); |
|
|
rc=Main.getRootDoc().classNamed(className); |
|
|
if (rc!=null) return rc; |
|
|
|
|
|
/* |
|
|
System.err.println("trying '"+containingPackage().name()+"."+className+"'"); |
|
|
rc=Main.getRootDoc().classNamed(containingPackage().name()+"."+className); |
|
|
if (rc!=null) return rc; |
|
|
*/ |
|
|
|
|
|
for (int i=0; i<importedClasses.length; ++i) { |
|
|
//Debug.log(9,"trying (by imported class)"); |
|
|
if (importedClasses[i].qualifiedName().endsWith("."+className)) { |
|
|
rc=Main.getRootDoc().classNamed(importedClasses[i].qualifiedName()); |
|
|
if (rc!=null) return rc; |
|
|
} |
|
|
if (null == importedClasses[i]) { |
|
|
System.err.println("importedClasses[" + i + "]=null"); |
|
|
} |
|
|
else if (null == className) { |
|
|
System.err.println("className=null"); |
|
|
} |
|
|
if (className.startsWith(importedClasses[i].name()+".")) { |
|
|
//Debug.log(9,"trying (by inner class) "+importedClasses[i].qualifiedName()+className.substring(importedClasses[i].name().length())); |
|
|
rc=Main.getRootDoc().classNamed(importedClasses[i].qualifiedName()+className.substring(importedClasses[i].name().length())); |
|
|
if (rc!=null) return rc; |
|
|
} |
|
|
} |
|
|
|
|
|
for (ClassDoc cdi=this; cdi!=null; cdi=cdi.containingClass()) { |
|
|
for (ClassDoc sdi=cdi; sdi!=null; sdi=sdi.superclass()) { |
|
|
rc=Main.getRootDoc().classNamed(sdi.qualifiedName()+"."+className); |
|
|
if (rc!=null) return rc; |
|
|
} |
|
|
|
|
|
rc=Main.getRootDoc().classNamed(cdi.qualifiedName()+"."+className); |
|
|
if (rc!=null) return rc; |
|
|
} |
|
|
|
|
|
//Debug.log(9,"importedPackages.length="+importedPackages.length+", this="+this); |
|
|
for (int i=0; i<importedPackages.length; ++i) { |
|
|
//Debug.log(9,"trying (by package) "+importedPackages[i].name()+"."+className+"..."); |
|
|
rc=Main.getRootDoc().classNamed(importedPackages[i].name()+"."+className); |
|
|
if (rc!=null) return rc; |
|
|
} |
|
|
rc=Main.getRootDoc().classNamed(containingPackage().name()+"."+className); |
|
|
if (rc!=null) { |
|
|
return rc; |
|
|
} |
|
|
return Main.getRootDoc().classNamed("java.lang."+className); |
|
|
} |
|
|
|
|
125 |
// Get the list of classes declared as imported. |
// Get the list of classes declared as imported. |
126 |
public ClassDoc[] importedClasses() { |
public ClassDoc[] importedClasses() { |
127 |
return importedClasses; |
return importedClasses; |
467 |
|
|
468 |
if (superclass instanceof ClassDocProxy) { |
if (superclass instanceof ClassDocProxy) { |
469 |
|
|
470 |
String className=superclass.qualifiedName(); |
ClassDoc realClassDoc=findClass(superclass.qualifiedName()); |
|
ClassDoc realClassDoc=findClass(className); |
|
471 |
|
|
472 |
if (realClassDoc==null) { |
if (realClassDoc==null) { |
473 |
/* |
/* |
485 |
for (int i=0; i<interfaces.length; ++i) { |
for (int i=0; i<interfaces.length; ++i) { |
486 |
if (interfaces[i] instanceof ClassDocProxy) { |
if (interfaces[i] instanceof ClassDocProxy) { |
487 |
//Debug.log(9,"class "+qualifiedName()+" implements "+interfaces[i].qualifiedName()); |
//Debug.log(9,"class "+qualifiedName()+" implements "+interfaces[i].qualifiedName()); |
488 |
String className=interfaces[i].qualifiedName(); |
ClassDoc realClassDoc=findClass(interfaces[i].qualifiedName()); |
|
ClassDoc realClassDoc=findClass(className); |
|
489 |
if (realClassDoc==null) { |
if (realClassDoc==null) { |
490 |
/* |
/* |
491 |
if (Main.recursiveClasses) { |
if (Main.recursiveClasses) { |
743 |
rc=findConstructor(cdi, nameAndSignature); |
rc=findConstructor(cdi, nameAndSignature); |
744 |
if (rc!=null) return rc; |
if (rc!=null) return rc; |
745 |
|
|
746 |
ClassDoc superclass = cdi.superclass(); |
ClassDoc _superclass = cdi.superclass(); |
747 |
if (null == superclass) { |
if (null == _superclass) { |
748 |
break; |
break; |
749 |
} |
} |
750 |
else { |
else { |
751 |
cdi = superclass; |
cdi = _superclass; |
752 |
} |
} |
753 |
} |
} |
754 |
return null; |
return null; |
915 |
} |
} |
916 |
} |
} |
917 |
else { |
else { |
918 |
ClassDoc[] interfaces = classDoc.interfaces(); |
ClassDoc[] _interfaces = classDoc.interfaces(); |
919 |
if (null != interfaces) { |
if (null != _interfaces) { |
920 |
for (int i=0; i<interfaces.length; ++i) { |
for (int i=0; i<_interfaces.length; ++i) { |
921 |
if (interfaces[i] instanceof ClassDocImpl) { |
if (_interfaces[i] instanceof ClassDocImpl) { |
922 |
FieldDoc fieldDoc |
FieldDoc fieldDoc |
923 |
= ((ClassDocImpl)interfaces[i]).getFieldDoc(fieldName); |
= ((ClassDocImpl)_interfaces[i]).getFieldDoc(fieldName); |
924 |
if (null != fieldDoc) { |
if (null != fieldDoc) { |
925 |
return fieldDoc.constantValue(); |
return fieldDoc.constantValue(); |
926 |
} |
} |
938 |
{ |
{ |
939 |
int ndx = identifier.lastIndexOf('.'); |
int ndx = identifier.lastIndexOf('.'); |
940 |
if (ndx >= 0) { |
if (ndx >= 0) { |
941 |
String className = identifier.substring(0, ndx); |
String _className = identifier.substring(0, ndx); |
942 |
String fieldName = identifier.substring(ndx + 1); |
String _fieldName = identifier.substring(ndx + 1); |
943 |
|
|
944 |
ClassDoc classDoc = findClass(className); |
ClassDoc _classDoc = findClass(_className); |
945 |
if (null != classDoc) { |
if (null != _classDoc) { |
946 |
return findFieldValue(identifier, classDoc, fieldName); |
return findFieldValue(identifier, _classDoc, _fieldName); |
947 |
} |
} |
948 |
else { |
else { |
949 |
throw new UnknownIdentifierException(identifier); |
throw new UnknownIdentifierException(identifier); |