From 3707411c2b5fdd0294c2ab5305c32766644241f1 Mon Sep 17 00:00:00 2001 From: mkersten Date: Thu, 24 Jun 2004 22:11:53 +0000 Subject: Fixed: 68494 ajdoc does not support .aj files --- ajdoc/.classpath | 20 +++++----- ajdoc/src/org/aspectj/tools/ajdoc/Main.java | 46 +++++----------------- .../src/org/aspectj/tools/ajdoc/StructureUtil.java | 10 +++++ .../org/aspectj/tools/ajdoc/StubFileGenerator.java | 5 ++- .../coverage/foo/UseThisAspectForLinkCheck.aj | 21 ++++++++++ .../coverage/foo/UseThisAspectForLinkCheck.java | 21 ---------- .../org/aspectj/tools/ajdoc/CoverageTestCase.java | 6 +-- 7 files changed, 57 insertions(+), 72 deletions(-) create mode 100644 ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.aj delete mode 100644 ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.java (limited to 'ajdoc') diff --git a/ajdoc/.classpath b/ajdoc/.classpath index eb78052f3..c24411bbb 100644 --- a/ajdoc/.classpath +++ b/ajdoc/.classpath @@ -1,13 +1,13 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java index 140394abb..53514a29d 100644 --- a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java +++ b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java @@ -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) { diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java b/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java index 21788134f..25f2d4223 100644 --- a/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java +++ b/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java @@ -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; + } } diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java b/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java index e9a72a385..330029099 100644 --- a/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java +++ b/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java @@ -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 index 000000000..297e1726b --- /dev/null +++ b/ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.aj @@ -0,0 +1,21 @@ + +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 diff --git a/ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.java b/ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.java deleted file mode 100644 index 6130483cb..000000000 --- a/ajdoc/testdata/coverage/foo/UseThisAspectForLinkCheck.java +++ /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 diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/CoverageTestCase.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/CoverageTestCase.java index 451f72969..b3382ca0e 100644 --- a/ajdoc/testsrc/org/aspectj/tools/ajdoc/CoverageTestCase.java +++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/CoverageTestCase.java @@ -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(), -- cgit v1.2.3