]> source.dussan.org Git - aspectj.git/commitdiff
Fixed: 68494 ajdoc does not support .aj files
authormkersten <mkersten>
Thu, 24 Jun 2004 22:11:53 +0000 (22:11 +0000)
committermkersten <mkersten>
Thu, 24 Jun 2004 22:11:53 +0000 (22:11 +0000)
ajdoc/.classpath
ajdoc/src/org/aspectj/tools/ajdoc/Main.java
ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java
ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java
ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.aj [new file with mode: 0644]
ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.java [deleted file]
ajdoc/testsrc/org/aspectj/tools/ajdoc/CoverageTestCase.java

index eb78052f34971d7afea545e168ff9e6aaabc2763..c24411bbbc7461d89968ef3840813c068980fc91 100644 (file)
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-    <classpathentry kind="src" path="src"/>
-    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-    <classpathentry kind="src" path="/asm"/>
-    <classpathentry kind="src" path="/org.aspectj.ajdt.core"/>
-    <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 kind="lib" path="/lib/junit/junit.jar" sourcepath="/lib/junit/junit-src.jar"/>
-    <classpathentry kind="output" path="bin"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+       <classpathentry kind="src" path="/asm"/>
+       <classpathentry kind="src" path="/org.aspectj.ajdt.core"/>
+       <classpathentry kind="src" path="/bridge"/>
+       <classpathentry kind="src" path="/util"/>
+       <classpathentry sourcepath="C:/Apps/j2sdk1.4.2/src.zip" kind="lib" path="C:/Apps/j2sdk1.4.2/lib/tools.jar"/>
+       <classpathentry kind="src" path="testsrc"/>
+       <classpathentry sourcepath="/lib/junit/junit-src.jar" kind="lib" path="/lib/junit/junit.jar"/>
+       <classpathentry kind="output" path="bin"/>
 </classpath>
index 140394abbf617e59446268ba8145d2ca5b4f1395..53514a29d4132473c3f0138ad40814cc2ca0feee 100644 (file)
@@ -109,7 +109,7 @@ public class Main implements Config {
             }
 
             for (int i = 0; i < filenames.size(); i++) {
-                inputFiles[i]     = findFile((String)filenames.elementAt(i));
+                inputFiles[i]     = new File((String)filenames.elementAt(i));
                 //signatureFiles[i] = createSignatureFile(inputFiles[i]);
             }
 
@@ -191,7 +191,7 @@ public class Main implements Config {
                     javadocargs[k] = (String)options.elementAt(k);
                 }
                 for (int k = 0; k < signatureFiles.length; k++) {
-                    javadocargs[options.size() + k] = signatureFiles[k].getCanonicalPath();
+                    javadocargs[options.size() + k] = StructureUtil.translateAjPathName(signatureFiles[k].getCanonicalPath());
                 }
             }
          
@@ -271,31 +271,6 @@ public class Main implements Config {
         }
     }
 
-    /**
-     * If the file doesn't exist on the specified path look for it in all the other
-     * paths specified by the "sourcepath" option.
-     */
-    static File findFile( String filename ) throws IOException {
-
-        return new File( filename );
-        /*
-        File file = new File(filename);
-        if (file.exists()) {
-            return file;
-        }
-        else {
-            for ( int i = 0; i < sourcePath.size(); i++ ) {
-                File currPath = new File((String)sourcePath.elementAt(i));
-                File currFile = new File(currPath + "/" + filename); // !!!
-                if ( file.exists()) {
-                    return file;
-                }
-            }
-        }
-        throw new IOException("couldn't find source file: " + filename);
-        */
-    }
-
     static Vector getSourcePath() {
         Vector  sourcePath = new Vector();
         boolean found      = false;
@@ -425,8 +400,6 @@ public class Main implements Config {
                                System.err.println("> could not read arg file: " + argFile);
                                ioe.printStackTrace();
                        }
-
-               
         }
         List vargs = new LinkedList(Arrays.asList(args));
 
