Browse Source

Fixed:

57780: ajdoc package summary should not show synthetic information;  
57773: ajdoc crash;  
Cleaned up link generation, added support for arbitrary levels of type nesting.
tags/Root_ajdt_support
mkersten 20 years ago
parent
commit
b8ffb1f44c

+ 1
- 1
ajdoc/src/org/aspectj/tools/ajdoc/Config.java View File

@@ -33,7 +33,7 @@ interface Config {
" -classpath <pathlist> Specify where to find user class files\n" +
" -bootclasspath <pathlist> Override location of class files loaded\n" +
" -d <directory> Destination directory for output files\n" +
" -argfile <file> the file is a line-delimted list of arguments" +
" -argfile <file> Build config file (wildcards not supported\n" +
" -verbose Output messages about what Javadoc is doing\n" +
" -v Print out the version of ajdoc" +
"\n"+

+ 7
- 1
ajdoc/src/org/aspectj/tools/ajdoc/Declaration.java View File

@@ -61,13 +61,15 @@ public class Declaration implements Serializable {
transient private Declaration[] pointsTo = null;

private Declaration parentDeclaration = null;
private IProgramElement node;

public Declaration(int beginLine, int endLine, int beginColumn, int endColumn,
String modifiers, String signature, String fullSignature,
String crosscutDesignator,
String declaringType, String kind,
String filename, String formalComment,
String packageName)
String packageName,
IProgramElement node)
{
this.beginLine = beginLine;
this.endLine = endLine;
@@ -92,6 +94,7 @@ public class Declaration implements Serializable {
this.pointsToHandles = new Handle[0];
//???
this.declarations = new Declaration[0];
this.node = node;
}

public int getBeginLine() { return beginLine; }
@@ -296,4 +299,7 @@ public class Declaration implements Serializable {
return manager.getDeclarationAtPoint(filename, line, column);
}
}
public IProgramElement getNode() {
return node;
}
}

+ 44
- 56
ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java View File

