]> source.dussan.org Git - aspectj.git/commitdiff
Fixed:
authormkersten <mkersten>
Thu, 8 Apr 2004 23:25:20 +0000 (23:25 +0000)
committermkersten <mkersten>
Thu, 8 Apr 2004 23:25:20 +0000 (23:25 +0000)
57780: ajdoc package summary should not show synthetic information;
57773: ajdoc crash;
Cleaned up link generation, added support for arbitrary levels of type nesting.

ajdoc/src/org/aspectj/tools/ajdoc/Config.java
ajdoc/src/org/aspectj/tools/ajdoc/Declaration.java
ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
ajdoc/src/org/aspectj/tools/ajdoc/Main.java
ajdoc/src/org/aspectj/tools/ajdoc/SymbolManager.java
ajdoc/testdata/coverage/.cvsignore [new file with mode: 0644]

index 990568fff91b7ba752276e26eb13f6dcf193305a..04f740d76377cdc88265a55ba7d5f3b56683eece 100644 (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"+
index 3970a7c04b31bcb6aa39d1107d616cce1ae03dda..84156ccbb06d8b502df18f2ec1dce27769f77063 100644 (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;
+       }
 }
index 2f2a82cdef5f988300f76c4bc1879019600c3c47..e680bdd0a8699a161afbc7696e6f7a4d51961983 100644 (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);
index 89d78c4f5239f76d0b83f76c3484e2d6dc621334..67c12c7f50f392dd78383f23966849df9540cb99 100644 (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( '.', '/' );  // !!!
index 00bddb060105ffb2004602540e9195e6fe9fb8dc..59edbb2fdad62ed967a9f86b97746312f31e4001 100644 (file)
@@ -118,7 +118,8 @@ public class SymbolManager {
                        node.getKind().toString(),
                        node.getSourceLocation().getSourceFile().getAbsolutePath(),
                        node.getFormalComment(),
-                       node.getPackageName()
+                       node.getPackageName(),
+                       node
                );
                return dec;
        }
diff --git a/ajdoc/testdata/coverage/.cvsignore b/ajdoc/testdata/coverage/.cvsignore
new file mode 100644 (file)
index 0000000..8e695ec
--- /dev/null
@@ -0,0 +1 @@
+doc