@@ -469,7 +442,7 @@ public class Main implements Config {
             displayHelpAndExit( null );
         }
         for (int i = 0; i < vargs.size() ; i++) {
-            String arg = (String)vargs.get(i);
+            String arg = (String)vargs.get(i);  
             ignoreArg = false;
             if ( addNextToAJCOptions ) {
                 ajcOptions.addElement( arg );
@@ -581,9 +554,10 @@ public class Main implements Config {
                 // check if this is a file or a package
 //             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 ) {
+                if ((arg.endsWith(".java") && entryName.indexOf('.') == entryName.length()-5) 
+                       || (arg.endsWith(".aj") && entryName.indexOf('.') == entryName.length()-3)      
+                       || arg.endsWith(".lst") 
+                                       && arg != null ) {
                     File f = new File(arg);
                     if (f.isAbsolute()) {
                          filenames.addElement(arg);
@@ -611,7 +585,8 @@ public class Main implements Config {
                                   int index1 = name.lastIndexOf( "." );
                                   int index2 = name.length();
                                   if ( (index1 >= 0 && index2 >= 0 ) &&
-                                        (name.substring(index1, index2).equals( ".java" ) ) ) {
+                                        (name.substring(index1, index2).equals( ".java" )
+                                                                                || name.substring(index1, index2).equals( ".aj" ))) {
                                       return true;
                                   }
                                   else  {
@@ -642,8 +617,7 @@ public class Main implements Config {
              !options.contains( "-protected" ) &&
              !options.contains( "-public" ) ) {
             options.addElement( "-package" );
-        }
-
+        }        
     }
 
     static void expandAtSignFile(String filename, File currentWorkingDir) {
index 21788134f90540cca04b6039058e58cadfc26506..25f2d4223e76ca5e821bf0284c1b1aef3e2816d5 100644 (file)
@@ -109,4 +109,14 @@ public class StructureUtil {
 //                     return false; 
 //             }
        }
+
+       /**
+        * @return      same path, but ending in ".java" instead of ".aj"
+        */
+       public static String translateAjPathName(String path) {
+       if (path.endsWith(".aj")) {
+               path = path.substring(0, path.lastIndexOf(".aj")) + ".java";
+       } 
+       return path;
+       }
 }
index e9a72a38512a462309a811e6c1393b5b3948e40b..330029099e7b468294a68da781444a55d0ae2d81 100644 (file)
@@ -41,8 +41,9 @@ class StubFileGenerator {
 
     static void processFile(SymbolManager symbolManager, File inputFile, File signatureFile) {
         try {
-            PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(signatureFile.getCanonicalPath())));
-            
+               String path = StructureUtil.translateAjPathName(signatureFile.getCanonicalPath());
+            PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(path)));
+             
             String packageName = StructureUtil.getPackageDeclarationFromFile(inputFile);
             
             if (packageName != null ) {
diff --git a/ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.aj b/ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.aj
new file mode 100644 (file)
index 0000000..297e172
--- /dev/null
@@ -0,0 +1,21 @@
+\r
+package foo;\r
+\r
+import fluffy.*;\r
+import fluffy.bunny.*;\r
+import fluffy.bunny.rocks.*;\r
+\r
+public aspect UseThisAspectForLinkCheck {\r
+       \r
+       int foo;\r
+       \r
+       pointcut allExecutions(): execution(* *..*(..));\r
+       \r
+       before(): allExecutions() {\r
+               System.err.println("yo");\r
+       }\r
\r
+       after(): allExecutions() {\r
+               System.err.println("go");\r
+       }\r
+} 
\ No newline at end of file
diff --git a/ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.java b/ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.java
deleted file mode 100644 (file)
index 6130483..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-
-package foo;
-
-import fluffy.*;
-import fluffy.bunny.*;
-import fluffy.bunny.rocks.*;
-
-public aspect UseThisAspectForLinkCheck {
-       
-       int foo;
-       
-       pointcut allExecutions(): execution(* *..*(..));
-       
-       before(): allExecutions() {
-               System.err.println("yo");
-       }
-       after(): allExecutions() {
-               System.err.println("go");
-       }
-} 
\ No newline at end of file
index 451f72969551c1c105d9e1aec1c34f5ce132de6d..b3382ca0e53aecffe13ecb947ed1108ac0ee7f7c 100644 (file)
@@ -26,7 +26,7 @@ public class CoverageTestCase extends TestCase {
                  
 //             System.err.println(new File("testdata/figures-demo").exists());
                File file1 = new File("testdata/coverage/foo/ClassA.java");
-               File aspect1 = new File("testdata/coverage/foo/UseThisAspectForLinkCheck.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");
@@ -35,7 +35,7 @@ public class CoverageTestCase extends TestCase {
                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");
-               
+                   
                String[] args = { 
 //                     "-XajdocDebug",
                        "-source", 
@@ -43,7 +43,7 @@ public class CoverageTestCase extends TestCase {
                        "-private",
                        "-d", 
                        outdir.getAbsolutePath(),
-                       aspect1.getAbsolutePath(),
+                       aspect1.getAbsolutePath(),  
                        file1.getAbsolutePath(), 
                        file2.getAbsolutePath(),
                        file3.getAbsolutePath(),