]> source.dussan.org Git - aspectj.git/commitdiff
230234 comment 10 - ajdoc modifications and tests
authoraclement <aclement>
Fri, 18 Jul 2008 21:56:28 +0000 (21:56 +0000)
committeraclement <aclement>
Fri, 18 Jul 2008 21:56:28 +0000 (21:56 +0000)
ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java
ajdoc/testdata/pr164356/C.java
ajdoc/testsrc/org/aspectj/tools/ajdoc/BugTests.java

index a0b073a67729912b83d044b4c80c9e4e3ffc5ac9..c0f154f1b2d9dfefc722dc4f3d5ab075e4ef0cf1 100644 (file)
@@ -76,9 +76,7 @@ class StubFileGenerator{
        List imports = node.getChildren();
        for (Iterator i = imports.iterator(); i.hasNext();) {
                        IProgramElement importNode = (IProgramElement) i.next();
-                       writer.print("import ");
-                       writer.print(importNode.getName());
-                       writer.println(';');
+                       writer.println(importNode.getSourceSignature());
                }        
     }
     
@@ -94,7 +92,7 @@ class StubFileGenerator{
        
 //     System.err.println("######" + signature + ", " + classNode.getName());
        if (!StructureUtil.isAnonymous(classNode) && !classNode.getName().equals("<undefined>")) {
-               writer.println(signature + " {" );
+               writer.println(signature + " { " );
                processMembers(classNode.getChildren(), writer, classNode.getKind().equals(IProgramElement.Kind.INTERFACE));
                writer.println();
                        writer.println("}");
@@ -192,6 +190,9 @@ class StubFileGenerator{
      * replaced.
      */
     static String addToFormal(String formalComment, String string) {
+       if(string == null || string.equals("")) {
+          return formalComment;
+       }
         //boolean appendPeriod = true;
         if ( (formalComment == null) || formalComment.equals("")) {
             //formalComment = "/**\n * . \n */\n";
@@ -202,11 +203,11 @@ class StubFileGenerator{
 
         int atsignPos = formalComment.indexOf('@');
         int    endPos = formalComment.indexOf("*/");
-        int periodPos = formalComment.indexOf("/**")+2;
+        int periodPos = formalComment.indexOf("/**");
         int position  = 0;
         String periodPlaceHolder = "";
         if ( periodPos != -1 ) {
-            position = periodPos+1;
+            position = periodPos + 3;// length of "/**"
         }
         else if ( atsignPos != -1 ) {
             string = string + "\n * ";
index cb3891efb34f1d698490ee0571b86a96bf2ff61e..f4925ec11080bf3814c26e8c50726f56cd501256 100644 (file)
@@ -17,5 +17,12 @@ public class C {
     //******* description of goo
     public void goo() {
     }
+    
+    /*---------------------------*/
+    /**
+     * description of bas
+     */
+    public void bas() {
+    }
 
 }
index c1749875fa0790ddff4e5e52bb13b5deca3aea75..c36852c6d837d3807e93e25f4051dad6551d38ad 100644 (file)
@@ -146,6 +146,7 @@ public class BugTests extends AjdocTestCase {
                String foo = "description of foo";
                String bar = "description of bar";
                String goo = "description of goo";
+               String bas = "description of bas";
                assertTrue("expected method description 'description of foo' to appear" +
                                " in ajdoc output but it did not", 
                                AjdocOutputChecker.containsString(htmlFile, foo));
@@ -155,6 +156,9 @@ public class BugTests extends AjdocTestCase {
                assertFalse("didn't expect method description 'description of goo' to " +
                                "appear in ajdoc output but it did not", 
                                AjdocOutputChecker.containsString(htmlFile, goo));
+               assertTrue("expected method description 'description of bas' to appear" +
+                               " in ajdoc output but it did not", 
+                               AjdocOutputChecker.containsString(htmlFile, bas));
        }
        
        /**