summaryrefslogtreecommitdiffstats
path: root/ajdoc
diff options
context:
space:
mode:
authormkersten <mkersten>2004-03-10 19:46:13 +0000
committermkersten <mkersten>2004-03-10 19:46:13 +0000
commit799a74bf1cb3350cb0ab8ec55d23075524d4f240 (patch)
tree955989051fdd2ad7b7fc7dcce61d9277a2f5c1e7 /ajdoc
parent281b698886b721aef7b15f356b0a4a50a2da7edf (diff)
downloadaspectj-799a74bf1cb3350cb0ab8ec55d23075524d4f240.tar.gz
aspectj-799a74bf1cb3350cb0ab8ec55d23075524d4f240.zip
Port of ajdoc declaration hierarchy to ASM.
Diffstat (limited to 'ajdoc')
-rw-r--r--ajdoc/.classpath2
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/Main.java61
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/Phase1.java279
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java74
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/SymbolManager.java68
-rw-r--r--ajdoc/testdata/simple/.cvsignore1
-rw-r--r--ajdoc/testdata/simple/foo/ClassA.java14
-rw-r--r--ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTest.java46
8 files changed, 363 insertions, 182 deletions
diff --git a/ajdoc/.classpath b/ajdoc/.classpath
index bb44554db..7ceaa12f0 100644
--- a/ajdoc/.classpath
+++ b/ajdoc/.classpath
@@ -7,5 +7,7 @@
<classpathentry kind="src" path="/bridge"/>
<classpathentry kind="src" path="/util"/>
<classpathentry kind="lib" path="C:/Apps/j2sdk1.4.2/lib/tools.jar"/>
+ <classpathentry kind="src" path="testsrc"/>
+ <classpathentry sourcepath="JUNIT_HOME/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
index 25612ff5c..558430543 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
@@ -14,19 +14,12 @@
package org.aspectj.tools.ajdoc;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.BufferedWriter;
-import java.io.PrintWriter;
-import java.io.IOException;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.StringReader;
-import java.io.FilenameFilter;
-
+import java.io.*;
import java.util.*;
+import org.aspectj.asm.AsmManager;
+import org.aspectj.asm.IProgramElement;
+
/**
* This is an old implementation of ajdoc that does not use an OO style. However, it
* does the job, and should serve to evolve a lightweight ajdoc implementation until
@@ -96,7 +89,7 @@ public class Main implements Config {
if ( !(new File( Config.WORKING_DIR ).isDirectory()) ) {
File dir = new File( Config.WORKING_DIR );
dir.mkdir();
- dir.deleteOnExit();
+// dir.deleteOnExit();
}
for (int i = 0; i < filenames.size(); i++) {
@@ -191,8 +184,8 @@ public class Main implements Config {
javadocargs[options.size() + k] = signatureFiles[k].getCanonicalPath();
}
}
+
Phase2.callJavadoc(javadocargs);
-
//for ( int o = 0; o < inputFiles.length; o++ ) {
// System.out.println( "file: " + inputFiles[o] );
//}
@@ -203,19 +196,19 @@ public class Main implements Config {
* into multiple .html files to handle inner classes or local classes. The html
* file decorator picks that up.
*/
- System.out.println( "> Decorating html files..." );
- Phase3.decorateHTMLFromInputFiles(declIDTable,
- rootDir,
- symbolManager,
- inputFiles,
- docModifier);
- removeDeclIDsFromFile("index-all.html");
- removeDeclIDsFromFile("serialized-form.html");
- for (int p = 0; p < packageList.size(); p++) {
- removeDeclIDsFromFile(((String)packageList.elementAt(p)).replace('.','/') +
- Config.DIR_SEP_CHAR +
- "package-summary.html" );
- }
+// System.out.println( "> Decorating html files..." );
+// Phase3.decorateHTMLFromInputFiles(declIDTable,
+// rootDir,
+// symbolManager,
+// inputFiles,
+// docModifier);
+// removeDeclIDsFromFile("index-all.html");
+// removeDeclIDsFromFile("serialized-form.html");
+// for (int p = 0; p < packageList.size(); p++) {
+// removeDeclIDsFromFile(((String)packageList.elementAt(p)).replace('.','/') +
+// Config.DIR_SEP_CHAR +
+// "package-summary.html" );
+// }
} catch (Throwable e) {
handleInternalError(e);
exit(-2);
@@ -339,18 +332,12 @@ public class Main implements Config {
}
static File createSignatureFile(File inputFile) throws IOException {
- Declaration[] decls = symbolManager.getDeclarations(inputFile.getAbsolutePath());
- Declaration decl = null;
- String packageName = null;
- if ( decls != null && decls[0] != null ) {
- decl = decls[0];
- packageName = decl.getPackageName();
- }
+ String packageName = StructureUtil.getPackageDeclarationFromFile(inputFile);
+
+// System.err.println(">>> package: " + packageName);
String filename = "";
if ( packageName != null ) {
- //System.err.println(">> creating: " + packageName);
String pathName = Config.WORKING_DIR + '/' + packageName.replace('.', '/');
- //System.err.println(">> pathName: " + pathName);
File packageDir = new File(pathName);
if ( !packageDir.exists() ) {
packageDir.mkdirs();
@@ -388,7 +375,7 @@ public class Main implements Config {
File packageDir = new File( filePath );
if ( !packageDir.exists() ) {
packageDir.mkdir();
- packageDir.deleteOnExit();
+// packageDir.deleteOnExit();
}
if ( remainingPkg != "" ) {
verifyPackageDirExists( remainingPkg, currPkgDir );
@@ -405,7 +392,7 @@ public class Main implements Config {
File packageDir = new File( filePath );
if ( !packageDir.exists() ) {
packageDir.mkdir();
- packageDir.deleteOnExit();
+// packageDir.deleteOnExit();
}
}
}
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Phase1.java b/ajdoc/src/org/aspectj/tools/ajdoc/Phase1.java
index 2c36403a3..ed79ec86c 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/Phase1.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/Phase1.java
@@ -14,18 +14,13 @@
package org.aspectj.tools.ajdoc;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.BufferedWriter;
-import java.io.PrintWriter;
-import java.io.IOException;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.StringReader;
-import java.util.StringTokenizer;
-
-import java.util.*;
+import java.io.*;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import org.aspectj.asm.AsmManager;
+import org.aspectj.asm.IProgramElement;
class Phase1 {
@@ -37,136 +32,174 @@ class Phase1 {
File[] signatureFiles) {
declIDTable = table;
for (int i = 0; i < inputFiles.length; i++) {
- doFile(symbolManager, inputFiles[i], signatureFiles[i]);
+ processFile(symbolManager, inputFiles[i], signatureFiles[i]);
}
}
- static void doFile(SymbolManager symbolManager, File inputFile, File signatureFile) {
+ static void processFile(SymbolManager symbolManager, File inputFile, File signatureFile) {
try {
-
- Declaration[] decls = symbolManager.getDeclarations(inputFile.getCanonicalPath());
+ // Declaration[] decls = symbolManager.getDeclarations(inputFile.getCanonicalPath());
PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(signatureFile.getCanonicalPath())));
-
- // write the package info
- if ( decls != null && decls[0] != null && decls[0].getPackageName() != null ) {
- writer.println( "package " + decls[0].getPackageName() + ";" );
+
+ String packageName = StructureUtil.getPackageDeclarationFromFile(inputFile);
+
+ if (packageName != null ) {
+ writer.println( "package " + packageName + ";" );
}
- if (decls != null) {
- doDecls(decls, writer, false);
- }
- writer.close(); //this isn't in a finally, because if we got an
- //error we don't really want the contents anyways
- }
- catch (IOException e) {
+ IProgramElement fileNode = (IProgramElement)AsmManager.getDefault().getHierarchy().findElementForSourceFile(inputFile.getAbsolutePath());
+ for (Iterator it = fileNode.getChildren().iterator(); it.hasNext(); ) {
+ IProgramElement node = (IProgramElement)it.next();
+ if (!node.getKind().equals(IProgramElement.Kind.IMPORT_REFERENCE)) {
+ processTypeDeclaration(node, writer);
+ }
+ }
+
+ // if we got an error we don't want the contents of the file
+ writer.close();
+ } catch (IOException e) {
System.err.println(e.getMessage());
e.printStackTrace();
- }
+ }
}
- static void doDecls (Declaration[] decls,
- PrintWriter writer,
- boolean declaringDeclIsInterface) throws IOException {
- for (int i = 0; i < decls.length; i++) {
- Declaration decl = decls[i];
- //System.out.println( ">> sig: " + decl.getSignature() );
- doDecl(decl, writer, declaringDeclIsInterface);
- }
- }
-
- static void doDecl(Declaration decl,
- PrintWriter writer,
- boolean declaringDeclIsInterface) throws IOException {
- String formalComment = decl.getFormalComment();
- String fullSignature = decl.getFullSignature();
- System.err.println("> full: " + fullSignature);
- Declaration[] ptbs = decl.getPointedToBy();
- Declaration[] subs = decl.getDeclarations();
- if (decl.hasSignature()) {
- formalComment = addDeclID(decl, formalComment);
-
- writer.println(formalComment);
-
- // HACK: this should be in Declaration
- int implementsClauseIndex = fullSignature.indexOf(" implements");
- if (implementsClauseIndex != -1) {
- String newSignature = "";
- StringTokenizer st = new StringTokenizer(fullSignature.substring(implementsClauseIndex, fullSignature.length()));
- for (String element = (String)st.nextElement(); st.hasMoreElements(); element = (String)st.nextElement()) {
- if (element.indexOf("$MightHaveAspect") != -1
- && element.indexOf("implements") != -1) {
- newSignature += element;
- }
- }
- if (!newSignature.equals("")) {
- writer.print(fullSignature.substring(0, implementsClauseIndex)
- + " implements " + newSignature + " " );
- } else {
- writer.print(fullSignature.substring(0, implementsClauseIndex) + " " );
- }
- } else {
- writer.print(fullSignature + " " );
- }
+// static void processClassDeclarations(IProgramElement fileNode,
+// PrintWriter writer,
+// boolean declaringDeclIsInterface) throws IOException {
+// for (Iterator it = fileNode.getChildren().iterator(); it.hasNext(); ) {
+// IProgramElement node = (IProgramElement)it.next();
+// proc
+// }
+// for (int i = 0; i < decls.length; i++) {
+// Declaration decl = decls[i];
+//
+// //System.out.println( ">> sig: " + decl.getSignature() );
+// doDecl(decl, writer, declaringDeclIsInterface);
+// }
+// }
- if ((!decl.hasBody() && !decl.getKind().equals( "interface" ) ||
- (decl.getKind().equals( "method" ) && declaringDeclIsInterface)) && // !!! bug in Jim's API?
- !(decl.getKind().equals("initializer") && decl.getModifiers().indexOf("static") != -1 ) ) {
-
- System.err.println(">>>> kind: " + decl.getKind());
-
- if (decl.getModifiers().indexOf("static final") != -1) {
- String fullSig = decl.getFullSignature().trim();
- String stripped = fullSig.substring(0, fullSig.lastIndexOf(' '));
- //System.err.println(">>> " + fullSig);
- String type = stripped.substring(stripped.lastIndexOf(' '), stripped.length());
- //System.err.println("> type: " + type);
-
- if (type.equals("boolean")) {
- writer.println(" = false");
- } else if (type.equals("char")) {
- writer.println(" = '0'");
- } else if (type.equals("byte")) {
- writer.println(" = 0");
- } else if (type.equals("short")) {
- writer.println(" = 0");
- } else if (type.equals("int")) {
- writer.println(" = 0");
- } else if (type.equals("long")) {
- writer.println(" = 0");
- } else if (type.equals("float")) {
- writer.println(" = 0");
- } else if (type.equals("double")) {
- writer.println(" = 0");
- } else if (type.equals("String")) {
- writer.println(" = \"\"");
- } else {
- writer.println(" = null");
- }
- }
- writer.println(";");
-// } else if ((!decl.hasBody() && !decl.getKind().equals( "interface" ) ||
+ private static void processTypeDeclaration(IProgramElement classNode, PrintWriter writer) throws IOException {
+
+// String formalComment = classNode.getFormalComment();
+// String fullSignature = classNode.getFullSignature();
+// Declaration[] ptbs = classNode.getPointedToBy();
+// Declaration[] subs = classNode.getDeclarations();
+
+ String formalComment = addDeclID(classNode, classNode.getFormalComment());
+ writer.println(formalComment);
+
+ String signature = StructureUtil.genSignature(classNode);
+ writer.println(signature + " {" );
+ processMembers(classNode.getChildren(), writer, classNode.getKind().equals(IProgramElement.Kind.INTERFACE));
+ writer.println();
+ writer.println("}");
+ }
+
+ private static void processMembers(List/*IProgramElement*/ members, PrintWriter writer, boolean declaringTypeIsInterface) throws IOException {
+ for (Iterator it = members.iterator(); it.hasNext();) {
+ IProgramElement member = (IProgramElement) it.next();
+
+ if (member.getKind().isTypeKind()) {
+ processTypeDeclaration(member, writer);
+ } else {
+
+ String formalComment = addDeclID(member, member.getFormalComment());
+ writer.println(formalComment);
+ String signature = StructureUtil.genSignature(member);
+ writer.print(signature);
+
+ if (member.getKind().equals(IProgramElement.Kind.METHOD)) {
+ writer.println(" { }");
+
+ } else if (member.getKind().equals(IProgramElement.Kind.FIELD)) {
+ writer.println(";");
+ }
+ }
+ }
+ }
+
+//
+// if (decl.hasSignature()) {
+// formalComment = addDeclID(decl, formalComment);
+//
+// writer.println(formalComment);
+//
+// // HACK: this should be in Declaration
+// int implementsClauseIndex = fullSignature.indexOf(" implements");
+// if (implementsClauseIndex != -1) {
+// String newSignature = "";
+// StringTokenizer st = new StringTokenizer(fullSignature.substring(implementsClauseIndex, fullSignature.length()));
+// for (String element = (String)st.nextElement(); st.hasMoreElements(); element = (String)st.nextElement()) {
+// if (element.indexOf("$MightHaveAspect") != -1
+// && element.indexOf("implements") != -1) {
+// newSignature += element;
+// }
+// }
+// if (!newSignature.equals("")) {
+// writer.print(fullSignature.substring(0, implementsClauseIndex)
+// + " implements " + newSignature + " " );
+// } else {
+// writer.print(fullSignature.substring(0, implementsClauseIndex) + " " );
+// }
+// } else {
+// writer.print(fullSignature + " " );
+// }
+//
+//
+// if ((!decl.hasBody() && !decl.getKind().equals( "interface" ) ||
// (decl.getKind().equals( "method" ) && declaringDeclIsInterface)) && // !!! bug in Jim's API?
// !(decl.getKind().equals("initializer") && decl.getModifiers().indexOf("static") != -1 ) ) {
//
+// if (decl.getModifiers().indexOf("static final") != -1) {
+// String fullSig = decl.getFullSignature().trim();
+// String stripped = fullSig.substring(0, fullSig.lastIndexOf(' '));
+// String type = stripped.substring(stripped.lastIndexOf(' '), stripped.length());
+//
+// if (type.equals("boolean")) {
+// writer.println(" = false");
+// } else if (type.equals("char")) {
+// writer.println(" = '0'");
+// } else if (type.equals("byte")) {
+// writer.println(" = 0");
+// } else if (type.equals("short")) {
+// writer.println(" = 0");
+// } else if (type.equals("int")) {
+// writer.println(" = 0");
+// } else if (type.equals("long")) {
+// writer.println(" = 0");
+// } else if (type.equals("float")) {
+// writer.println(" = 0");
+// } else if (type.equals("double")) {
+// writer.println(" = 0");
+// } else if (type.equals("String")) {
+// writer.println(" = \"\"");
+// } else {
+// writer.println(" = null");
+// }
+// }
// writer.println(";");
-
- } else {
- if (subs != null) {
- if ( decl.getKind().equals( "interface" ) ) {
- declaringDeclIsInterface = true;
- }
- writer.println("{");
- doDecls(subs, writer, declaringDeclIsInterface);
- writer.println("}");
- }
- }
- writer.println();
- }
- }
+//// } else if ((!decl.hasBody() && !decl.getKind().equals( "interface" ) ||
+//// (decl.getKind().equals( "method" ) && declaringDeclIsInterface)) && // !!! bug in Jim's API?
+//// !(decl.getKind().equals("initializer") && decl.getModifiers().indexOf("static") != -1 ) ) {
+////
+//// writer.println(";");
+//
+// } else {
+// if (subs != null) {
+// if ( decl.getKind().equals( "interface" ) ) {
+// declaringDeclIsInterface = true;
+// }
+// writer.println("{");
+// processDeclarations(subs, writer, declaringDeclIsInterface);
+// writer.println("}");
+// }
+// }
+// writer.println();
+// }
static int nextDeclID = 0;
- static String addDeclID(Declaration decl, String formalComment) {
+ static String addDeclID(IProgramElement decl, String formalComment) {
String declID = "" + ++nextDeclID;
declIDTable.put(declID, decl);
return addToFormal(formalComment, Config.DECL_ID_STRING + declID + Config.DECL_ID_TERMINATOR);
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java b/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java
new file mode 100644
index 000000000..ff46e3807
--- /dev/null
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java
@@ -0,0 +1,74 @@
+/* *******************************************************************
+ * Copyright (c) 2003 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Mik Kersten initial implementation
+ * ******************************************************************/
+ package org.aspectj.tools.ajdoc;
+
+import java.io.File;
+import java.util.Iterator;
+
+import org.aspectj.asm.AsmManager;
+import org.aspectj.asm.IProgramElement;
+
+/**
+ * @author Mik Kersten
+ */
+public class StructureUtil {
+
+ public static String getPackageDeclarationFromFile(File file) {
+ IProgramElement fileNode = (IProgramElement)AsmManager.getDefault().getHierarchy().findElementForSourceFile(file.getAbsolutePath());
+ String packageName = ((IProgramElement)fileNode.getChildren().get(0)).getPackageName();
+ return packageName;
+ }
+
+ public static String genSignature(IProgramElement node) {
+ StringBuffer sb = new StringBuffer();
+
+ String accessibility = node.getAccessibility().toString();
+ if (!accessibility.equals("package")) {
+ sb.append(accessibility);
+ sb.append(' ');
+ }
+
+ String modifiers = "";
+ for (Iterator modIt = node.getModifiers().iterator(); modIt.hasNext(); ) {
+ modifiers += modIt.next() + " ";
+ }
+
+ if (node.getKind().equals(IProgramElement.Kind.METHOD) ||
+ node.getKind().equals(IProgramElement.Kind.FIELD)) {
+ sb.append(node.getCorrespondingType());
+ sb.append(' ');
+ }
+
+ if (node.getKind().equals(IProgramElement.Kind.CLASS)) {
+ sb.append("class ");
+ } else if (node.getKind().equals(IProgramElement.Kind.INTERFACE)) {
+ sb.append("interface ");
+ }
+
+ sb.append(node.getName());
+
+ if (node.getParameterTypes() != null ) {
+ sb.append('(');
+ for (int i = 0; i < node.getParameterTypes().size(); i++) {
+ sb.append((String)node.getParameterTypes().get(i));
+ sb.append(' ');
+ sb.append((String)node.getParameterNames().get(i));
+ if (i < node.getParameterTypes().size()-1) {
+ sb.append(", ");
+ }
+ }
+ sb.append(')');
+ }
+
+ return sb.toString();
+ }
+}
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/SymbolManager.java b/ajdoc/src/org/aspectj/tools/ajdoc/SymbolManager.java
index 48fc339d5..6c1a0dcbb 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/SymbolManager.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/SymbolManager.java
@@ -118,6 +118,7 @@ public class SymbolManager {
* TODO: only works for one class
*/
public Declaration[] getDeclarations(String filename) {
+
IProgramElement file = (IProgramElement)AsmManager.getDefault().getHierarchy().findElementForSourceFile(filename);
IProgramElement node = (IProgramElement)file.getChildren().get(0);
@@ -126,44 +127,67 @@ public class SymbolManager {
HierarchyWalker walker = new HierarchyWalker() {
public void preProcess(IProgramElement node) {
IProgramElement p = (IProgramElement)node;
- nodes.add(buildDecl(p));
+ if (accept(node)) nodes.add(buildDecl(p));
}
};
file.walk(walker);
+ System.err.println("> got: " + nodes);
+
return (Declaration[])nodes.toArray(new Declaration[nodes.size()]);
// return lookupDeclarations(filename);
}
+
+ private boolean accept(IProgramElement node) {
+ return !node.getKind().equals(IProgramElement.Kind.IMPORT_REFERENCE);
+ }
private Declaration buildDecl(IProgramElement node) {
- System.err.println("> getting decs: " + node);
-
+
+ String signature = "";
+ String accessibility = node.getAccessibility().toString();
+ if (!accessibility.equals("package")) signature = accessibility + " ";
+
String modifiers = "";
for (Iterator modIt = node.getModifiers().iterator(); modIt.hasNext(); ) {
modifiers += modIt.next() + " ";
}
-// Declaration dec = new Declaration(
-// node.getSourceLocation().getLine(),
-// node.getSourceLocation().getEndLine(),
-// node.getSourceLocation().getColumn(),
-// -1,
-// modifiers,
-// node.getName(),
-// node.getFullSignature(),
-// "",
-// node.getDeclaringType(),
-// node.getKind(),
-// node.getSourceLocation().getSourceFile().getAbsolutePath(),
-// node.getFormalComment(),
-// node.getPackageName()
-// );
-// return dec;
- return null;
+
+ if (node.getKind().equals(IProgramElement.Kind.METHOD) ||
+ node.getKind().equals(IProgramElement.Kind.FIELD)) {
+ signature += node.getCorrespondingType() + " ";
+ }
+
+ if (node.getKind().equals(IProgramElement.Kind.CLASS) ||
+ node.getKind().equals(IProgramElement.Kind.METHOD)) {
+ signature += "class ";
+ } else if (node.getKind().equals(IProgramElement.Kind.INTERFACE) ||
+ node.getKind().equals(IProgramElement.Kind.METHOD)) {
+ signature += "interface ";
+ }
+
+ signature += node.toSignatureString();
+// System.err.println(">>>> " + signature);
+
+ Declaration dec = new Declaration(
+ node.getSourceLocation().getLine(),
+ node.getSourceLocation().getEndLine(),
+ node.getSourceLocation().getColumn(),
+ -1,
+ modifiers,
+ node.getName(),
+ signature,
+ "", // crosscut designator
+ node.getDeclaringType(),
+ node.getKind().toString(),
+ node.getSourceLocation().getSourceFile().getAbsolutePath(),
+ node.getFormalComment(),
+ node.getPackageName()
+ );
+ return dec;
}
-
-
// // In the unusual case that there are multiple declarations on a single line
// // This will return a random one
diff --git a/ajdoc/testdata/simple/.cvsignore b/ajdoc/testdata/simple/.cvsignore
new file mode 100644
index 000000000..8e695ec83
--- /dev/null
+++ b/ajdoc/testdata/simple/.cvsignore
@@ -0,0 +1 @@
+doc
diff --git a/ajdoc/testdata/simple/foo/ClassA.java b/ajdoc/testdata/simple/foo/ClassA.java
new file mode 100644
index 000000000..458c76397
--- /dev/null
+++ b/ajdoc/testdata/simple/foo/ClassA.java
@@ -0,0 +1,14 @@
+
+package foo;
+
+public class ClassA {
+
+ public int pubfield;
+ private int privfield;
+
+ void method1(int arg1) {
+ pubfield = arg1;
+ }
+
+}
+ \ No newline at end of file
diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTest.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTest.java
new file mode 100644
index 000000000..6404ae25b
--- /dev/null
+++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTest.java
@@ -0,0 +1,46 @@
+/* *******************************************************************
+ * Copyright (c) 2003 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Mik Kersten initial implementation
+ * ******************************************************************/
+ package org.aspectj.tools.ajdoc;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Mik Kersten
+ */
+public class MainTest extends TestCase {
+
+
+ public void testRun() {
+
+// System.err.println(new File("testdata/figures-demo").exists());
+ File sourcepath = new File("testdata/simple/foo/ClassA.java");
+ File outdir = new File("testdata/simple/doc");
+
+ String[] args = { "-d", outdir.getAbsolutePath(), sourcepath.getAbsolutePath() };
+
+// String[] args = { "-sourcepath", sourcepath.getAbsolutePath(), "figures" };
+ org.aspectj.tools.ajdoc.Main.main(args);
+
+ assertTrue(true);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}