@@ -82,25 +82,29 @@ class HtmlDecorator {
String packageName = decl.getPackageName();
String filename = "";
if ( packageName != null ) {
int index1 = base.lastIndexOf(Config.DIR_SEP_CHAR);
int index2 = base.lastIndexOf(".");
String currFileClass = "";
if (index1 > -1 && index2 > 0 && index1 < index2) {
currFileClass = base.substring(index1+1, index2);
}
// XXX only one level of nexting
if (currFileClass.equals(decl.getDeclaringType())) {
// !!! hack for inner class !!!
nestedClass = true;
packageName = packageName.replace( '.','/' );
String newBase = "";
if ( base.lastIndexOf(Config.DIR_SEP_CHAR) > 0 ) {
newBase = base.substring(0, base.lastIndexOf(Config.DIR_SEP_CHAR));
}
String signature = constructNestedTypeName(decl.getNode());
filename = newBase + Config.DIR_SEP_CHAR + packageName +
Config.DIR_SEP_CHAR + currFileClass + //"." +
decl.getSignature() + ".html";
nestedClass = true;
signature + ".html";
} else {
packageName = packageName.replace( '.','/' ); // !!!
packageName = packageName.replace( '.','/' );
filename = base + packageName + Config.DIR_SEP_CHAR + decl.getSignature() + ".html";
}
}
@@ -109,6 +113,7 @@ class HtmlDecorator {
}
if (!exceededNestingLevel) {
decorateHTMLFile(new File(filename));
decorateHTMLFromDecls(decl.getDeclarations(),
base + decl.getSignature() + ".",
docModifier,
@@ -122,7 +127,17 @@ class HtmlDecorator {
}
}

static void decorateHTMLFile(File file) throws IOException {
private static String constructNestedTypeName(IProgramElement node) {
if (node.getParent().getKind().isSourceFile()) {
return node.getName();
} else {
String nodeName = "";
if (node.getKind().isType()) nodeName += '.' + node.getName();
return constructNestedTypeName(node.getParent()) + nodeName;
}
}

static void decorateHTMLFile(File file) throws IOException {
System.out.println( "> Decorating " + file.getCanonicalPath() + "..." );
BufferedReader reader = new BufferedReader(new FileReader(file));
StringBuffer fileContents = new StringBuffer();
@@ -166,7 +181,7 @@ class HtmlDecorator {
}
else {
decorateMemberDocumentation(decl, fileContents, index);
}
}
}
// Change "Class" to "Aspect", HACK: depends on "affects:"
@@ -479,52 +494,25 @@ class HtmlDecorator {
if (currDecl.getPackageName() != null && !currDecl.getPackageName().equals("")) {
packagePath = currDecl.getPackageName().replace('.', '/') + Config.DIR_SEP_CHAR;
}
String hrefLink = "";
String hrefName = rootDir.getAbsolutePath() + "/";
if (currDecl.getKind().isType()) {
hrefName = packagePath;
if (currDecl.getParent().getKind().isType()) {
hrefName =
hrefName + currDecl.getParent().getName() + ".";
}
hrefName = hrefName + currDecl.getName();

hrefLink = rootDir.getAbsolutePath() + "/" + packagePath;
// hrefLink = getRelativeComponent(packagePath) + packagePath;
// XXX: only one level of nested classes
if (currDecl.getParent().getKind().isType()) {
hrefLink =
hrefLink + currDecl.getParent().getName() + ".";
}
hrefLink = hrefLink + currDecl.toLabelString() + ".html";
} else {
hrefName = packagePath;
if (currDecl.getParent().getParent().getKind().isType()) {
hrefName += currDecl.getParent().getParent().getName()
+ ".";
}
hrefName += currDecl.getParent().getName()
+ "." + currDecl.getName();
hrefLink = rootDir.getAbsolutePath() + "/" + packagePath;
// getRelativeComponent(packagePath) + packagePath;

// Constructing the hrefLink string requires a check
// to see if the parent type is actually nested inside
// another type.
// XXX: only one level of nested classes
if (currDecl.getParent().getParent().getKind().isType()) {
hrefLink +=
currDecl.getParent().getParent().getName()
+ ".";
}
hrefLink +=
currDecl.getParent().getName()
+ ".html"
+ "#"
+ currDecl.toLabelString();
String typeSignature = constructNestedTypeName(currDecl);
String hrefName =
packagePath
+ typeSignature;
String hrefLink =
rootDir.getAbsolutePath() + "/"
// getRelativePathFromHere(packagePath)
+ packagePath
+ typeSignature
+ ".html";
if (!currDecl.getKind().isType()) {
hrefName += '.' + currDecl.getName();
hrefLink += "#" + currDecl.toLabelString();
}
if (!addedNames.contains(hrefName)) {
entry += "<A HREF=\"" + hrefLink +
"\"><tt>" + hrefName.replace('/', '.') + "</tt></A>"; // !!! don't replace
@@ -544,11 +532,11 @@ class HtmlDecorator {
* @param packagePath
* @return String consisting of multiple "../" parts, one for
* each component part of the input <code>packagePath</code>.
*/
private static String getRelativeComponent(String packagePath) {
StringBuffer result = new StringBuffer("");
if (packagePath != null && (packagePath.indexOf("/") != -1)) {
StringTokenizer sTok = new StringTokenizer(packagePath, "/", false);
*/
private static String getRelativePathFromHere(String packagePath) {
StringBuffer result = new StringBuffer("");
if (packagePath != null && (packagePath.indexOf("/") != -1)) {
StringTokenizer sTok = new StringTokenizer(packagePath, "/", false);
while (sTok.hasMoreTokens()) {
sTok.nextToken(); // don't care about the token value
result.append(".." + Config.DIR_SEP_CHAR);

+ 14
- 15
ajdoc/src/org/aspectj/tools/ajdoc/Main.java View File

@@ -53,7 +53,7 @@ public class Main implements Config {
/** Default to package visiblity. */
static String docModifier = "package";

static Vector sourcepath = new Vector();
static Vector sourcepath;

static boolean verboseMode = false;
static boolean packageMode = false;
@@ -81,17 +81,12 @@ public class Main implements Config {
rootDir = null;
declIDTable = new Hashtable();
docDir = ".";
aborted = false;
deleteTempFilesOnExit = true;
}

public static void main(String[] args) {
aborted = false;
deleteTempFilesOnExit = true;
filenames = new Vector();
fileList= new Vector();
packageList = new Vector();
options = new Vector();
ajcOptions = new Vector();
clearState();
// if (!JavadocRunner.has14ToolsAvailable()) {
// System.err.println("ajdoc requires a JDK 1.4 or later tools jar - exiting");
// aborted = true;
@@ -322,9 +317,10 @@ public class Main implements Config {
if ( ((String)options.elementAt(i)).equals( "-d" ) ) {
rootDir = new File((String)options.elementAt(i+1));
if ( !rootDir.exists() ) {
System.out.println( "Destination directory not found: " +
(String)options.elementAt(i+1) );
System.exit( -1 );
rootDir.mkdir();
// System.out.println( "Destination directory not found: " +
// (String)options.elementAt(i+1) );
// System.exit( -1 );
}
}
}
@@ -581,10 +577,12 @@ public class Main implements Config {
options.addElement(arg);
addNextAsOption = false;
}
else {
else {
// check if this is a file or a package
if ( arg.indexOf( ".java" ) == arg.length() - 5 ||
arg.indexOf( ".lst" ) == arg.length() - 4 &&
// System.err.println(">>>>>>>> " + );
String entryName = arg.substring(arg.lastIndexOf(File.separator)+1);
if ((arg.endsWith(".java") && entryName.indexOf('.') == entryName.length()-5) ||
arg.endsWith(".lst") &&
arg != null ) {
File f = new File(arg);
if (f.isAbsolute()) {
@@ -598,6 +596,7 @@ public class Main implements Config {

// PACKAGE MODE STUFF
else if (!ignoreArg) {
packageMode = true;
packageList.addElement( arg );
arg = arg.replace( '.', '/' ); // !!!

+ 2
- 1
ajdoc/src/org/aspectj/tools/ajdoc/SymbolManager.java View File

@@ -118,7 +118,8 @@ public class SymbolManager {
node.getKind().toString(),
node.getSourceLocation().getSourceFile().getAbsolutePath(),
node.getFormalComment(),
node.getPackageName()
node.getPackageName(),
node
);
return dec;
}

+ 1
- 0
ajdoc/testdata/coverage/.cvsignore View File

@@ -0,0 +1 @@
doc

Loading…
Cancel
Save