]> source.dussan.org Git - aspectj.git/commitdiff
Fixed bug#70008 "problem with ajdoc -public"
authormkersten <mkersten>
Wed, 14 Jul 2004 20:36:00 +0000 (20:36 +0000)
committermkersten <mkersten>
Wed, 14 Jul 2004 20:36:00 +0000 (20:36 +0000)
ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
ajdoc/testdata/coverage/foo/PkgVisibleClass.java [new file with mode: 0644]
ajdoc/testsrc/org/aspectj/tools/ajdoc/CoverageTestCase.java
ajdoc/testsrc/org/aspectj/tools/ajdoc/SpacewarTestCase.java

index 655eb4aca6762a994aa79d171b3020a33864055c..f189b6c6120e8af34415ad672c20b5ea09d1d02b 100644 (file)
@@ -112,6 +112,7 @@ class HtmlDecorator {
                     filename = base + decl.getSignature() + ".html";
                 }
                 if (!exceededNestingLevel) {
+                    
                    decorateHTMLFile(new File(filename));
                    
                    decorateHTMLFromDecls(decl.getDeclarations(),
@@ -137,9 +138,16 @@ class HtmlDecorator {
        }
        }
 
+    /**
+     * Skips files that are public in the model but not public in the source,
+     * e.g. nested aspects.
+     */
        static void decorateHTMLFile(File file) throws IOException {
-        System.out.println( "> Decorating " + file.getCanonicalPath() + "..." );
-        BufferedReader reader = new BufferedReader(new FileReader(file));
+           if (!file.exists()) return;
+           
+           System.out.println( "> Decorating " + file.getCanonicalPath() + "..." );
+           BufferedReader reader = new BufferedReader(new FileReader(file));
+           
         StringBuffer fileContents = new StringBuffer();
         String line = reader.readLine();
         while( line != null ) {
diff --git a/ajdoc/testdata/coverage/foo/PkgVisibleClass.java b/ajdoc/testdata/coverage/foo/PkgVisibleClass.java
new file mode 100644 (file)
index 0000000..44941bb
--- /dev/null
@@ -0,0 +1,12 @@
+/**
+ * @author Mik Kersten
+ */
+class PkgVisibleClass {
+
+    static class NestedClass { } 
+    
+    static aspect NestedAspect { } 
+  
+    private static aspect PrivateNestedAspect { } 
+     
+}
index 8b7df063e8a15a00c22bc7ff80454a251848c617..a7dd019745d61ecb198f8f211bfdf6234bb6ec49 100644 (file)
@@ -21,22 +21,23 @@ import junit.framework.TestCase;
  * @author Mik Kersten
  */
 public class CoverageTestCase extends TestCase {
+
+       File file0 = new File("testdata/coverage/InDefaultPackage.java");
+       File file1 = new File("testdata/coverage/foo/ClassA.java");
+       File aspect1 = new File("testdata/coverage/foo/UseThisAspectForLinkCheck.aj");
+       File file2 = new File("testdata/coverage/foo/InterfaceI.java");
+       File file3 = new File("testdata/coverage/foo/PlainJava.java");
+       File file4 = new File("testdata/coverage/foo/ModelCoverage.java");
+       File file5 = new File("testdata/coverage/fluffy/Fluffy.java");
+       File file6 = new File("testdata/coverage/fluffy/bunny/Bunny.java");
+       File file7 = new File("testdata/coverage/fluffy/bunny/rocks/Rocks.java");
+       File file8 = new File("testdata/coverage/fluffy/bunny/rocks/UseThisAspectForLinkCheckToo.java");
+       File file9 = new File("testdata/coverage/foo/PkgVisibleClass.java");
+        
+       File outdir = new File("testdata/coverage/doc");
        
        public void testCoverage() {
-                 
-//             System.err.println(new File("testdata/figures-demo").exists());
-               File file0 = new File("testdata/coverage/InDefaultPackage.java");
-               File file1 = new File("testdata/coverage/foo/ClassA.java");
-               File aspect1 = new File("testdata/coverage/foo/UseThisAspectForLinkCheck.aj");
-               File file2 = new File("testdata/coverage/foo/InterfaceI.java");
-               File file3 = new File("testdata/coverage/foo/PlainJava.java");
-               File file4 = new File("testdata/coverage/foo/ModelCoverage.java");
-               File file5 = new File("testdata/coverage/fluffy/Fluffy.java");
-               File file6 = new File("testdata/coverage/fluffy/bunny/Bunny.java");
-               File file7 = new File("testdata/coverage/fluffy/bunny/rocks/Rocks.java");
-               File file8 = new File("testdata/coverage/fluffy/bunny/rocks/UseThisAspectForLinkCheckToo.java");
-               File outdir = new File("testdata/coverage/doc");
-                   
+               outdir.delete();
                String[] args = { 
 //                     "-XajdocDebug",
                        "-source", 
@@ -53,20 +54,31 @@ public class CoverageTestCase extends TestCase {
                        file5.getAbsolutePath(),
                        file6.getAbsolutePath(),
                        file7.getAbsolutePath(),
-                       file8.getAbsolutePath()
+                       file8.getAbsolutePath(),
+                       file9.getAbsolutePath()
                };
-               
                org.aspectj.tools.ajdoc.Main.main(args);
        }
 
+       public void testCoveragePublicMode() {
+               outdir.delete();
+               String[] args = { 
+                       "-public",
+                       "-source", 
+                       "1.4",
+                       "-d", 
+                       outdir.getAbsolutePath(),
+                       file3.getAbsolutePath(),
+                       file9.getAbsolutePath() 
+               };
+               org.aspectj.tools.ajdoc.Main.main(args);
+       }
+       
 //     public void testPlainJava() {
-//             File file1 = new File("testdata/coverage/foo/PlainJava.java");
-//             File outdir = new File("testdata/coverage/doc");
-//             
+//             outdir.delete();
 //             String[] args = { "-d", 
 //                             outdir.getAbsolutePath(),
-//                             file1.getAbsolutePath() };
-//             
+//                             file3.getAbsolutePath() };
 //             org.aspectj.tools.ajdoc.Main.main(args);
 //     }
        
index b90d749005cd65a681622622b14730d3503fe009..7556234e6db19b03629a2bf127ae8655948c3338 100644 (file)
@@ -20,9 +20,12 @@ import junit.framework.TestCase;
  */
 public class SpacewarTestCase extends TestCase {
        
+       protected void setUp() throws Exception {
+               super.setUp();
+               new File("testdata/spacewar/docdir").delete();
+       }
+    
        public void testSimpleExample() {
-               
-//             System.err.println(new File("testdata/figures-demo").exists());
                File outdir = new File("testdata/spacewar/docdir");
                File sourcepath = new File("testdata/spacewar");
                
@@ -34,12 +37,24 @@ public class SpacewarTestCase extends TestCase {
                                "coordination" };
                
                org.aspectj.tools.ajdoc.Main.main(args);
-               
                assertTrue(true);
        }
        
-       protected void setUp() throws Exception {
-               super.setUp();
+       public void testPublicModeExample() {
+               File outdir = new File("testdata/spacewar/docdir");
+               File sourcepath = new File("testdata/spacewar");
+               
+               String[] args = { 
+                       "-public",
+                       "-d", 
+                               outdir.getAbsolutePath(),
+                               "-sourcepath",
+                               sourcepath.getAbsolutePath(),
+                               "spacewar",
+                               "coordination" };
+               
+               org.aspectj.tools.ajdoc.Main.main(args);
+               assertTrue(true);
        }
        
        protected void tearDown() throws Exception {