Fixed: 68494 ajdoc does not support .aj files

This commit is contained in:
mkersten 2004-06-24 22:11:53 +00:00
parent 2489444ba5
commit 3707411c2b
6 changed files with 56 additions and 71 deletions

View 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>

View 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) {

View 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;
}
}

View 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 ) {

View File

@ -1,21 +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");
}
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");
}
}

View 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(),