From d2ffd516f8c75144ab877e72b285de6197642341 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 18 Jul 2008 21:56:28 +0000 Subject: 230234 comment 10 - ajdoc modifications and tests --- ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java | 13 +++++++------ ajdoc/testdata/pr164356/C.java | 7 +++++++ ajdoc/testsrc/org/aspectj/tools/ajdoc/BugTests.java | 4 ++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java b/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java index a0b073a67..c0f154f1b 100644 --- a/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java +++ b/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java @@ -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("")) { - 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 * "; diff --git a/ajdoc/testdata/pr164356/C.java b/ajdoc/testdata/pr164356/C.java index cb3891efb..f4925ec11 100644 --- a/ajdoc/testdata/pr164356/C.java +++ b/ajdoc/testdata/pr164356/C.java @@ -17,5 +17,12 @@ public class C { //******* description of goo public void goo() { } + + /*---------------------------*/ + /** + * description of bas + */ + public void bas() { + } } diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/BugTests.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/BugTests.java index c1749875f..c36852c6d 100644 --- a/ajdoc/testsrc/org/aspectj/tools/ajdoc/BugTests.java +++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/BugTests.java @@ -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)); } /** -- cgit v1.2.3