]> source.dussan.org Git - aspectj.git/commitdiff
mavenizing taskdefs - wip
authorAndy Clement <aclement@pivotal.io>
Wed, 30 Jan 2019 19:31:11 +0000 (11:31 -0800)
committerAndy Clement <aclement@pivotal.io>
Wed, 30 Jan 2019 19:31:11 +0000 (11:31 -0800)
36 files changed:
taskdefs/.classpath [deleted file]
taskdefs/.cvsignore [deleted file]
taskdefs/.isJava5 [deleted file]
taskdefs/.project [deleted file]
taskdefs/build.xml [deleted file]
taskdefs/pom.xml [new file with mode: 0644]
taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc10.java [new file with mode: 0644]
taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapter.java [new file with mode: 0644]
taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java [new file with mode: 0644]
taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcCompilerAdapter.java [new file with mode: 0644]
taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java [new file with mode: 0644]
taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java [new file with mode: 0644]
taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/ICommandEditor.java [new file with mode: 0644]
taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties [new file with mode: 0644]
taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java [new file with mode: 0644]
taskdefs/src/main/resources/org/aspectj/antlib.xml [new file with mode: 0644]
taskdefs/src/org/aspectj/antlib.xml [deleted file]
taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java [deleted file]
taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapter.java [deleted file]
taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc2.java [deleted file]
taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcCompilerAdapter.java [deleted file]
taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java [deleted file]
taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajdoc.java [deleted file]
taskdefs/src/org/aspectj/tools/ant/taskdefs/ICommandEditor.java [deleted file]
taskdefs/src/org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties [deleted file]
taskdefs/src/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java [deleted file]
taskdefs/src/test/java/org/aspectj/tools/ant/TaskdefsModuleTests.java [new file with mode: 0644]
taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java [new file with mode: 0644]
taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java [new file with mode: 0644]
taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/AjdocTest.java [new file with mode: 0644]
taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/TaskdefsTests.java [new file with mode: 0644]
taskdefs/testsrc/org/aspectj/tools/ant/TaskdefsModuleTests.java [deleted file]
taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java [deleted file]
taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java [deleted file]
taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjdocTest.java [deleted file]
taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/TaskdefsTests.java [deleted file]

diff --git a/taskdefs/.classpath b/taskdefs/.classpath
deleted file mode 100644 (file)
index 469d094..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="src" path="testsrc"/>
-       <classpathentry kind="lib" path="/lib/junit/junit.jar" sourcepath="/lib/junit/junit-src.jar"/>
-       <classpathentry kind="lib" path="/lib/ant/lib/ant.jar" sourcepath="/lib/ant/ant-src.zip"/>
-       <classpathentry kind="src" path="/bridge"/>
-       <classpathentry kind="src" path="/org.aspectj.ajdt.core"/>
-       <classpathentry kind="src" path="/util"/>
-       <classpathentry kind="lib" path="/lib/ant/lib/xercesImpl.jar"/>
-       <classpathentry kind="lib" path="/lib/ant/lib/xml-apis.jar"/>
-       <classpathentry combineaccessrules="false" kind="src" path="/ajdoc"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-       <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/taskdefs/.cvsignore b/taskdefs/.cvsignore
deleted file mode 100644 (file)
index 38972d8..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-bintest
diff --git a/taskdefs/.isJava5 b/taskdefs/.isJava5
deleted file mode 100644 (file)
index 136d063..0000000
+++ /dev/null
@@ -1 +0,0 @@
-  
\ No newline at end of file
diff --git a/taskdefs/.project b/taskdefs/.project
deleted file mode 100644 (file)
index 19faa6b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>taskdefs</name>
-       <comment></comment>
-       <projects>
-               <project>bridge</project>
-               <project>org.aspectj.ajdt.core</project>
-               <project>util</project>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.jdt.core.javabuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-       </natures>
-</projectDescription>
diff --git a/taskdefs/build.xml b/taskdefs/build.xml
deleted file mode 100644 (file)
index c25c6e7..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<!-- see ../build/*.html for explanation -->
-<project name="taskdefs" default="test" basedir=".">
-    <import file="${basedir}/../build/build.xml"/>  
-</project>
-
diff --git a/taskdefs/pom.xml b/taskdefs/pom.xml
new file mode 100644 (file)
index 0000000..b810249
--- /dev/null
@@ -0,0 +1,60 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.aspectj</groupId>
+    <artifactId>aspectj-parent</artifactId>
+    <version>1.9.3.BUILD-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <artifactId>taskdefs</artifactId>
+  <packaging>jar</packaging>
+  <name>taskdefs</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.aspectj</groupId>
+      <artifactId>util</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.aspectj</groupId>
+      <artifactId>bridge</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.aspectj</groupId>
+      <artifactId>ajdoc</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.aspectj</groupId>
+      <artifactId>org.aspectj.ajdt.core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>xml-apis</groupId>
+      <artifactId>xml-apis</artifactId>
+      <version>1.0</version>
+      <scope>system</scope>
+      <systemPath>${project.basedir}/../lib/ant/lib/xml-apis.jar</systemPath>
+    </dependency>
+    <dependency>
+      <groupId>xercesImpl</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <version>1.0</version>
+      <scope>system</scope>
+      <systemPath>${project.basedir}/../lib/ant/lib/xercesImpl.jar</systemPath>
+    </dependency>
+    <dependency>
+      <groupId>ant</groupId>
+      <artifactId>ant</artifactId>
+      <version>1.0</version>
+      <scope>system</scope>
+      <systemPath>${project.basedir}/../lib/ant/lib/ant.jar</systemPath>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc10.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc10.java
new file mode 100644 (file)
index 0000000..065f44e
--- /dev/null
@@ -0,0 +1,662 @@
+/* *******************************************************************
+ * Copyright (c) 2000-2001 Xerox Corporation. 
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation 
+ * ******************************************************************/
+
+package org.aspectj.tools.ant.taskdefs;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Location;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+import org.aspectj.bridge.AbortException;
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.IMessageHandler;
+import org.aspectj.bridge.IMessageHolder;
+import org.aspectj.bridge.MessageHandler;
+import org.aspectj.tools.ajc.Main;
+import org.aspectj.tools.ajc.Main.MessagePrinter;
+import org.aspectj.util.FileUtil;
+
+/**
+ * Main taskdef class for the AspectJ 1.0 compiler, <code>ajc</code>.
+ * See the README and examples/build.xml for more information.
+ */
+public class Ajc10 extends MatchingTask {
+
+    private static final List<String> VALID_XOPTIONS;
+    static {
+        String[] xs = new String[] 
+            {   "lint", "serializableAspects", "targetNearSource", "OcodeSize",
+                "incrementalFile" };
+        VALID_XOPTIONS = Collections.unmodifiableList(Arrays.asList(xs));
+    }
+    //protected boolean version;
+    protected boolean source14;
+    protected Set ignoredOptions;
+    protected Commandline cmd;
+    protected Commandline vmcmd;
+    private int threads = -1;
+    private File destdir;
+    private File workingdir;
+    private Path internalclasspath;
+    private Path classpath;
+    private Path bootclasspath;
+    private Path extdirs;
+    private Path srcdir;
+    private List argfiles;
+    private boolean fork;
+    private boolean failonerror;
+    private boolean verbose;
+       private String encoding;
+       private String source;
+
+    public Ajc10() {
+        reset();
+    }
+
+    // ------------------------- options 
+    // find option types and whether ignored:
+    //   sed -n '/void set/p' Ajc.java | sed 's/.*\/\/ //' | sort -u
+    //   sed -n '/ignoredOptions/d;/ignored/p' Ajc.java 
+    // each option may be "ignored" and is one+ of:
+    //   ajc-old             used to be an ajc option
+    //   ajc-only            only an option for ajc, not javac
+    //   ajc-taskdef only    only an option for ajc taskdef, not ajc
+    //   javac-also          also an option in javac
+    //   eajc-also
+
+    // ------------------------- options in order per ajc output
+
+    public void setVerbose(boolean verbose) {  // javac-also eajc-also docDone
+        setif(verbose, "-verbose");
+        this.verbose = verbose;
+    }
+
+    public void setVersion(boolean version) {  // javac-also eajc-also docDone
+        // let the compiler handle it
+        if (version) {
+            setif(true, "-version");
+        }
+        //this.version = version;
+    }
+    
+    public void setNocomments(boolean nocomments) { // ajc-only not-eajc docDone
+        if (nocomments) {
+            ignore("-nocomments");
+        }
+        //setif(nocomments, "-nocomments");
+    }
+
+    public void setEmacssym(boolean input) {  // ajc-only  eajc-also docDone
+        setif(input, "-emacssym"); 
+    }
+
+    public void setUsejavac(boolean input) {  // ajc-only not-eajc docDone
+        if (input) {
+            ignore("-usejavac");
+        }
+        //setif(input, "-usejavac"); 
+    }
+
+    public void setPreprocess(boolean preprocess) { // ajc-only not-eajc docDone
+        if (preprocess) {
+            ignore("-preprocess");
+            //setif(preprocess, "-preprocess");
+        }
+    }
+
+    public void setWorkingdir(String workingdir) { // ajc-only not-eajc ocDone
+        ignore("-workingdir");
+        //this.workingdir = project.resolveFile(workingdir);
+    }
+
+    public void setDestdir(String destdir) { // javac-also eajc-also  docDone
+        this.destdir = project.resolveFile(destdir);
+    }
+
+    public void setOptimize(boolean optimize) { // javac-also ignored docDone
+        setif(optimize, "-O");
+    }
+   
+
+    public void setClasspath(Path classpath) {  // javac-also eajc-also docDone
+        if (this.classpath == null) {
+            this.classpath = classpath;
+        } else {
+            this.classpath.append(classpath);
+        }
+    }
+    public Path createClasspath() {  // javac-also docDone
+        if (classpath == null) {
+            classpath = new Path(project);
+        }
+        return classpath.createPath();
+    }        
+    
+    public void setClasspathref(Reference classpathref) {  // javac-also docDone
+        createClasspath().setRefid(classpathref);
+    }
+    
+    public void setBootclasspath(Path bootclasspath) {  // javac-also not-eajc docDone
+        ignore("bootclasspath"); // XXX may jury-rig
+//        if (this.bootclasspath == null) {
+//            this.bootclasspath = bootclasspath;
+//        } else {
+//            this.bootclasspath.append(bootclasspath);
+//        }
+    }
+    public Path createBootclasspath() {  // javac-also not-eajc docDone
+        ignore("bootclasspath"); // XXX may jury-rig
+        if (bootclasspath == null) {
+            bootclasspath = new Path(project);
+        }
+        return bootclasspath.createPath();
+    }    
+    
+    public void setBootclasspathref(Reference bootclasspathref) {  // javac-also not-eajc docDone
+        ignore("bootclasspath"); // XXX may jury-rig
+//        createBootclasspath().setRefid(bootclasspathref);
+    }
+    
+    public void setExtdirs(Path extdirs) {  // javac-also not-eajc docDone
+        ignore("-extdirs");
+//        if (this.extdirs == null) {
+//            this.extdirs = extdirs;
+//        } else {
+//            this.extdirs.append(extdirs);
+//        }
+    }
+
+    public Path createExtdirs() {  // javac-also not-eajc docDone
+        ignore("-extdirs");
+        if (extdirs == null) {
+            extdirs = new Path(project);
+        }
+        return extdirs.createPath();
+    }  
+
+    public void setArgfile(File argfile) { // ajc-only eajc-also docDone
+        if (argfiles == null) {
+            argfiles = new Vector();
+        }
+        argfiles.add(argfile);
+    }
+
+    public void setArgfiles(String argfiles) { // ajc-only eajc-also docDone
+        StringTokenizer tok = new StringTokenizer(argfiles, ", ", false);
+        if (tok.hasMoreTokens() && this.argfiles == null) {
+            this.argfiles = new Vector();
+        }
+        while (tok.hasMoreTokens()) {
+            this.argfiles.add(project.resolveFile(tok.nextToken().trim()));
+        }
+    }
+
+    public void setEncoding(String encoding) { // ignored eajc-also docDone
+        // XXX add support
+        //ignore("encoding");
+        this.encoding = encoding;
+    }
+
+    public void setSource(String input) {    // javac-also (Ant 1.4) eajc-also docDone
+        source = input;
+        //source14 = "1.4".equals(input); // XXX todo
+    }
+
+    public void setLenient(boolean input) {  // ajc-only not-eajc docDone
+        ignore("-lenient");
+        //setif(input, "-lenient"); 
+    }
+
+    public void setStrict(boolean input) {  // ajc-only not-eajc docDone
+        ignore("-strict");
+        //setif(input, "-strict"); 
+    }
+
+    public void setPorting(boolean input) {  // ajc-only not-eajc docDone
+        ignore("-porting");
+        //setif(input, "-porting"); 
+    }
+
+    public void setX(String input) {  // ajc-only eajc-also docDone
+        StringTokenizer tokens = new StringTokenizer(input, ",", false);
+        while (tokens.hasMoreTokens()) {
+            String token = tokens.nextToken().trim();
+            if (1 < token.length()) {
+                if (VALID_XOPTIONS.contains(token)) {
+                    setif(true, "-X" + token); 
+                } else {
+                    ignore("-X" + token);
+                }
+            }
+        }
+    }
+
+    // ------------------------- vestigial
+    public void setThreads(int threads) { // ajc-old docDone ignored
+        ignore("-threads");
+        //this.threads = threads;
+    }
+    
+    public void setDumpstack(boolean dumpstack) { // ajc-old
+        ignore("-dumpstack");
+        //setif(dumpstack, "-dumpstack");
+    }
+
+    // ------------------------- specific to taskdef
+
+    public void setInternalclasspath(Path internalclasspath) { // ajc-taskdef only
+        if (this.internalclasspath == null) {
+            this.internalclasspath = internalclasspath;
+        } else {
+            this.internalclasspath.append(internalclasspath);
+        }
+    }
+    public Path createInternalclasspath() { // ajc-taskdef only
+        if (internalclasspath == null) {
+            internalclasspath = new Path(project);
+        }
+        return internalclasspath.createPath();
+    }        
+    
+    public void setInternalclasspathref(Reference internalclasspathref) { // ajc-taskdef only
+        createInternalclasspath().setRefid(internalclasspathref);
+    }
+
+     public void setSrcdir(Path srcdir) { // javac-also eajc-also docDone
+        if (this.srcdir == null) {
+            this.srcdir = srcdir;
+        } else {
+            this.srcdir.append(srcdir);
+        }
+    }
+
+    public Path createSrc() { // javac-also eajc-also docDone
+        return createSrcdir();
+    }
+
+    public Path createSrcdir() { // javac-also eajc-also docDone
+        if (srcdir == null) {
+            srcdir = new Path(project);
+        }
+        return srcdir.createPath();
+    }
+
+    public void setFork(boolean fork) { // ajc-only not-eajc docDone
+        ignore("fork");
+        //this.fork = fork;
+    }
+
+    public void setFailonerror(boolean failonerror) {  // javac-also docDone
+        this.failonerror = failonerror;
+    }
+
+    public void setMaxmemory(String max) { // ajc-taskdef only docDone
+        ignore("-maxmemory");
+        // we do not run under 1.1 anyway...
+//        createJvmarg().setValue((Project.getJavaVersion().
+//                                 startsWith("1.1") ?
+//                                 "-mx" : "-Xmx") +max);
+    }
+
+    public void setJvmarg(String input) {  // ajc-taskdef only docDone
+        ignore("jvmarg"); // XXX fork
+        //vmcmd.createArgument().setValue(input);
+    }
+
+    public Commandline.Argument createJvmarg() { // ajc-taskdef only docDone
+        ignore("jvmarg"); // XXX fork
+        return vmcmd.createArgument();
+    }
+
+    // ------------------------- javac task compatibility
+    public void setNosymbols(boolean nosymbols) { // todo remove?
+        ignore("-nosymbols");
+        //setif(nosymbols, "-nosymbols");
+    }
+    
+    public void setDebug(boolean debug) { // javac-also eajc-also docDone
+        setif(debug, "-g"); // todo: changed from -debug
+    }
+    
+    public void setDeprecation(boolean deprecation) { // javac-also eajc-also docDone
+        setif(deprecation, "-deprecation"); // XXX eajc: also "warn:deprecation"
+    }
+
+    // ------------------------- javac task compatibility - ignored
+    public void setTarget(String target) {  // javac-also ignored docDone
+        ignore("target"); // todo: ajc accepts but doesn't use - pass in?
+    }
+    public void setDepend(String depend) {  // javac-also ignored docDone
+        ignore("depend");
+    }
+    public void setIncludeantruntime(boolean includeAntruntime) {  // javac-also ignored docDone
+        ignore("includeantruntime");
+    }
+    public void setIncludejavaruntime(boolean includeJavaruntime ) {  // javac-also ignored docDone
+        ignore("includeJavaruntime");
+    }
+
+    // ------------------------- other state methods
+    
+    protected final void ignore(String attribute) {
+        ignoredOptions.add(attribute);
+    }
+
+    public void backdoorSetFile(File file) {
+        if (null != file) {
+            cmd.createArgument().setFile(file);
+        }
+    }
+    
+    /** reset variables to permit gc */
+    public void reset() {
+        //version = false;
+        source14 = false;
+        ignoredOptions = new HashSet();
+        cmd = new Commandline();
+        vmcmd = new Commandline();
+        threads = -1;
+        destdir = null;
+        workingdir = null;
+        internalclasspath = null;
+        classpath = null;
+        bootclasspath = null;
+        extdirs = null;
+        srcdir = null;
+        argfiles = null;
+        fork = false;
+        failonerror = true;
+        encoding = null;
+        source = null;
+    }
+
+    protected final void setif(boolean b, String flag) {
+        if (b) cmd.createArgument().setValue(flag);
+    }
+
+    // ------------------------- operational methods
+
+    @Override
+       public void execute() throws BuildException {
+        if (srcdir == null && argfiles == null) {
+            throw new BuildException("one of srcdir or argfiles must be set!",
+                                     location);
+        }
+//        if (threads != -1) {
+//            cmd.createArgument().setValue("-threads");
+//            cmd.createArgument().setValue(threads+"");
+//        }
+//        if (workingdir != null) {
+//            cmd.createArgument().setValue("-workingdir");
+//            cmd.createArgument().setFile(workingdir);
+//        }
+        if (destdir != null) {
+            cmd.createArgument().setValue("-d");
+            cmd.createArgument().setFile(destdir);
+        }
+        if (classpath != null) {
+            cmd.createArgument().setValue("-classpath");
+            cmd.createArgument().setPath(classpath);
+        }
+        if (bootclasspath != null) {
+            cmd.createArgument().setValue("-bootclasspath");
+            cmd.createArgument().setPath(bootclasspath);
+        }
+        if (extdirs != null) {
+            cmd.createArgument().setValue("-extdirs");
+            cmd.createArgument().setPath(extdirs);
+        }
+        if (null != encoding) {
+            cmd.createArgument().setValue("-encoding");
+            cmd.createArgument().setValue(encoding);
+        }
+        if (null != source) {
+            cmd.createArgument().setValue("-source");
+            cmd.createArgument().setValue(source);
+        }
+
+        int numargfiles = 0;
+        if (argfiles != null) {
+            for (Iterator i = argfiles.iterator(); i.hasNext();) {
+                String name = i.next()+"";
+                File argfile = project.resolveFile(name);
+                if (check(argfile, name, false, location)) {
+                    cmd.createArgument().setValue("-argfile");
+                    cmd.createArgument().setFile(argfile);
+                    numargfiles++;    
+                }
+            }
+        }
+        int numfiles = 0;
+        if (srcdir != null) {
+            // todo: ignore any srcdir if any argfiles and no explicit includes
+            String[] dirs = srcdir.list();
+            for (int i = 0; i < dirs.length; i++) {
+                File dir = project.resolveFile(dirs[i]);
+                check(dir, dirs[i], true, location);
+                String[] files = getDirectoryScanner(dir).getIncludedFiles();
+                for (int j = 0; j < files.length; j++) {
+                    File file = new File(dir, files[j]);
+                    if (FileUtil.hasSourceSuffix(file)) {
+                        cmd.createArgument().setFile(file);
+                        numfiles++;
+                    }
+                }
+            }
+        }
+        if ((null != ignoredOptions) && (ignoredOptions.size() > 0)) {
+            log("The following attributes were ignored " + ignoredOptions,
+                Project.MSG_WARN);
+            if (ignoredOptions.contains("-preprocess")) {
+                throw new BuildException("preprocess no longer supported");
+            }
+        }
+        log("Compiling " + numfiles + " source and " +
+            + numargfiles + " arg files" 
+            + (null == destdir ? "" : " to " + destdir.getPath()), Project.MSG_INFO);
+
+         // here is the actual invocation
+        //int result = (fork || (internalclasspath != null)) ? fork() : spoon();
+        if (fork || (internalclasspath != null))  {
+               log("WARNING: fork not supported", Project.MSG_WARN);
+        }
+        int result = spoon();
+        if (result != 0) {
+            String msg = "Compilation error: " + result;
+            if (failonerror) {
+                reset();
+                throw new BuildException(msg);
+            } else {
+                log(msg, Project.MSG_WARN);
+            }
+        }
+        reset(); // see throw above
+    }
+
+// now leaving version to compiler - remove
+//    protected void version(Path classpath) {
+//        try {
+//            Class main = findClass("org.aspectj.tools.ajc.Main",
+//                                   classpath);
+//            Method printVersion = main.getDeclaredMethod("printVersion",
+//                                                         new Class[]{});
+//            printVersion.setAccessible(true);
+//            printVersion.invoke(main.newInstance(), new Object[]{});
+//        } catch (Exception e) {}
+//    }
+//
+//    protected Class findClass(String classname, Path classpathPath) {
+//        String classpath = (classpathPath != null ?
+//                            classpathPath+"" : "").trim();
+//        if (classpath.length() == 0) {
+//            try {
+//                return Class.forName(classname);
+//            } catch (ClassNotFoundException e){}
+//        }
+//        List urls = new ArrayList();
+//        for (StringTokenizer t = new StringTokenizer(classpath,
+//                                                     File.pathSeparator);
+//             t.hasMoreTokens();) {
+//            File f = new File(t.nextToken().trim());
+//            try {
+//                if (f.exists()) {
+//                    URL url = f.toURL();
+//                    if (url != null) urls.add(url);
+//                }
+//            } catch (MalformedURLException e) {}
+//        }
+//        if (urls.size() == 0) return null;
+//        try {
+//            return new URLClassLoader((URL[])urls.toArray
+//                                      (new URL[urls.size()]),
+//                                      null).loadClass(classname);
+//        } catch (ClassNotFoundException e) {}
+//        return null;
+//    }
+
+// unused now, but leave in
+//    protected int fork() throws BuildException {
+//        Java java = (Java)project.createTask("java");
+//        java.setTaskName(getTaskName());
+//        Path compileClasspath;
+//        if (internalclasspath != null) {
+//            compileClasspath = internalclasspath;
+//            compileClasspath.append(Path.systemClasspath);
+//        } else {
+//            compileClasspath = Path.systemClasspath;
+//        }
+//        //if (version) version(compileClasspath);
+//        java.setClasspath(compileClasspath);
+//        java.setClassname(FALSE_MAIN);
+//        String[] args;
+//        args = cmd.getArguments();
+//        for (int i = 0; i < args.length; i++) {
+//            java.createArg().setValue(args[i]);
+//        }
+//        args = vmcmd.getArguments();
+//        for (int i = 0; i < args.length; i++) {
+//            java.createJvmarg().setValue(args[i]);
+//        }
+//        java.setFork(fork);
+//        // java handles its own verbose logging when forking
+//        return java.executeJava();
+//    }
+
+    /** utility to render String[] for logging */
+    public static String render(String[] args) {
+        if (null == args) return "";
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < args.length; i++) {
+            sb.append(args[i]);
+            sb.append(" ");
+        }
+        return sb.toString();
+    }
+
+    protected int spoon() throws BuildException {
+        //if (version) version(null);
+        int result = -1;
+        final IMessageHolder holder;
+        {
+               MessageHandler handler = new MessageHandler();
+               if (!verbose) {
+                               handler.ignore(IMessage.INFO);
+                       }
+               final IMessageHandler delegate 
+                       = verbose ? MessagePrinter.VERBOSE: MessagePrinter.TERSE;
+                       handler.setInterceptor(delegate);
+                       holder = handler;
+        }
+        try {
+            String[] args = cmd.getCommandline();
+            // XXX avoid rendering if not verbosely logging?
+            log("Running  in-process using " 
+                + Ajc10.render(cmd.getCommandline()), Project.MSG_VERBOSE);
+               
+               Main main = new Main();
+               main.run(args, holder);
+               int errs = holder.numMessages(IMessage.ERROR, true);
+               if (0 < errs) {
+                       result = 1;
+               } else {
+                result = 0;
+            }
+        } catch (Throwable t) {
+            while (t instanceof AbortException) {
+                // check for "just quit -- message printed already"
+                if (((AbortException)t).isSilent()) { 
+                    t = null;
+                    break;
+                }
+                IMessage m = ((AbortException) t).getIMessage();
+                if (null == m) {
+                    break;
+                } else {
+                    Throwable tt = m.getThrown();
+                    if (null != tt) {
+                        t = tt;   
+                    } else {
+                        break;
+                    }
+                }
+            }
+            if (null != t) {
+                // t.printStackTrace(); // let recipient print
+                throw new BuildException("Compiler failure", t, location);
+            }
+        } finally {
+               // now printing messages as we go, above
+//                     IMessage.Kind level = (verbose ? IMessage.INFO : IMessage.WARNING);
+//             if (0 < holder.numMessages(level, true)) {
+//                     final String prefix = "";
+//                     final boolean printSummary = false;
+//                     MessageUtil.print(System.err, 
+//                             holder, 
+//                             prefix, 
+//                             MessageUtil.MESSAGE_ALL,
+//                             (verbose ? MessageUtil.PICK_INFO_PLUS : MessageUtil.PICK_WARNING_PLUS),
+//                             printSummary);
+//             }
+        }
+        return result;
+    }
+
+    protected final boolean check(File file, String name,
+                                  boolean isDir, Location loc) {
+        loc = loc != null ? loc : location;
+        if (file == null) {
+            throw new BuildException(name + " is null!", loc);
+        }
+        if (!file.exists()) {
+            throw new BuildException(file + "doesn't exist!", loc);
+        }
+        if (isDir ^ file.isDirectory()) {
+            String e = file + " should" + (isDir ? "" : "n't")  +
+                " be a directory!";
+            throw new BuildException(e, loc);
+        }
+        return true;
+    }
+}
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapter.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapter.java
new file mode 100644 (file)
index 0000000..a64c513
--- /dev/null
@@ -0,0 +1,132 @@
+/* *******************************************************************
+ * Copyright (c) 2003 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Wes Isberg     initial implementation
+ * ******************************************************************/
+
+package org.aspectj.tools.ant.taskdefs;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Javac;
+import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
+import org.aspectj.util.FileUtil;
+
+import java.io.File;
+//import java.io.FileFilter;
+//import java.io.FileWriter;
+//import java.io.IOException;
+
+/**
+ * Adapt ajc to javac commands.
+ * Note that the srcdirs set for javac are NOT passed on to ajc;
+ * instead, the list of source files generated is passed to ajc.
+ * <p>
+ * Javac usually prunes the source file list based on the timestamps
+ * of corresponding .class files, which is wrong for ajc which
+ * requires all the files every time.  To work around this,
+ * set the global property CLEAN ("build.compiler.clean") to delete
+ * all .class files in the destination directory before compiling.
+ * 
+ * <p><u>Warnings</u>: 
+ * <ol>
+ * <li>cleaning will not work if no destination directory
+ *     is specified in the javac task.
+ *     (RFE: find and kill .class files in source dirs?)</li>
+ * <li>cleaning will makes stepwise build processes fail
+ * if they depend on the results of the prior compilation being
+ * in the same directory, since this deletes <strong>all</strong>
+ * .class files.</li>
+ * <li>If no files are out of date, then the adapter is <b>never</b> called
+ *     and thus cannot gain control to clean out the destination dir.
+ *     </li>
+ * <p>
+ * 
+ * @author Wes Isberg
+ * @since AspectJ 1.1, Ant 1.5.1
+ */
+public class Ajc11CompilerAdapter implements CompilerAdapter {
+
+    /** 
+     * Define this system/project property to signal that the 
+     * destination directory should be cleaned 
+     * and javac reinvoked
+     * to get the complete list of files every time.
+     */
+    public static final String CLEAN = "build.compiler.clean";
+
+    /** track whether we re-called <code>javac.execute()</code> */
+    private static final ThreadLocal inSelfCall = new ThreadLocal() {
+        public Object initialValue() {
+            return Boolean.FALSE;
+        }
+    };
+
+    Javac javac;
+
+    public void setJavac(Javac javac) {
+        this.javac = javac;
+        javac.setTaskName(javac.getTaskName() + " - ajc");
+    }
+
+    public boolean execute() throws BuildException {
+        if (null == javac) {
+            throw new IllegalStateException("null javac");
+        }
+        if (!((Boolean) inSelfCall.get()).booleanValue()
+            && afterCleaningDirs()) {
+            // if we are not re-calling ourself and we cleaned dirs,
+            // then re-call javac to get the list of all source files.
+            inSelfCall.set(Boolean.TRUE);
+            javac.execute();
+            // javac re-invokes us after recalculating file list
+        } else {
+            try {
+                AjcTask ajc = new AjcTask();
+                String err = ajc.setupAjc(javac);
+                if (null != err) {
+                    throw new BuildException(err, javac.getLocation());
+                }
+                ajc.execute();
+                // handles BuildException for failonerror, etc.
+            } finally {
+                inSelfCall.set(Boolean.FALSE);
+            }
+        }
+        return true;
+    }
+
+    /**
+     * If destDir exists and property CLEAN is set, 
+     * this cleans out the dest dir of any .class files,
+     * and returns true to signal a recursive call.
+     * @return true if destDir was cleaned.
+     */
+    private boolean afterCleaningDirs() {
+        String clean = javac.getProject().getProperty(CLEAN);
+        if (null == clean) {
+            return false;
+        }
+        File destDir = javac.getDestdir();
+        if (null == destDir) {
+            javac.log(
+                CLEAN + " specified, but no dest dir to clean",
+                Project.MSG_WARN);
+            return false;
+        }
+        javac.log(
+            CLEAN + " cleaning .class files from " + destDir,
+            Project.MSG_VERBOSE);
+        FileUtil.deleteContents(
+            destDir,
+            FileUtil.DIRS_AND_WRITABLE_CLASSES,
+            true);
+        return true;
+    }
+}
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java
new file mode 100644 (file)
index 0000000..f31c755
--- /dev/null
@@ -0,0 +1,540 @@
+/* *******************************************************************
+ * Copyright (c) 2000-2001 Xerox Corporation. 
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation 
+ * ******************************************************************/
+
+package org.aspectj.tools.ant.taskdefs;
+
+import org.apache.tools.ant.*;
+import org.apache.tools.ant.types.*;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.taskdefs.*;
+import org.apache.tools.ant.util.JavaEnvUtils;
+
+import java.io.*;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+/**
+ * Ant task for the AspectJ compiler -- AJC.
+ * List (.lst) files are passed in as includes.
+ *
+ * This task was developed by the <a href="http://aspectj.org">AspectJ Project</a>
+ *
+ * @author <a href="mailto:palm@parc.xerox.com">Jeffrey Palm</a>
+ * @see    org.aspectj.tools.ant.taskdefs.compilers.AjcCompiler
+ */
+public class Ajc2 extends Javac {
+
+    /**
+     * The name of the adapter we use.
+     */
+    public final static String ADAPTER_CLASS =
+        "org.aspectj.tools.ant.taskdefs.compilers.Ajc";
+
+    /* ----------------------------------------------------------------------
+     * Attribute members
+     * ----------------------------------------------------------------------
+     */
+   
+    /**
+     * How many concurrent threads to use for compilation,
+     * defaults to 0 -- multi-threading disabled.
+     */
+    private Integer threads;
+
+    /**
+     * Don't generate any comments into the woven code.
+     */
+    private boolean nocomments;
+
+    /**
+     * Don't generate .ajsym or .ajsline files.
+     */
+    private boolean nosymbols;
+
+    /**
+     * Generate regular Java code into <workingdir>.
+     */
+    private boolean preprocess;
+
+    /**
+     * Specify where to place intermediate .java files <dir>
+     * defaults to ./ajworkingdir.
+     */
+    private File workingdir;
+
+    /**
+     * The file is a line-delimited list of arguments
+     * these arguments are inserted into the argument list
+     */
+    private List argfiles;
+
+
+    /* ----------------------------------------------------------------------
+     * Misc. members
+     * ----------------------------------------------------------------------
+     */
+
+    /**
+     * Whether we have used the <code>excludes</code> attribute.
+     */
+    private boolean haveExcludes = false;
+
+    /**
+     * Whether we have used the <code>includes</code> attribute.
+     */
+    private boolean haveIncludes = false;
+
+    /**
+     * Whether we have used the <code>excludes</code> attribute.
+     * @return Whether we have used the <code>excludes</code> attribute.
+     */
+    protected boolean hasExcludes() {
+        return haveExcludes;
+    }
+
+    /**
+     * Whether we have used the <code>includes</code> attribute.
+     * @return Whether we have used the <code>includes</code> attribute.
+     */
+    protected boolean hasIncludes() {
+        return haveIncludes;
+    }
+
+    /* ----------------------------------------------------------------------
+     * Attribute access methods
+     * ----------------------------------------------------------------------
+     */
+    
+    /**
+     * Sets the number of threads.
+     *
+     * @param threads the number of threads.
+     * @see           Ajc2#threads
+     */
+    public void setThreads(Integer threads) {
+        this.threads = threads;
+    }
+
+    /**
+     * Returns the number of threads.
+     *
+     * @return the number of threads.
+     * @see    Ajc2#threads
+     */
+    public Integer getThreads() {
+        return threads;
+    }
+
+    /**
+     * Set the <code>-nocomments</code> flag.
+     *
+     * @param nocomments true turns on the flag.
+     * @see              Ajc2#nocomments
+     */
+    public void setNocomments(boolean nocomments) {
+        this.nocomments = nocomments;
+    }
+
+    /**
+     * Returns if the <code>-nocomments</code> flag is turned on.
+     *
+     * @return <code>true</code> if the <code>-nocomments</code> flag is on.
+     * @see    Ajc2#nocomments
+     */
+    public boolean getNocomments() {
+        return nocomments;
+    }
+
+    /**
+     * Set the <code>-nosymbols</code> flag.
+     *
+     * @param nosymbols true turns on the flag.
+     * @see             Ajc2#nosymbols
+     */
+    public void setNosymbols(boolean nosymbols) {
+        this.nosymbols = nosymbols;
+    }
+
+    /**
+     * Returns if the <code>-nosymbols</code> flag is turned on.
+     *
+     * @return <code>true</code> if the <code>-nosymbols</code> flag is on.
+     * @see    Ajc2#nosymbols
+     */    
+    public boolean getNosymbols() {
+        return nosymbols;
+    }
+
+    /**
+     * Returns if the <code>-preprocess</code> flag is turned on.
+     *
+     * @return <code>true</code> if the <code>-preprocess</code> flag is on.
+     * @see    Ajc2#preprocess
+     */
+    public void setPreprocess(boolean preprocess) {
+        this.preprocess = preprocess;
+    }
+
+    /**
+     * Returns if the <code>-preprocess</code> flag is turned on.
+     *
+     * @return <code>true</code> if the <code>-preprocess</code> flag is on.
+     * @see    Ajc2#preprocess
+     */      
+    public boolean getPreprocess() {
+        return preprocess;
+    }
+
+    /**
+     * Sets the workingdir.
+     *
+     * @param workingdir the new workingdir.
+     * @see   Ajc2#workingdir
+     */
+    public void setWorkingdir(File workingdir) {
+        this.workingdir = workingdir;
+    }
+
+    /**
+     * Returns the current workingdir.
+     *
+     * @return the current workingdir.
+     * @see    Ajc2#workingdir
+     */
+    public File getWorkingdir() {
+        return workingdir;
+    }
+
+    /**
+     * Sets the the argument files by the comma-delimited String passed in.
+     *
+     * @param argfiles comma-delimited String contained argument files.
+     */
+    public void setArgfiles(String argfiles) {
+        StringTokenizer tok = new StringTokenizer(argfiles, ",");
+        while (tok.hasMoreTokens()) {
+            File argfile = project.resolveFile(tok.nextToken());
+            if (argfile != null && argfile.exists() && !argfile.isDirectory()) {
+                createArgfile().setFile(argfile);
+            }
+        }
+    }
+
+    /**
+     * Creates a nested <code>Argfile</code>, add it to the list
+     * <code>argfiles</code>, and returns the new <code>Argfile</code>
+     * instance.
+     *
+     * @return a new <code>Argfile</code> instance.
+     */
+    public Argfile createArgfile() {
+        Argfile argfile = new Argfile();
+        if (argfiles == null) {
+            argfiles = new ArrayList();
+        }
+        argfiles.add(argfile);
+        return argfile;
+    }
+
+    /**
+     * Returns the java.util.List of argfiles.
+     * This could be <code>null</code>.
+     *
+     * @return the list of argfiles.
+     */
+    public List getArgfiles() {
+        return argfiles;
+    }
+
+    /**
+     * A simple class with one member -- <code>file</code> -- that
+     * represents an argument file.
+     */
+    public static class Argfile {
+        private File file;
+        public void setFile(File file) { this.file = file; }
+        public File getFile() { return file; }
+        public String toString() { return file.getAbsolutePath(); }
+    }
+
+    /* ----------------------------------------------------------------------
+     * Misc. methods
+     * ----------------------------------------------------------------------
+     */
+
+    /* Leaving the includes blank in the Javac task defaults to including all.
+     * In Ajc, if the user specifies an argfile, but leaves the includes and
+     * excludes blank that person probably meant to just includes to argfile.
+     * So, we keep track of whether includes and/or excludes have been explicitly
+     * used with the have{In,Ex}cludes members, and setting these flags
+     * in the create... and set... methods.
+     *
+     * When constructing the compileList, if both haveIncludes and haveExcludes
+     * are false, but the user has specified an argfile, then we set includes
+     * to '!**' before adding the contents of the argfile.
+     */
+
+    /**
+     * Override Javac.createInclude() to set <code>haveIncludes</code>
+     * to <code>true</code>.
+     *
+     * @return new PatternSet.NameEntry to be added to the include list.
+     * @see    org.apache.tools.taskdefs.Javac#createInclude()
+     */
+    public PatternSet.NameEntry createInclude() {
+        haveIncludes = true;
+        return super.createInclude();
+    }
+
+    /**
+     * Override Javac.createExclude() to set <code>haveExcludes</code>
+     * to <code>true</code>.
+     *
+     * @return new PatternSet.NameEntry to be added to the exclude list.
+     * @see    org.apache.tools.taskdefs.Javac#createExclude()
+     */    
+    public PatternSet.NameEntry createExclude() {
+        haveExcludes = true;
+        return super.createExclude();
+    }
+
+    /**
+     * Override Javac.setIncludes(String) to set <code>haveIncludes</code>
+     * to <code>true</code>.
+     *
+     * @param includes Comma-separated list of includes.
+     * @see   org.apache.tools.taskdefs.Javac#setIncludes(java.lang.String)
+     */
+    public void setIncludes(String includes) {
+        haveIncludes = true;
+        super.setIncludes(includes);
+    }
+
+    /**
+     * Override Javac.setExcludes(String) to set <code>haveExcludes</code>
+     * to <code>true</code>.
+     *
+     * @param excludes Comma-separated list of excludes.
+     * @see   org.apache.tools.taskdefs.Javac#setExcludes(java.lang.String)
+     */    
+    public void setExcludes(String excludes) {
+        haveExcludes = true;
+        super.setExcludes(excludes);
+    }
+
+    public String getAdapterClass() {
+        return ADAPTER_CLASS;
+    }
+    
+
+    public final void execute() throws BuildException {
+        prepare();
+        executeAfterPrepare();
+    }
+
+    /**
+     * Executes by first setting the <code>build.compiler</code> property
+     * to AjcCompiler, then invokes the super.execute() method.
+     *
+     * @throws org.apache.tools.ant.BuildException
+     * @see    org.apache.tools.ant.taskdefs.Javac#execute()
+     */    
+    public void executeAfterPrepare() throws BuildException {
+        
+        // Save the old build.compiler property
+        String oldBuildCompiler = project.getProperty("build.compiler");
+
+        // If oldBuildCompiler is null try to resolve it
+        if (oldBuildCompiler == null) {
+            String javaVersion = JavaEnvUtils.getJavaVersion();
+            if (javaVersion.equals(JavaEnvUtils.JAVA_1_0)) {
+                // Cannot happen
+            } else if (javaVersion.equals(JavaEnvUtils.JAVA_1_1)) {
+                oldBuildCompiler = "classic";
+            } else if (javaVersion.equals(JavaEnvUtils.JAVA_1_2)) {
+                oldBuildCompiler = "classic";
+            } else if (javaVersion.equals(JavaEnvUtils.JAVA_1_3)) {
+                oldBuildCompiler = "modern";
+            }
+        }
+
+        // Set the new adapter
+        project.setProperty("build.compiler", getAdapterClass());
+        BuildException caught = null;
+        try {
+            super.execute();
+        } catch (BuildException be) {
+            caught = be;
+        } finally {
+            
+            // Reset to the old compiler
+            if (oldBuildCompiler != null) {
+                project.setProperty("build.compiler", oldBuildCompiler);
+            }
+        }
+
+        // If we caught an exception executing throw it
+        if (caught != null) {
+            throw caught;
+        }
+     }
+
+    /**
+     * Guaranteed to be called before doing real execute.
+     */
+    public void prepare() {
+        if (argfiles != null && !haveIncludes &&
+            !haveExcludes && getSrcdir() == null) {
+            useDefaultSrcdir();
+        }
+    }
+
+    protected final void useDefaultSrcdir() {
+        setSrcdir(new Path(project, "."));
+    }
+
+    /**
+     * Overrides Javac.scanDir(..) so that it doesn't check dependencies.
+     *
+     * @see org.apache.tools.ant.taskdefs.Javac#scanDir
+     */
+    protected void scanDir(File srcDir, File destDir, String files[]) {
+        List newFiles = new ArrayList();
+
+        // Add the files listed in the argfiles to the includes
+        List newIncludes = new ArrayList();
+        List newArguments = new ArrayList();
+        if (argfiles != null) {
+            Iterator iter = argfiles.iterator();
+            while (iter.hasNext()) {
+                File argfile = ((Argfile)iter.next()).getFile();
+                expandArgfile(argfile, newIncludes, newArguments);
+            }
+        }
+
+        // If there aren't any includes, but we've used an argfile then we should
+        // set the includes to be the one's found in newIncludes
+        // If we do this, we need to re-read files from the directory scanner
+        if (!haveIncludes && !haveExcludes && argfiles != null) {
+            log("Setting includes to '!**'", Project.MSG_VERBOSE);
+            setIncludes("!**");
+            //files = getDirectoryScanner(srcDir).getIncludedFiles();
+        }
+
+        // Otherwise we want to add all .java files to the compileList
+        else {
+            for (int i = 0; i < files.length; i++) {
+                File newFile = new File(srcDir, files[i]);
+                if (newFile != null &&
+                    newFile.exists() &&
+                    newFile.getName().endsWith(".java")) {
+                    newFiles.add(newFile);
+                }
+            }
+        }
+
+        // Add the new included files
+        Iterator iter = newIncludes.iterator();
+        while (iter.hasNext()) {
+            newFiles.add((File)iter.next());
+        }
+
+        // This is the same behavior found in Javac
+        int newFileSize = newFiles.size();
+        if (newFileSize > 0) {
+            File[] newCompileList = new File[compileList.length + newFileSize];
+            System.arraycopy(compileList, 0, newCompileList, 0, compileList.length);
+            System.arraycopy(newFiles.toArray(), 0, newCompileList,
+                             compileList.length, newFileSize);
+            compileList = newCompileList;
+        }
+    }
+
+    private void expandArgfile(File argfile, List includes, List arguments) {
+
+        log("argfile:" + argfile, Project.MSG_VERBOSE);
+        
+        // All paths are relative to the parent
+        File parent = argfile.getParentFile();
+
+        // Sanity check
+        if (parent == null || !parent.exists() || !parent.isDirectory()) {
+            return;
+        }
+
+        // Read the file
+        BufferedReader in = null;
+        try {
+            in = new BufferedReader(new FileReader(argfile));
+            String line;
+            while ((line = in.readLine()) != null) {
+                line = line.trim();
+
+                // Skip blank lines
+                if ("".equals(line)) {
+                    continue;
+                }
+
+                // Allow '#' and '//' line comments
+                int isharp = line.indexOf("#");
+                if (isharp != -1) {
+                    line = line.substring(0, isharp);
+                }
+
+//                int istar = -1;
+
+                // Argument
+                if (line.startsWith("-")) {
+                    arguments.add(line);
+                }
+
+                // If there are stars we'll try to resolve the file here
+                else if (line.indexOf("*") != -1) {
+                    log("The argfile line '" + line + "' is invalid",
+                        Project.MSG_WARN);
+                }
+
+                // Another argfile
+                else if (line.startsWith("@")) {
+                    String newArgfileName = line.substring(1);
+                    File newArgfile = new File(parent, newArgfileName);
+                    expandArgfile(newArgfile, includes, arguments);
+                }
+
+                // Source file
+                else {
+                    File newfile = new File(line);
+                    if (!newfile.isAbsolute()) {
+                        newfile = new File(parent, line);
+                    }
+                    if (newfile != null && newfile.exists() &&
+                        !newfile.isDirectory() &&
+                        newfile.getName().endsWith(".java")) {
+                        includes.add(newfile);
+                    }
+                }
+
+            }
+        } catch (IOException ioe) {
+            log("trouble with argfile: " + argfile + ":" + ioe, Project.MSG_ERR);
+        } finally {
+            try {
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ioe2) {
+            }
+        }
+    }
+}
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcCompilerAdapter.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcCompilerAdapter.java
new file mode 100644 (file)
index 0000000..1542f6c
--- /dev/null
@@ -0,0 +1,117 @@
+/* *******************************************************************
+ * Copyright (c) 2000-2001 Xerox Corporation. 
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation 
+ * ******************************************************************/
+
+package org.aspectj.tools.ant.taskdefs;
+
+import org.apache.tools.ant.taskdefs.Javac;
+import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Path;
+
+
+import java.io.File;
+
+/**
+ * Partial implementation of CompilerAdapter for ajc task.
+ * The Javac interface does not support argfiles which are
+ * typically necessary to compile under ajc, so this 
+ * implementation is not documented, recommended, or supported.
+ * See Apache request for enhancement 
+ * <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7542">
+ * 7542</a>.
+ * @see CompilerAdapter
+ */
+public class AjcCompilerAdapter implements CompilerAdapter {
+    // Cannot extend Ajc because CompilerAdapter.execute() returns boolean.
+
+    Ajc10 ajc = null;
+
+    /** @see CompilerAdapter */
+    public void setJavac(Javac javac) {
+        if (null == javac) {
+            throw new IllegalArgumentException("null javac");
+        }
+        Object task = javac.getProject().createTask("ajc"); 
+        String err = null;
+        if (null == task) {
+            err = "ajc not defined - put ajc taskdef library on classpath";
+        } else if (!(task instanceof Ajc10)) {
+            String name = task.getClass().getName();
+            err = "Wrong class for Ajc task - ";
+            if (name.equals(Ajc10.class.getName())) {
+                err = err + "second class loader - put ajc taskdef library "
+                    + "only on system classpath via ant/lib";
+            } else {
+                err = err + name;
+            }
+        }
+        if (null != err) {
+            throw new Error(err);
+        }
+
+        Ajc10 tempAjc = (Ajc10) task;
+        Path srcDir = javac.getSrcdir();
+        if (null != srcDir) {
+            tempAjc.setSrcdir(srcDir);
+        }
+        File destDir = javac.getDestdir();
+        if (null != destDir) {
+            tempAjc.setDestdir(destDir.getPath());
+        }
+        Path classpath = javac.getClasspath();
+        if (null != classpath) {
+            tempAjc.setClasspath(classpath);
+        }
+        Path bootclasspath = javac.getBootclasspath();
+        if (null != bootclasspath) {
+            tempAjc.setBootclasspath(bootclasspath);
+        }
+        Path extDirs = javac.getExtdirs();
+        if (null != extDirs) {
+            tempAjc.setExtdirs(extDirs);
+        }
+
+        tempAjc.setFailonerror(javac.getFailonerror());
+        tempAjc.setDeprecation(javac.getDeprecation()); // XXX unsupported
+        tempAjc.setEncoding(javac.getEncoding());
+        tempAjc.setDebug(javac.getDebug()); // XXX unsupported
+        tempAjc.setOptimize(javac.getOptimize()); // XXX unsupported
+        tempAjc.setDepend(javac.getDepend()?"on":"off"); // XXX unsupported
+        tempAjc.setVerbose(javac.getVerbose()); 
+        String target = javac.getTarget();
+        if (null != target) {
+            tempAjc.setTarget(target);
+        }
+        tempAjc.setIncludeantruntime(javac.getIncludeantruntime()); // XXX unsupported
+        File[] files = javac.getFileList();
+        if (null != files) {
+            for (int i = 0; i < files.length; i++) {
+                tempAjc.backdoorSetFile(files[i]);
+            } 
+        }
+        ajc = tempAjc;
+    }
+
+    /** 
+     * Run the compiler.
+     * @see CompilerAdapter#execute() 
+     * @throws BuildException if setJavac(Javac) was not called before each call of this
+     */
+    public boolean execute() throws BuildException {
+        if (null == ajc) {
+            throw new BuildException("setJavac(Javac) not completed");
+        }
+        ajc.execute();
+        ajc = null; // enforce one-shot
+        return true;
+    }
+}
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java
new file mode 100644 (file)
index 0000000..fe6be92
--- /dev/null
@@ -0,0 +1,2171 @@
+/* *******************************************************************
+ * Copyright (c) 2001-2001 Xerox Corporation, 
+ *               2002 Palo Alto Research Center, Incorporated (PARC)
+ *               2003-2004 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation 
+ *     Wes Isberg     2003-2004 changes
+ * ******************************************************************/
+
+package org.aspectj.tools.ant.taskdefs;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Location;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Copy;
+import org.apache.tools.ant.taskdefs.Delete;
+import org.apache.tools.ant.taskdefs.Execute;
+import org.apache.tools.ant.taskdefs.Expand;
+import org.apache.tools.ant.taskdefs.Javac;
+import org.apache.tools.ant.taskdefs.LogStreamHandler;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.taskdefs.Mkdir;
+import org.apache.tools.ant.taskdefs.PumpStreamHandler;
+import org.apache.tools.ant.taskdefs.Zip;
+import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.PatternSet;
+import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.types.ZipFileSet;
+import org.apache.tools.ant.util.TaskLogger;
+import org.aspectj.bridge.AbortException;
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.IMessage.Kind;
+import org.aspectj.bridge.IMessageHandler;
+import org.aspectj.bridge.IMessageHolder;
+import org.aspectj.bridge.MessageHandler;
+import org.aspectj.bridge.MessageUtil;
+import org.aspectj.tools.ajc.Main;
+import org.aspectj.util.FileUtil;
+import org.aspectj.util.LangUtil;
+
+/**
+ * This runs the AspectJ 1.1 compiler, supporting all the command-line options. In 1.1.1, ajc copies resources from input jars, but
+ * you can copy resources from the source directories using sourceRootCopyFilter. When not forking, things will be copied as needed
+ * for each iterative compile, but when forking things are only copied at the completion of a successful compile.
+ * <p>
+ * See the development environment guide for usage documentation.
+ * 
+ * @since AspectJ 1.1, Ant 1.5
+ */
+public class AjcTask extends MatchingTask {
+       /*
+        * This task mainly converts ant specification for ajc, verbosely ignoring improper input. It also has some special features for
+        * non-obvious clients: (1) Javac compiler adapter supported in <code>setupAjc(AjcTask, Javac, File)</code> and
+        * <code>readArguments(String[])</code>; (2) testing is supported by (a) permitting the same specification to be re-run with
+        * added flags (settings once made cannot be removed); and (b) permitting recycling the task with <code>reset()</code>
+        * (untested).
+        * 
+        * The parts that do more than convert ant specs are (a) code for forking; (b) code for copying resources.
+        * 
+        * If you maintain/upgrade this task, keep in mind: (1) changes to the semantics of ajc (new options, new values permitted,
+        * etc.) will have to be reflected here. (2) the clients: the iajc ant script, Javac compiler adapter, maven clients of iajc,
+        * and testing code.
+        */
+
+       // XXX move static methods after static initializer
+       /**
+        * This method extracts javac arguments to ajc, and add arguments to make ajc behave more like javac in copying resources.
+        * <p>
+        * Pass ajc-specific options using compilerarg sub-element:
+        * 
+        * <pre>
+        * &lt;javac srcdir=&quot;src&quot;&gt;
+        *     &lt;compilerarg compiler=&quot;...&quot; line=&quot;-argfile src/args.lst&quot;/&gt;
+        * &lt;javac&gt;
+        * </pre>
+        * 
+        * Some javac arguments are not supported in this component (yet):
+        * 
+        * <pre>
+        * String memoryInitialSize;
+        * boolean includeAntRuntime = true;
+        * boolean includeJavaRuntime = false;
+        * </pre>
+        * 
+        * Other javac arguments are not supported in ajc 1.1:
+        * 
+        * <pre>
+        * boolean optimize;
+        * String forkedExecutable;
+        * FacadeTaskHelper facade;
+        * boolean depend;
+        * String debugLevel;
+        * Path compileSourcepath;
+        * </pre>
+        * 
+        * @param javac the Javac command to implement (not null)
+        * @param ajc the AjcTask to adapt (not null)
+        * @param destDir the File class destination directory (may be null)
+        * @return null if no error, or String error otherwise
+        */
+       public String setupAjc(Javac javac) {
+               if (null == javac) {
+                       return "null javac";
+               }
+               AjcTask ajc = this;
+               // no null checks b/c AjcTask handles null input gracefully
+               ajc.setProject(javac.getProject());
+               ajc.setLocation(javac.getLocation());
+               ajc.setTaskName("javac-iajc");
+               ajc.setDebug(javac.getDebug());
+               ajc.setDeprecation(javac.getDeprecation());
+               ajc.setFailonerror(javac.getFailonerror());
+               final boolean fork = javac.isForkedJavac();
+               ajc.setFork(fork);
+               if (fork) {
+                       ajc.setMaxmem(javac.getMemoryMaximumSize());
+               }
+               ajc.setNowarn(javac.getNowarn());
+               ajc.setListFileArgs(javac.getListfiles());
+               ajc.setVerbose(javac.getVerbose());
+               ajc.setTarget(javac.getTarget());
+               ajc.setSource(javac.getSource());
+               ajc.setEncoding(javac.getEncoding());
+               File javacDestDir = javac.getDestdir();
+               if (null != javacDestDir) {
+                       ajc.setDestdir(javacDestDir);
+                       // filter requires dest dir
+                       // mimic Javac task's behavior in copying resources,
+                       ajc.setSourceRootCopyFilter("**/CVS/*,**/*.java,**/*.aj");
+               }
+               ajc.setBootclasspath(javac.getBootclasspath());
+               ajc.setExtdirs(javac.getExtdirs());
+               ajc.setClasspath(javac.getClasspath());
+               // ignore srcDir -- all files picked up in recalculated file list
+               // ajc.setSrcDir(javac.getSrcdir());
+               ajc.addFiles(javac.getFileList());
+               // arguments can override the filter, add to paths, override options
+               ajc.readArguments(javac.getCurrentCompilerArgs());
+
+               return null;
+       }
+
+       /**
+        * Find aspectjtools.jar on the task or system classpath. Accept <code>aspectj{-}tools{...}.jar</code> mainly to support build
+        * systems using maven-style re-naming (e.g., <code>aspectj-tools-1.1.0.jar</code>. Note that we search the task classpath
+        * first, though an entry on the system classpath would be loaded first, because it seems more correct as the more specific one.
+        * 
+        * @return readable File for aspectjtools.jar, or null if not found.
+        */
+       public static File findAspectjtoolsJar() {
+               File result = null;
+               ClassLoader loader = AjcTask.class.getClassLoader();
+               if (loader instanceof AntClassLoader) {
+                       AntClassLoader taskLoader = (AntClassLoader) loader;
+                       String cp = taskLoader.getClasspath();
+                       String[] cps = LangUtil.splitClasspath(cp);
+                       for (int i = 0; (i < cps.length) && (null == result); i++) {
+                               result = isAspectjtoolsjar(cps[i]);
+                       }
+               }
+               if (null == result) {
+                       final Path classpath = Path.systemClasspath;
+                       final String[] paths = classpath.list();
+                       for (int i = 0; (i < paths.length) && (null == result); i++) {
+                               result = isAspectjtoolsjar(paths[i]);
+                       }
+               }
+               return (null == result ? null : result.getAbsoluteFile());
+       }
+
+       /** @return File if readable jar with aspectj tools name, or null */
+       private static File isAspectjtoolsjar(String path) {
+               if (null == path) {
+                       return null;
+               }
+               final String prefix = "aspectj";
+               final String infix = "tools";
+               final String altInfix = "-tools";
+               final String suffix = ".jar";
+               final int prefixLength = 7; // prefix.length();
+               final int minLength = 16;
+               // prefixLength + infix.length() + suffix.length();
+               if (!path.endsWith(suffix)) {
+                       return null;
+               }
+               int loc = path.lastIndexOf(prefix);
+               if ((-1 != loc) && ((loc + minLength) <= path.length())) {
+                       String rest = path.substring(loc + prefixLength);
+                       if (-1 != rest.indexOf(File.pathSeparator)) {
+                               return null;
+                       }
+                       if (rest.startsWith(infix) || rest.startsWith(altInfix)) {
+                               File result = new File(path);
+                               if (result.canRead() && result.isFile()) {
+                                       return result;
+                               }
+                       }
+               }
+               return null;
+       }
+
+       /**
+        * Maximum length (in chars) of command line before converting to an argfile when forking
+        */
+       private static final int MAX_COMMANDLINE = 4096;
+
+       private static final File DEFAULT_DESTDIR = new File(".") {
+               @Override
+               public String toString() {
+                       return "(no destination dir specified)";
+               }
+       };
+
+       /** do not throw BuildException on fail/abort message with usage */
+       private static final String USAGE_SUBSTRING = "AspectJ-specific options";
+
+       /** valid -X[...] options other than -Xlint variants */
+       private static final List VALID_XOPTIONS;
+
+       /** valid warning (-warn:[...]) variants */
+       private static final List VALID_WARNINGS;
+
+       /** valid debugging (-g:[...]) variants */
+       private static final List VALID_DEBUG;
+
+       /**
+        * -Xlint variants (error, warning, ignore)
+        * 
+        * @see org.aspectj.weaver.Lint
+        */
+       private static final List VALID_XLINT;
+
+       public static final String COMMAND_EDITOR_NAME = AjcTask.class.getName() + ".COMMAND_EDITOR";
+
+       static final String[] TARGET_INPUTS = new String[] { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11" };
+       static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11"};
+       static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", "-10", "-11" };
+
+       private static final ICommandEditor COMMAND_EDITOR;
+
+       static {
+               // many now deprecated: reweavable*
+               String[] xs = new String[] { "serializableAspects", "incrementalFile", "lazyTjp", "reweavable", "reweavable:compress",
+                               "notReweavable", "noInline", "terminateAfterCompilation", "hasMember", "ajruntimetarget:1.2",
+                               "ajruntimetarget:1.5", "addSerialVersionUID"
+
+               // , "targetNearSource", "OcodeSize",
+               };
+               VALID_XOPTIONS = Collections.unmodifiableList(Arrays.asList(xs));
+
+               xs = new String[] { "constructorName", "packageDefaultMethod", "deprecation", "maskedCatchBlocks", "unusedLocals",
+                               "unusedArguments", "unusedImports", "syntheticAccess", "assertIdentifier", "allDeprecation", "allJavadoc",
+                               "charConcat", "conditionAssign",
+
+                               "emptyBlock", "fieldHiding", "finally", "indirectStatic", "intfNonInherited", "javadoc", "localHiding", "nls",
+                               "noEffectAssign", "pkgDefaultMethod", "semicolon", "unqualifiedField", "unusedPrivate", "unusedThrown",
+                               "uselessTypeCheck", "specialParamHiding", "staticReceiver", "syntheticAccess", "none" };
+               VALID_WARNINGS = Collections.unmodifiableList(Arrays.asList(xs));
+
+               xs = new String[] { "none", "lines", "vars", "source" };
+               VALID_DEBUG = Collections.unmodifiableList(Arrays.asList(xs));
+
+               xs = new String[] { "error", "warning", "ignore" };
+               VALID_XLINT = Collections.unmodifiableList(Arrays.asList(xs));
+
+               ICommandEditor editor = null;
+               try {
+                       String editorClassName = System.getProperty(COMMAND_EDITOR_NAME);
+                       if (null != editorClassName) {
+                               ClassLoader cl = AjcTask.class.getClassLoader();
+                               Class editorClass = cl.loadClass(editorClassName);
+                               editor = (ICommandEditor) editorClass.newInstance();
+                       }
+               } catch (Throwable t) {
+                       System.err.println("Warning: unable to load command editor");
+                       t.printStackTrace(System.err);
+               }
+               COMMAND_EDITOR = editor;
+       }
+       // ---------------------------- state and Ant interface thereto
+       private boolean verbose;
+       private boolean timers;
+       private boolean listFileArgs;
+       private boolean failonerror;
+       private boolean fork;
+       private String maxMem;
+       private TaskLogger logger;
+
+       // ------- single entries dumped into cmd
+       protected GuardedCommand cmd;
+
+       // ------- lists resolved in addListArgs() at execute() time
+       private Path srcdir;
+       private Path injars;
+       private Path inpath;
+       private Path classpath;
+       private Path bootclasspath;
+       private Path forkclasspath;
+       private Path extdirs;
+       private Path aspectpath;
+       private Path argfiles;
+       private Path inxmlfiles;
+       private List ignored;
+       private Path sourceRoots;
+       private File xweaveDir;
+       private String xdoneSignal;
+
+       private List<CompilerArg> compilerArgs;
+       
+       // ----- added by adapter - integrate better?
+       private List /* File */adapterFiles;
+       private String[] adapterArguments;
+
+       private IMessageHolder messageHolder;
+       private ICommandEditor commandEditor;
+
+       // -------- resource-copying
+       /** true if copying injar non-.class files to the output jar */
+       private boolean copyInjars;
+       private boolean copyInpath;
+
+       /** non-null if copying all source root files but the filtered ones */
+       private String sourceRootCopyFilter;
+
+       /** non-null if copying all inpath dir files but the filtered ones */
+       private String inpathDirCopyFilter;
+
+       /** directory sink for classes */
+       private File destDir;
+
+       /** zip file sink for classes */
+       private File outjar;
+
+       /** track whether we've supplied any temp outjar */
+       private boolean outjarFixedup;
+
+       /**
+        * When possibly copying resources to the output jar, pass ajc a fake output jar to copy from, so we don't change the
+        * modification time of the output jar when copying injars/inpath into the actual outjar.
+        */
+       private File tmpOutjar;
+
+       private boolean executing;
+
+       /** non-null only while executing in same vm */
+       private Main main;
+
+       /** true only when executing in other vm */
+       private boolean executingInOtherVM;
+
+       /** true if -incremental */
+       private boolean inIncrementalMode;
+
+       /** true if -XincrementalFile (i.e, setTagFile) */
+       private boolean inIncrementalFileMode;
+
+       /** log command in non-verbose mode */
+       private boolean logCommand;
+
+       /** used when forking */
+       private CommandlineJava javaCmd = new CommandlineJava();
+
+       // also note MatchingTask grabs source files...
+
+       public AjcTask() {
+               reset();
+       }
+
+       /** to use this same Task more than once (testing) */
+       public void reset() { // XXX possible to reset MatchingTask?
+               // need declare for "all fields initialized in ..."
+               adapterArguments = null;
+               adapterFiles = new ArrayList();
+               compilerArgs = null;
+               argfiles = null;
+               inxmlfiles = null;
+               executing = false;
+               aspectpath = null;
+               bootclasspath = null;
+               classpath = null;
+               cmd = new GuardedCommand();
+               copyInjars = false;
+               copyInpath = false;
+               destDir = DEFAULT_DESTDIR;
+               executing = false;
+               executingInOtherVM = false;
+               extdirs = null;
+               failonerror = true; // non-standard default
+               forkclasspath = null;
+               inIncrementalMode = false;
+               inIncrementalFileMode = false;
+               ignored = new ArrayList();
+               injars = null;
+               inpath = null;
+               listFileArgs = false;
+               maxMem = null;
+               messageHolder = null;
+               outjar = null;
+               sourceRootCopyFilter = null;
+               inpathDirCopyFilter = null;
+               sourceRoots = null;
+               srcdir = null;
+               tmpOutjar = null;
+               verbose = false;
+               timers = false;
+               xweaveDir = null;
+               xdoneSignal = null;
+               logCommand = false;
+               javaCmd = new CommandlineJava();
+       }
+
+       protected void ignore(String ignored) {
+               this.ignored.add(ignored + " at " + getLocation());
+       }
+
+       // ---------------------- option values
+
+       // used by entries with internal commas
+       protected String validCommaList(String list, List valid, String label) {
+               return validCommaList(list, valid, label, valid.size());
+       }
+
+       protected String validCommaList(String list, List valid, String label, int max) {
+               StringBuffer result = new StringBuffer();
+               StringTokenizer st = new StringTokenizer(list, ",");
+               int num = 0;
+               while (st.hasMoreTokens()) {
+                       String token = st.nextToken().trim();
+                       num++;
+                       if (num > max) {
+                               ignore("too many entries for -" + label + ": " + token);
+                               break;
+                       }
+                       if (!valid.contains(token)) {
+                               ignore("bad commaList entry for -" + label + ": " + token);
+                       } else {
+                               if (0 < result.length()) {
+                                       result.append(",");
+                               }
+                               result.append(token);
+                       }
+               }
+               return (0 == result.length() ? null : result.toString());
+       }
+
+  /**
+   * Controls whether annotation processing and/or compilation is done.
+   * -proc:none means that compilation takes place without annotation processing.
+   * -proc:only means that only annotation processing is done, without any subsequent compilation.
+   */
+  public void setProc(String proc) {
+    if (proc.equals("none")) {
+      cmd.addFlag("-proc:none", true);
+    } else if (proc.equals("only")) {
+      cmd.addFlag("-proc:only", true);
+    }
+  }
+
+  /**
+   * -processor class1[,class2,class3...]
+   *  Names of the annotation processors to run. This bypasses the default discovery process.
+   */
+  public void setProcessor(String processors) {
+    cmd.addFlagged("-processor", processors);
+  }
+  
+  /**
+   * -processorpath path
+   * Specify where to find annotation processors; if this option is not used, the class path will be searched for processors.
+   */
+  public void setProcessorpath(String processorpath) {
+    cmd.addFlagged("-processorpath", processorpath);
+  }
+
+  /**
+   * -s dir
+   * Specify the directory where to place generated source files. The directory must already exist; javac will not create it.
+   * If a class is part of a package, the compiler puts the source file in a subdirectory reflecting the package name,
+   * creating directories as needed.
+   *
+   * For example, if you specify -s C:\mysrc and the class is called com.mypackage.MyClass,
+   * then the source file will be placed in C:\mysrc\com\mypackage\MyClass.java.
+   */
+  public void setS(String s) {
+    cmd.addFlagged("-s", s);
+  }
+
+       public void setIncremental(boolean incremental) {
+               cmd.addFlag("-incremental", incremental);
+               inIncrementalMode = incremental;
+       }
+
+       public void setLogCommand(boolean logCommand) {
+               this.logCommand = logCommand;
+       }
+
+       public void setHelp(boolean help) {
+               cmd.addFlag("-help", help);
+       }
+
+       public void setVersion(boolean version) {
+               cmd.addFlag("-version", version);
+       }
+
+       public void setXTerminateAfterCompilation(boolean b) {
+               cmd.addFlag("-XterminateAfterCompilation", b);
+       }
+
+       public void setXReweavable(boolean reweavable) {
+               cmd.addFlag("-Xreweavable", reweavable);
+       }
+
+       public void setXmlConfigured(boolean xmlConfigured) {
+               cmd.addFlag("-xmlConfigured", xmlConfigured);
+       }
+
+       public void setXJoinpoints(String optionalJoinpoints) {
+               cmd.addFlag("-Xjoinpoints:" + optionalJoinpoints, true);
+       }
+
+       public void setCheckRuntimeVersion(boolean b) {
+               cmd.addFlag("-checkRuntimeVersion:" + b, true);
+       }
+
+       public void setXNoWeave(boolean b) {
+               if (logger != null) {
+                       logger.warning("the noweave option is no longer required and is being ignored");
+               }
+       }
+
+       public void setNoWeave(boolean b) {
+               if (logger != null) {
+                       logger.warning("the noweave option is no longer required and is being ignored");
+               }
+       }
+
+       public void setXNotReweavable(boolean notReweavable) {
+               cmd.addFlag("-XnotReweavable", notReweavable);
+       }
+
+       public void setXaddSerialVersionUID(boolean addUID) {
+               cmd.addFlag("-XaddSerialVersionUID", addUID);
+       }
+
+       public void setXNoInline(boolean noInline) {
+               cmd.addFlag("-XnoInline", noInline);
+       }
+
+       public void setShowWeaveInfo(boolean showweaveinfo) {
+               cmd.addFlag("-showWeaveInfo", showweaveinfo);
+       }
+
+       public void setNowarn(boolean nowarn) {
+               cmd.addFlag("-nowarn", nowarn);
+       }
+
+       public void setDeprecation(boolean deprecation) {
+               cmd.addFlag("-deprecation", deprecation);
+       }
+
+       public void setWarn(String warnings) {
+               warnings = validCommaList(warnings, VALID_WARNINGS, "warn");
+               cmd.addFlag("-warn:" + warnings, (null != warnings));
+       }
+
+       public void setDebug(boolean debug) {
+               cmd.addFlag("-g", debug);
+       }
+
+       public void setDebugLevel(String level) {
+               level = validCommaList(level, VALID_DEBUG, "g");
+               cmd.addFlag("-g:" + level, (null != level));
+       }
+
+       public void setEmacssym(boolean emacssym) {
+               cmd.addFlag("-emacssym", emacssym);
+       }
+
+       public void setCrossrefs(boolean on) {
+               cmd.addFlag("-crossrefs", on);
+       }
+
+       /**
+        * -Xlint - set default level of -Xlint messages to warning (same as </code>-Xlint:warning</code>)
+        */
+       public void setXlintwarnings(boolean xlintwarnings) {
+               cmd.addFlag("-Xlint", xlintwarnings);
+       }
+
+       /**
+        * -Xlint:{error|warning|info} - set default level for -Xlint messages
+        * 
+        * @param xlint the String with one of error, warning, ignored
+        */
+       public void setXlint(String xlint) {
+               xlint = validCommaList(xlint, VALID_XLINT, "Xlint", 1);
+               cmd.addFlag("-Xlint:" + xlint, (null != xlint));
+       }
+
+       /**
+        * -Xlintfile {lint.properties} - enable or disable specific forms of -Xlint messages based on a lint properties file (default
+        * is <code>org/aspectj/weaver/XLintDefault.properties</code>)
+        * 
+        * @param xlintFile the File with lint properties
+        */
+       public void setXlintfile(File xlintFile) {
+               cmd.addFlagged("-Xlintfile", xlintFile.getAbsolutePath());
+       }
+
+       public void setPreserveAllLocals(boolean preserveAllLocals) {
+               cmd.addFlag("-preserveAllLocals", preserveAllLocals);
+       }
+
+       public void setNoImportError(boolean noImportError) {
+               cmd.addFlag("-warn:-unusedImport", noImportError);
+       }
+
+       public void setEncoding(String encoding) {
+               cmd.addFlagged("-encoding", encoding);
+       }
+
+       public void setLog(File file) {
+               cmd.addFlagged("-log", file.getAbsolutePath());
+       }
+
+       public void setProceedOnError(boolean proceedOnError) {
+               cmd.addFlag("-proceedOnError", proceedOnError);
+       }
+
+       public void setVerbose(boolean verbose) {
+               cmd.addFlag("-verbose", verbose);
+               this.verbose = verbose;
+       }
+
+       public void setTimers(boolean timers) {
+               cmd.addFlag("-timers", timers);
+               this.timers = timers;
+       }
+
+       public void setListFileArgs(boolean listFileArgs) {
+               this.listFileArgs = listFileArgs;
+       }
+
+       public void setReferenceInfo(boolean referenceInfo) {
+               cmd.addFlag("-referenceInfo", referenceInfo);
+       }
+
+       public void setTime(boolean time) {
+               cmd.addFlag("-time", time);
+       }
+
+       public void setNoExit(boolean noExit) {
+               cmd.addFlag("-noExit", noExit);
+       }
+
+       public void setFailonerror(boolean failonerror) {
+               this.failonerror = failonerror;
+       }
+
+       /**
+        * @return true if fork was set
+        */
+       public boolean isForked() {
+               return fork;
+       }
+
+       public void setFork(boolean fork) {
+               this.fork = fork;
+       }
+
+       public void setMaxmem(String maxMem) {
+               this.maxMem = maxMem;
+       }
+
+       /** support for nested &lt;jvmarg&gt; elements */
+       public Commandline.Argument createJvmarg() {
+               return this.javaCmd.createVmArgument();
+       }
+       
+       public static class CompilerArg {
+
+               private String value;
+               
+               public String getValue() {
+                       return value;
+               }
+               
+               public void setValue(String value) {
+                       this.value = value;
+               }
+               
+               @Override
+               public String toString() {
+                       return value;
+               }
+       }
+
+       public CompilerArg createCompilerarg() {
+                CompilerArg compilerArg = new CompilerArg();
+                if (compilerArgs == null) {
+                        compilerArgs = new ArrayList<CompilerArg>();
+                }
+                compilerArgs.add(compilerArg);
+                return compilerArg;
+       }
+
+       // ----------------
+       public void setTagFile(File file) {
+               inIncrementalMode = true;
+               cmd.addFlagged(Main.CommandController.TAG_FILE_OPTION, file.getAbsolutePath());
+               inIncrementalFileMode = true;
+       }
+
+       public void setOutjar(File file) {
+               if (DEFAULT_DESTDIR != destDir) {
+                       String e = "specifying both output jar (" + file + ") and destination dir (" + destDir + ")";
+                       throw new BuildException(e);
+               }
+               outjar = file;
+               outjarFixedup = false;
+               tmpOutjar = null;
+       }
+
+       public void setOutxml(boolean outxml) {
+               cmd.addFlag("-outxml", outxml);
+       }
+
+       public void setOutxmlfile(String name) {
+               cmd.addFlagged("-outxmlfile", name);
+       }
+
+       public void setDestdir(File dir) {
+               if (null != outjar) {
+                       String e = "specifying both output jar (" + outjar + ") and destination dir (" + dir + ")";
+                       throw new BuildException(e);
+               }
+               cmd.addFlagged("-d", dir.getAbsolutePath());
+               destDir = dir;
+       }
+
+       /**
+        * @param input a String in TARGET_INPUTS
+        */
+       public void setTarget(String input) {
+               String ignore = cmd.addOption("-target", TARGET_INPUTS, input);
+               if (null != ignore) {
+                       ignore(ignore);
+               }
+       }
+
+       /**
+        * Language compliance level. If not set explicitly, eclipse default holds.
+        * 
+        * @param input a String in COMPLIANCE_INPUTS
+        */
+       public void setCompliance(String input) {
+               String ignore = cmd.addOption(null, COMPLIANCE_INPUTS, input);
+               if (null != ignore) {
+                       ignore(ignore);
+               }
+       }
+
+       /**
+        * Source compliance level. If not set explicitly, eclipse default holds.
+        * 
+        * @param input a String in SOURCE_INPUTS
+        */
+       public void setSource(String input) {
+               String ignore = cmd.addOption("-source", SOURCE_INPUTS, input);
+               if (null != ignore) {
+                       ignore(ignore);
+               }
+       }
+       
+       public void setParameters(boolean b) {
+               cmd.addFlag("-parameters",b);
+       }
+
+       /**
+        * Flag to copy all non-.class contents of injars to outjar after compile completes. Requires both injars and outjar.
+        * 
+        * @param doCopy
+        */
+       public void setCopyInjars(boolean doCopy) {
+               ignore("copyInJars");
+               log("copyInjars not required since 1.1.1.\n", Project.MSG_WARN);
+               // this.copyInjars = doCopy;
+       }
+
+       /**
+        * Option to copy all files from all source root directories except those specified here. If this is specified and sourceroots
+        * are specified, then this will copy all files except those specified in the filter pattern. Requires sourceroots.
+        * 
+        * @param filter a String acceptable as an excludes filter for an Ant Zip fileset.
+        */
+       public void setSourceRootCopyFilter(String filter) {
+               this.sourceRootCopyFilter = filter;
+       }
+
+       /**
+        * Option to copy all files from all inpath directories except the files specified here. If this is specified and inpath
+        * directories are specified, then this will copy all files except those specified in the filter pattern. Requires inpath. If
+        * the input does not contain "**\/*.class", then this prepends it, to avoid overwriting woven classes with unwoven input.
+        * 
+        * @param filter a String acceptable as an excludes filter for an Ant Zip fileset.
+        */
+       public void setInpathDirCopyFilter(String filter) {
+               if (null != filter) {
+                       if (-1 == filter.indexOf("**/*.class")) {
+                               filter = "**/*.class," + filter;
+                       }
+               }
+               this.inpathDirCopyFilter = filter;
+       }
+
+       public void setX(String input) { // ajc-only eajc-also docDone
+               StringTokenizer tokens = new StringTokenizer(input, ",", false);
+               while (tokens.hasMoreTokens()) {
+                       String token = tokens.nextToken().trim();
+                       if (1 < token.length()) {
+                               // new special case: allow -Xset:anything
+                               if (VALID_XOPTIONS.contains(token) || token.indexOf("set:") == 0 || token.indexOf("joinpoints:") == 0) {
+                                       cmd.addFlag("-X" + token, true);
+                               } else {
+                                       ignore("-X" + token);
+                               }
+                       }
+               }
+       }
+
+       public void setXDoneSignal(String doneSignal) {
+               this.xdoneSignal = doneSignal;
+       }
+
+       /** direct API for testing */
+       public void setMessageHolder(IMessageHolder holder) {
+               this.messageHolder = holder;
+       }
+
+       /**
+        * Setup custom message handling.
+        * 
+        * @param className the String fully-qualified-name of a class reachable from this object's class loader, implementing
+        *        IMessageHolder, and having a public no-argument constructor.
+        * @throws BuildException if unable to create instance of className
+        */
+       public void setMessageHolderClass(String className) {
+               try {
+                       Class mclass = Class.forName(className);
+                       IMessageHolder holder = (IMessageHolder) mclass.newInstance();
+                       setMessageHolder(holder);
+               } catch (Throwable t) {
+                       String m = "unable to instantiate message holder: " + className;
+                       throw new BuildException(m, t);
+               }
+       }
+
+       /** direct API for testing */
+       public void setCommandEditor(ICommandEditor editor) {
+               this.commandEditor = editor;
+       }
+
+       /**
+        * Setup command-line filter. To do this staticly, define the environment variable
+        * <code>org.aspectj.tools.ant.taskdefs.AjcTask.COMMAND_EDITOR</code> with the <code>className</code> parameter.
+        * 
+        * @param className the String fully-qualified-name of a class reachable from this object's class loader, implementing
+        *        ICommandEditor, and having a public no-argument constructor.
+        * @throws BuildException if unable to create instance of className
+        */
+       public void setCommandEditorClass(String className) { // skip Ant interface?
+               try {
+                       Class mclass = Class.forName(className);
+                       setCommandEditor((ICommandEditor) mclass.newInstance());
+               } catch (Throwable t) {
+                       String m = "unable to instantiate command editor: " + className;
+                       throw new BuildException(m, t);
+               }
+       }
+
+       // ---------------------- Path lists
+
+       /**
+        * Add path elements to source path and return result. Elements are added even if they do not exist.
+        * 
+        * @param source the Path to add to - may be null
+        * @param toAdd the Path to add - may be null
+        * @return the (never-null) Path that results
+        */
+       protected Path incPath(Path source, Path toAdd) {
+               if (null == source) {
+                       source = new Path(project);
+               }
+               if (null != toAdd) {
+                       source.append(toAdd);
+               }
+               return source;
+       }
+
+       public void setSourcerootsref(Reference ref) {
+               createSourceRoots().setRefid(ref);
+       }
+
+       public void setSourceRoots(Path roots) {
+               sourceRoots = incPath(sourceRoots, roots);
+       }
+
+       public Path createSourceRoots() {
+               if (sourceRoots == null) {
+                       sourceRoots = new Path(project);
+               }
+               return sourceRoots.createPath();
+       }
+
+       public void setXWeaveDir(File file) {
+               if ((null != file) && file.isDirectory() && file.canRead()) {
+                       xweaveDir = file;
+               }
+       }
+
+       public void setInjarsref(Reference ref) {
+               createInjars().setRefid(ref);
+       }
+
+       public void setInpathref(Reference ref) {
+               createInpath().setRefid(ref);
+       }
+
+       public void setInjars(Path path) {
+               injars = incPath(injars, path);
+       }
+
+       public void setInpath(Path path) {
+               inpath = incPath(inpath, path);
+       }
+
+       public Path createInjars() {
+               if (injars == null) {
+                       injars = new Path(project);
+               }
+               return injars.createPath();
+       }
+
+       public Path createInpath() {
+               if (inpath == null) {
+                       inpath = new Path(project);
+               }
+               return inpath.createPath();
+       }
+
+       public void setClasspath(Path path) {
+               classpath = incPath(classpath, path);
+       }
+
+       public void setClasspathref(Reference classpathref) {
+               createClasspath().setRefid(classpathref);
+       }
+
+       public Path createClasspath() {
+               if (classpath == null) {
+                       classpath = new Path(project);
+               }
+               return classpath.createPath();
+       }
+
+       public void setBootclasspath(Path path) {
+               bootclasspath = incPath(bootclasspath, path);
+       }
+
+       public void setBootclasspathref(Reference bootclasspathref) {
+               createBootclasspath().setRefid(bootclasspathref);
+       }
+
+       public Path createBootclasspath() {
+               if (bootclasspath == null) {
+                       bootclasspath = new Path(project);
+               }
+               return bootclasspath.createPath();
+       }
+
+       public void setForkclasspath(Path path) {
+               forkclasspath = incPath(forkclasspath, path);
+       }
+
+       public void setForkclasspathref(Reference forkclasspathref) {
+               createForkclasspath().setRefid(forkclasspathref);
+       }
+
+       public Path createForkclasspath() {
+               if (forkclasspath == null) {
+                       forkclasspath = new Path(project);
+               }
+               return forkclasspath.createPath();
+       }
+
+       public void setExtdirs(Path path) {
+               extdirs = incPath(extdirs, path);
+       }
+
+       public void setExtdirsref(Reference ref) {
+               createExtdirs().setRefid(ref);
+       }
+
+       public Path createExtdirs() {
+               if (extdirs == null) {
+                       extdirs = new Path(project);
+               }
+               return extdirs.createPath();
+       }
+
+       public void setAspectpathref(Reference ref) {
+               createAspectpath().setRefid(ref);
+       }
+
+       public void setAspectpath(Path path) {
+               aspectpath = incPath(aspectpath, path);
+       }
+
+       public Path createAspectpath() {
+               if (aspectpath == null) {
+                       aspectpath = new Path(project);
+               }
+               return aspectpath.createPath();
+       }
+
+       public void setSrcDir(Path path) {
+               srcdir = incPath(srcdir, path);
+       }
+
+       public Path createSrc() {
+               return createSrcdir();
+       }
+
+       public Path createSrcdir() {
+               if (srcdir == null) {
+                       srcdir = new Path(project);
+               }
+               return srcdir.createPath();
+       }
+
+       /** @return true if in incremental mode (command-line or file) */
+       public boolean isInIncrementalMode() {
+               return inIncrementalMode;
+       }
+
+       /** @return true if in incremental file mode */
+       public boolean isInIncrementalFileMode() {
+               return inIncrementalFileMode;
+       }
+
+       public void setArgfilesref(Reference ref) {
+               createArgfiles().setRefid(ref);
+       }
+
+       public void setArgfiles(Path path) { // ajc-only eajc-also docDone
+               argfiles = incPath(argfiles, path);
+       }
+
+       public Path createArgfiles() {
+               if (argfiles == null) {
+                       argfiles = new Path(project);
+               }
+               return argfiles.createPath();
+       }
+
+       public void setInxmlref(Reference ref) {
+               createArgfiles().setRefid(ref);
+       }
+
+       public void setInxml(Path path) { // ajc-only eajc-also docDone
+               inxmlfiles = incPath(inxmlfiles, path);
+       }
+
+       public Path createInxml() {
+               if (inxmlfiles == null) {
+                       inxmlfiles = new Path(project);
+               }
+               return inxmlfiles.createPath();
+       }
+
+       // ------------------------------ run
+
+       /**
+        * Compile using ajc per settings.
+        * 
+        * @exception BuildException if the compilation has problems or if there were compiler errors and failonerror is true.
+        */
+       @Override
+       public void execute() throws BuildException {
+               this.logger = new TaskLogger(this);
+               if (executing) {
+                       throw new IllegalStateException("already executing");
+               } else {
+                       executing = true;
+               }
+               setupOptions();
+               verifyOptions();
+               try {
+                       String[] args = makeCommand();
+                       if (logCommand) {
+                               log("ajc " + Arrays.asList(args));
+                       } else {
+                               logVerbose("ajc " + Arrays.asList(args));
+                       }
+                       if (!fork) {
+                               executeInSameVM(args);
+                       } else { // when forking, Adapter handles failonerror
+                               executeInOtherVM(args);
+                       }
+               } catch (BuildException e) {
+                       throw e;
+               } catch (Throwable x) {
+                       this.logger.error(Main.renderExceptionForUser(x));
+                       throw new BuildException("IGNORE -- See " + LangUtil.unqualifiedClassName(x) + " rendered to ant logger");
+               } finally {
+                       executing = false;
+                       if (null != tmpOutjar) {
+                               tmpOutjar.delete();
+                       }
+               }
+       }
+
+       /**
+        * Halt processing. This tells main in the same vm to quit. It fails when running in forked mode.
+        * 
+        * @return true if not in forked mode and main has quit or been told to quit
+        */
+       public boolean quit() {
+               if (executingInOtherVM) {
+                       return false;
+               }
+               Main me = main;
+               if (null != me) {
+                       me.quit();
+               }
+               return true;
+       }
+
+       // package-private for testing
+       String[] makeCommand() {
+               ArrayList result = new ArrayList();
+               if (0 < ignored.size()) {
+                       for (Iterator iter = ignored.iterator(); iter.hasNext();) {
+                               logVerbose("ignored: " + iter.next());
+                       }
+               }
+               // when copying resources, use temp jar for class output
+               // then copy temp jar contents and resources to output jar
+               if ((null != outjar) && !outjarFixedup) {
+                       if (copyInjars || copyInpath || (null != sourceRootCopyFilter) || (null != inpathDirCopyFilter)) {
+                               String path = outjar.getAbsolutePath();
+                               int len = FileUtil.zipSuffixLength(path);
+                               path = path.substring(0, path.length() - len) + ".tmp.jar";
+                               tmpOutjar = new File(path);
+                       }
+                       if (null == tmpOutjar) {
+                               cmd.addFlagged("-outjar", outjar.getAbsolutePath());
+                       } else {
+                               cmd.addFlagged("-outjar", tmpOutjar.getAbsolutePath());
+                       }
+                       outjarFixedup = true;
+               }
+
+               result.addAll(cmd.extractArguments());
+               addListArgs(result);
+
+               String[] command = (String[]) result.toArray(new String[0]);
+               if (null != commandEditor) {
+                       command = commandEditor.editCommand(command);
+               } else if (null != COMMAND_EDITOR) {
+                       command = COMMAND_EDITOR.editCommand(command);
+               }
+               return command;
+       }
+
+       /**
+        * Create any pseudo-options required to implement some of the macro options
+        * 
+        * @throws BuildException if options conflict
+        */
+       protected void setupOptions() {
+               if (null != xweaveDir) {
+                       if (DEFAULT_DESTDIR != destDir) {
+                               throw new BuildException("weaveDir forces destdir");
+                       }
+                       if (null != outjar) {
+                               throw new BuildException("weaveDir forces outjar");
+                       }
+                       if (null != injars) {
+                               throw new BuildException("weaveDir incompatible with injars now");
+                       }
+                       if (null != inpath) {
+                               throw new BuildException("weaveDir incompatible with inpath now");
+                       }
+
+                       File injar = zipDirectory(xweaveDir);
+                       setInjars(new Path(getProject(), injar.getAbsolutePath()));
+                       setDestdir(xweaveDir);
+               }
+       }
+
+       protected File zipDirectory(File dir) {
+               File tempDir = new File(".");
+               try {
+                       tempDir = File.createTempFile("AjcTest", ".tmp");
+                       tempDir.mkdirs();
+                       tempDir.deleteOnExit(); // XXX remove zip explicitly..
+               } catch (IOException e) {
+                       // ignore
+               }
+               // File result = new File(tempDir,
+               String filename = "AjcTask-" + System.currentTimeMillis() + ".zip";
+               File result = new File(filename);
+               Zip zip = new Zip();
+               zip.setProject(getProject());
+               zip.setDestFile(result);
+               zip.setTaskName(getTaskName() + " - zip");
+               FileSet fileset = new FileSet();
+               fileset.setDir(dir);
+               zip.addFileset(fileset);
+               zip.execute();
+               Delete delete = new Delete();
+               delete.setProject(getProject());
+               delete.setTaskName(getTaskName() + " - delete");
+               delete.setDir(dir);
+               delete.execute();
+               Mkdir mkdir = new Mkdir();
+               mkdir.setProject(getProject());
+               mkdir.setTaskName(getTaskName() + " - mkdir");
+               mkdir.setDir(dir);
+               mkdir.execute();
+               return result;
+       }
+
+       /**
+        * @throw BuildException if options conflict
+        */
+       protected void verifyOptions() {
+               StringBuffer sb = new StringBuffer();
+               if (fork && isInIncrementalMode() && !isInIncrementalFileMode()) {
+                       sb.append("can fork incremental only using tag file.\n");
+               }
+               if (((null != inpathDirCopyFilter) || (null != sourceRootCopyFilter)) && (null == outjar) && (DEFAULT_DESTDIR == destDir)) {
+                       final String REQ = " requires dest dir or output jar.\n";
+                       if (null == inpathDirCopyFilter) {
+                               sb.append("sourceRootCopyFilter");
+                       } else if (null == sourceRootCopyFilter) {
+                               sb.append("inpathDirCopyFilter");
+                       } else {
+                               sb.append("sourceRootCopyFilter and inpathDirCopyFilter");
+                       }
+                       sb.append(REQ);
+               }
+               if (0 < sb.length()) {
+                       throw new BuildException(sb.toString());
+               }
+       }
+
+       /**
+        * Run the compile in the same VM by loading the compiler (Main), setting up any message holders, doing the compile, and
+        * converting abort/failure and error messages to BuildException, as appropriate.
+        * 
+        * @throws BuildException if abort or failure messages or if errors and failonerror.
+        * 
+        */
+       protected void executeInSameVM(String[] args) {
+               if (null != maxMem) {
+                       log("maxMem ignored unless forked: " + maxMem, Project.MSG_WARN);
+               }
+               IMessageHolder holder = messageHolder;
+               int numPreviousErrors;
+               if (null == holder) {
+                       MessageHandler mhandler = new MessageHandler(true);
+                       final IMessageHandler delegate;
+                       delegate = new AntMessageHandler(this.logger, this.verbose, false);
+                       mhandler.setInterceptor(delegate);
+                       holder = mhandler;
+                       numPreviousErrors = 0;
+               } else {
+                       numPreviousErrors = holder.numMessages(IMessage.ERROR, true);
+               }
+               {
+                       Main newmain = new Main();
+                       newmain.setHolder(holder);
+                       newmain.setCompletionRunner(new Runnable() {
+                               @Override
+                               public void run() {
+                                       doCompletionTasks();
+                               }
+                       });
+                       if (null != main) {
+                               MessageUtil.fail(holder, "still running prior main");
+                               return;
+                       }
+                       main = newmain;
+               }
+               main.runMain(args, false);
+               if (failonerror) {
+                       int errs = holder.numMessages(IMessage.ERROR, false);
+                       errs -= numPreviousErrors;
+                       if (0 < errs) {
+                               String m = errs + " errors";
+                               MessageUtil.print(System.err, holder, "", MessageUtil.MESSAGE_ALL, MessageUtil.PICK_ERROR, true);
+                               throw new BuildException(m);
+                       }
+               }
+               // Throw BuildException if there are any fail or abort
+               // messages.
+               // The BuildException message text has a list of class names
+               // for the exceptions found in the messages, or the
+               // number of fail/abort messages found if there were
+               // no exceptions for any of the fail/abort messages.
+               // The interceptor message handler should have already
+               // printed the messages, including any stack traces.
+               // HACK: this ignores the Usage message
+               {
+                       IMessage[] fails = holder.getMessages(IMessage.FAIL, true);
+                       if (!LangUtil.isEmpty(fails)) {
+                               StringBuffer sb = new StringBuffer();
+                               String prefix = "fail due to ";
+                               int numThrown = 0;
+                               for (int i = 0; i < fails.length; i++) {
+                                       String message = fails[i].getMessage();
+                                       if (LangUtil.isEmpty(message)) {
+                                               message = "<no message>";
+                                       } else if (-1 != message.indexOf(USAGE_SUBSTRING)) {
+                                               continue;
+                                       }
+                                       Throwable t = fails[i].getThrown();
+                                       if (null != t) {
+                                               numThrown++;
+                                               sb.append(prefix);
+                                               sb.append(LangUtil.unqualifiedClassName(t.getClass()));
+                                               String thrownMessage = t.getMessage();
+                                               if (!LangUtil.isEmpty(thrownMessage)) {
+                                                       sb.append(" \"" + thrownMessage + "\"");
+                                               }
+                                       }
+                                       sb.append("\"" + message + "\"");
+                                       prefix = ", ";
+                               }
+                               if (0 < sb.length()) {
+                                       sb.append(" (" + numThrown + " exceptions)");
+                                       throw new BuildException(sb.toString());
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Execute in a separate VM. Differences from normal same-VM execution:
+        * <ul>
+        * <li>ignores any message holder {class} set</li>
+        * <li>No resource-copying between interative runs</li>
+        * <li>failonerror fails when process interface fails to return negative values</li>
+        * </ul>
+        * 
+        * @param args String[] of the complete compiler command to execute
+        * 
+        * @see DefaultCompilerAdapter#executeExternalCompile(String[], int)
+        * @throws BuildException if ajc aborts (negative value) or if failonerror and there were compile errors.
+        */
+       protected void executeInOtherVM(String[] args) {
+               javaCmd.setClassname(org.aspectj.tools.ajc.Main.class.getName());
+
+               final Path vmClasspath = javaCmd.createClasspath(getProject());
+               {
+                       File aspectjtools = null;
+                       int vmClasspathSize = vmClasspath.size();
+                       if ((null != forkclasspath) && (0 != forkclasspath.size())) {
+                               vmClasspath.addExisting(forkclasspath);
+                       } else {
+                               aspectjtools = findAspectjtoolsJar();
+                               if (null != aspectjtools) {
+                                       vmClasspath.createPathElement().setLocation(aspectjtools);
+                               }
+                       }
+                       int newVmClasspathSize = vmClasspath.size();
+                       if (vmClasspathSize == newVmClasspathSize) {
+                               String m = "unable to find aspectjtools to fork - ";
+                               if (null != aspectjtools) {
+                                       m += "tried " + aspectjtools.toString();
+                               } else if (null != forkclasspath) {
+                                       m += "tried " + forkclasspath.toString();
+                               } else {
+                                       m += "define forkclasspath or put aspectjtools on classpath";
+                               }
+                               throw new BuildException(m);
+                       }
+               }
+               if (null != maxMem) {
+                       javaCmd.setMaxmemory(maxMem);
+               }
+               File tempFile = null;
+               int numArgs = args.length;
+               args = GuardedCommand.limitTo(args, MAX_COMMANDLINE, getLocation());
+
+               if (args.length != numArgs) {
+                       tempFile = new File(args[1]);
+               }
+               try {
+                       boolean setMessageHolderOnForking = (this.messageHolder != null);
+                       String[] javaArgs = javaCmd.getCommandline();
+                       String[] both = new String[javaArgs.length + args.length + (setMessageHolderOnForking ? 2 : 0)];
+                       System.arraycopy(javaArgs, 0, both, 0, javaArgs.length);
+                       System.arraycopy(args, 0, both, javaArgs.length, args.length);
+                       if (setMessageHolderOnForking) {
+                               both[both.length - 2] = "-messageHolder";
+                               both[both.length - 1] = this.messageHolder.getClass().getName();
+                       }
+                       // try to use javaw instead on windows
+                       if (both[0].endsWith("java.exe")) {
+                               String path = both[0];
+                               path = path.substring(0, path.length() - 4);
+                               path = path + "w.exe";
+                               File javaw = new File(path);
+                               if (javaw.canRead() && javaw.isFile()) {
+                                       both[0] = path;
+                               }
+                       }
+                       logVerbose("forking " + Arrays.asList(both));
+                       int result = execInOtherVM(both);
+                       if (0 > result) {
+                               throw new BuildException("failure[" + result + "] running ajc");
+                       } else if (failonerror && (0 < result)) {
+                               throw new BuildException("compile errors: " + result);
+                       }
+                       // when forking, do completion only at end and when successful
+                       doCompletionTasks();
+               } finally {
+                       if (null != tempFile) {
+                               tempFile.delete();
+                       }
+               }
+       }
+
+       /**
+        * Execute in another process using the same JDK and the base directory of the project. XXX correct?
+        */
+       protected int execInOtherVM(String[] args) {
+               try {
+
+                       Project project = getProject();
+                       PumpStreamHandler handler = new LogStreamHandler(this, verbose ? Project.MSG_VERBOSE : Project.MSG_INFO,
+                                       Project.MSG_WARN);
+
+                       // replace above two lines with what follows as an aid to debugging when running the unit tests....
+//                     LogStreamHandler handler = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN) {
+//
+//                             ByteArrayOutputStream baos = new ByteArrayOutputStream();
+//
+//                             /*
+//                              * @see
+//                              * org.apache.tools.ant.taskdefs.PumpStreamHandler#createProcessOutputPump(java.
+//                              * io.InputStream, java.io.OutputStream)
+//                              */
+//                             protected void createProcessErrorPump(InputStream is, OutputStream os) {
+//                                     super.createProcessErrorPump(is, baos);
+//                             }
+//
+//                             /*
+//                              * @see org.apache.tools.ant.taskdefs.LogStreamHandler#stop()
+//                              */
+//                             public void stop() {
+//                                     byte[] written = baos.toByteArray();
+//                                     System.err.print(new String(written));
+//                                     super.stop();
+//                             }
+//                     };
+
+                       Execute exe = new Execute(handler);
+                       exe.setAntRun(project);
+                       exe.setWorkingDirectory(project.getBaseDir());
+                       exe.setCommandline(args);
+                       try {
+                               if (executingInOtherVM) {
+                                       String s = "already running in other vm?";
+                                       throw new BuildException(s, location);
+                               }
+                               executingInOtherVM = true;
+                               exe.execute();
+                       } finally {
+                               executingInOtherVM = false;
+                       }
+                       return exe.getExitValue();
+               } catch (IOException e) {
+                       String m = "Error executing command " + Arrays.asList(args);
+                       throw new BuildException(m, e, location);
+               }
+       }
+
+       // ------------------------------ setup and reporting
+       /** @return null if path null or empty, String rendition otherwise */
+       protected static void addFlaggedPath(String flag, Path path, List<String> list) {
+               if (!LangUtil.isEmpty(flag) && ((null != path) && (0 < path.size()))) {
+                       list.add(flag);
+                       list.add(path.toString());
+               }
+       }
+
+       /**
+        * Add to list any path or plural arguments.
+        */
+       protected void addListArgs(List<String> list) throws BuildException {
+               addFlaggedPath("-classpath", classpath, list);
+               addFlaggedPath("-bootclasspath", bootclasspath, list);
+               addFlaggedPath("-extdirs", extdirs, list);
+               addFlaggedPath("-aspectpath", aspectpath, list);
+               addFlaggedPath("-injars", injars, list);
+               addFlaggedPath("-inpath", inpath, list);
+               addFlaggedPath("-sourceroots", sourceRoots, list);
+               
+               if (this.compilerArgs != null) {
+                       for (CompilerArg compilerArg:compilerArgs) {
+                               list.add(compilerArg.toString());
+                       }
+               }
+
+               if (argfiles != null) {
+                       String[] files = argfiles.list();
+                       for (int i = 0; i < files.length; i++) {
+                               File argfile = project.resolveFile(files[i]);
+                               if (check(argfile, files[i], false, location)) {
+                                       list.add("-argfile");
+                                       list.add(argfile.getAbsolutePath());
+                               }
+                       }
+               }
+               if (inxmlfiles != null) {
+                       String[] files = inxmlfiles.list();
+                       for (int i = 0; i < files.length; i++) {
+                               File inxmlfile = project.resolveFile(files[i]);
+                               if (check(inxmlfile, files[i], false, location)) {
+                                       list.add("-xmlConfigured");
+                                       list.add(inxmlfile.getAbsolutePath());
+                               }
+                       }
+               }
+               if (srcdir != null) {
+                       // todo: ignore any srcdir if any argfiles and no explicit includes
+                       String[] dirs = srcdir.list();
+                       for (int i = 0; i < dirs.length; i++) {
+                               File dir = project.resolveFile(dirs[i]);
+                               check(dir, dirs[i], true, location);
+                               // relies on compiler to prune non-source files
+                               String[] files = getDirectoryScanner(dir).getIncludedFiles();
+                               for (int j = 0; j < files.length; j++) {
+                                       File file = new File(dir, files[j]);
+                                       if (FileUtil.hasSourceSuffix(file)) {
+                                               if (!list.contains(file.getAbsolutePath())) {
+                                                       list.add(file.getAbsolutePath());
+                                               }
+                                       }
+                               }
+                       }
+               }
+               if (0 < adapterFiles.size()) {
+                       for (Iterator iter = adapterFiles.iterator(); iter.hasNext();) {
+                               File file = (File) iter.next();
+                               if (file.canRead() && FileUtil.hasSourceSuffix(file)) {
+                                       list.add(file.getAbsolutePath());
+                               } else {
+                                       this.logger.warning("skipping file: " + file);
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Throw BuildException unless file is valid.
+        * 
+        * @param file the File to check
+        * @param name the symbolic name to print on error
+        * @param isDir if true, verify file is a directory
+        * @param loc the Location used to create sensible BuildException
+        * @return
+        * @throws BuildException unless file valid
+        */
+       protected final boolean check(File file, String name, boolean isDir, Location loc) {
+               loc = loc != null ? loc : location;
+               if (file == null) {
+                       throw new BuildException(name + " is null!", loc);
+               }
+               if (!file.exists()) {
+                       throw new BuildException(file + " doesn't exist!", loc);
+               }
+               if (isDir ^ file.isDirectory()) {
+                       String e = file + " should" + (isDir ? "" : "n't") + " be a directory!";
+                       throw new BuildException(e, loc);
+               }
+               return true;
+       }
+
+       /**
+        * Called when compile or incremental compile is completing, this completes the output jar or directory by copying resources if
+        * requested. Note: this is a callback run synchronously by the compiler. That means exceptions thrown here are caught by
+        * Main.run(..) and passed to the message handler.
+        */
+       protected void doCompletionTasks() {
+               if (!executing) {
+                       throw new IllegalStateException("should be executing");
+               }
+               if (null != outjar) {
+                       completeOutjar();
+               } else {
+                       completeDestdir();
+               }
+               if (null != xdoneSignal) {
+                       MessageUtil.info(messageHolder, xdoneSignal);
+               }
+       }
+
+       /**
+        * Complete the destination directory by copying resources from the source root directories (if the filter is specified) and
+        * non-.class files from the input jars (if XCopyInjars is enabled).
+        */
+       private void completeDestdir() {
+               if (!copyInjars && (null == sourceRootCopyFilter) && (null == inpathDirCopyFilter)) {
+                       return;
+               } else if ((destDir == DEFAULT_DESTDIR) || !destDir.canWrite()) {
+                       String s = "unable to copy resources to destDir: " + destDir;
+                       throw new BuildException(s);
+               }
+               final Project project = getProject();
+               if (copyInjars) { // XXXX remove as unused since 1.1.1
+                       if (null != inpath) {
+                               log("copyInjars does not support inpath.\n", Project.MSG_WARN);
+                       }
+                       String taskName = getTaskName() + " - unzip";
+                       String[] paths = injars.list();
+                       if (!LangUtil.isEmpty(paths)) {
+                               PatternSet patternSet = new PatternSet();
+                               patternSet.setProject(project);
+                               patternSet.setIncludes("**/*");
+                               patternSet.setExcludes("**/*.class");
+                               for (int i = 0; i < paths.length; i++) {
+                                       Expand unzip = new Expand();
+                                       unzip.setProject(project);
+                                       unzip.setTaskName(taskName);
+                                       unzip.setDest(destDir);
+                                       unzip.setSrc(new File(paths[i]));
+                                       unzip.addPatternset(patternSet);
+                                       unzip.execute();
+                               }
+                       }
+               }
+               if ((null != sourceRootCopyFilter) && (null != sourceRoots)) {
+                       String[] paths = sourceRoots.list();
+                       if (!LangUtil.isEmpty(paths)) {
+                               Copy copy = new Copy();
+                               copy.setProject(project);
+                               copy.setTodir(destDir);
+                               for (int i = 0; i < paths.length; i++) {
+                                       FileSet fileSet = new FileSet();
+                                       fileSet.setDir(new File(paths[i]));
+                                       fileSet.setIncludes("**/*");
+                                       fileSet.setExcludes(sourceRootCopyFilter);
+                                       copy.addFileset(fileSet);
+                               }
+                               copy.execute();
+                       }
+               }
+               if ((null != inpathDirCopyFilter) && (null != inpath)) {
+                       String[] paths = inpath.list();
+                       if (!LangUtil.isEmpty(paths)) {
+                               Copy copy = new Copy();
+                               copy.setProject(project);
+                               copy.setTodir(destDir);
+                               boolean gotDir = false;
+                               for (int i = 0; i < paths.length; i++) {
+                                       File inpathDir = new File(paths[i]);
+                                       if (inpathDir.isDirectory() && inpathDir.canRead()) {
+                                               if (!gotDir) {
+                                                       gotDir = true;
+                                               }
+                                               FileSet fileSet = new FileSet();
+                                               fileSet.setDir(inpathDir);
+                                               fileSet.setIncludes("**/*");
+                                               fileSet.setExcludes(inpathDirCopyFilter);
+                                               copy.addFileset(fileSet);
+                                       }
+                               }
+                               if (gotDir) {
+                                       copy.execute();
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Complete the output jar by copying resources from the source root directories if the filter is specified. and non-.class
+        * files from the input jars if enabled.
+        */
+       private void completeOutjar() {
+               if (((null == tmpOutjar) || !tmpOutjar.canRead())
+                               || (!copyInjars && (null == sourceRootCopyFilter) && (null == inpathDirCopyFilter))) {
+                       return;
+               }
+               Zip zip = new Zip();
+               Project project = getProject();
+               zip.setProject(project);
+               zip.setTaskName(getTaskName() + " - zip");
+               zip.setDestFile(outjar);
+               ZipFileSet zipfileset = new ZipFileSet();
+               zipfileset.setProject(project);
+               zipfileset.setSrc(tmpOutjar);
+               zipfileset.setIncludes("**/*.class");
+               zip.addZipfileset(zipfileset);
+               if (copyInjars) {
+                       String[] paths = injars.list();
+                       if (!LangUtil.isEmpty(paths)) {
+                               for (int i = 0; i < paths.length; i++) {
+                                       File jarFile = new File(paths[i]);
+                                       zipfileset = new ZipFileSet();
+                                       zipfileset.setProject(project);
+                                       zipfileset.setSrc(jarFile);
+                                       zipfileset.setIncludes("**/*");
+                                       zipfileset.setExcludes("**/*.class");
+                                       zip.addZipfileset(zipfileset);
+                               }
+                       }
+               }
+               if ((null != sourceRootCopyFilter) && (null != sourceRoots)) {
+                       String[] paths = sourceRoots.list();
+                       if (!LangUtil.isEmpty(paths)) {
+                               for (int i = 0; i < paths.length; i++) {
+                                       File srcRoot = new File(paths[i]);
+                                       FileSet fileset = new FileSet();
+                                       fileset.setProject(project);
+                                       fileset.setDir(srcRoot);
+                                       fileset.setIncludes("**/*");
+                                       fileset.setExcludes(sourceRootCopyFilter);
+                                       zip.addFileset(fileset);
+                               }
+                       }
+               }
+               if ((null != inpathDirCopyFilter) && (null != inpath)) {
+                       String[] paths = inpath.list();
+                       if (!LangUtil.isEmpty(paths)) {
+                               for (int i = 0; i < paths.length; i++) {
+                                       File inpathDir = new File(paths[i]);
+                                       if (inpathDir.isDirectory() && inpathDir.canRead()) {
+                                               FileSet fileset = new FileSet();
+                                               fileset.setProject(project);
+                                               fileset.setDir(inpathDir);
+                                               fileset.setIncludes("**/*");
+                                               fileset.setExcludes(inpathDirCopyFilter);
+                                               zip.addFileset(fileset);
+                                       }
+                               }
+                       }
+               }
+               zip.execute();
+       }
+
+       // -------------------------- compiler adapter interface extras
+
+       /**
+        * Add specified source files.
+        */
+       void addFiles(File[] paths) {
+               for (int i = 0; i < paths.length; i++) {
+                       addFile(paths[i]);
+               }
+       }
+
+       /**
+        * Add specified source file.
+        */
+       void addFile(File path) {
+               if (null != path) {
+                       adapterFiles.add(path);
+               }
+       }
+
+       /**
+        * Read arguments in as if from a command line, mainly to support compiler adapter compilerarg subelement.
+        * 
+        * @param args the String[] of arguments to read
+        */
+       public void readArguments(String[] args) { // XXX slow, stupid, unmaintainable
+               if ((null == args) || (0 == args.length)) {
+                       return;
+               }
+               /** String[] wrapper with increment, error reporting */
+               class Args {
+                       final String[] args;
+                       int index = 0;
+
+                       Args(String[] args) {
+                               this.args = args; // not null or empty
+                       }
+
+                       boolean hasNext() {
+                               return index < args.length;
+                       }
+
+                       String next() {
+                               String err = null;
+                               if (!hasNext()) {
+                                       err = "need arg for flag " + args[args.length - 1];
+                               } else {
+                                       String s = args[index++];
+                                       if (null == s) {
+                                               err = "null value";
+                                       } else {
+                                               s = s.trim();
+                                               if (0 == s.trim().length()) {
+                                                       err = "no value";
+                                               } else {
+                                                       return s;
+                                               }
+                                       }
+                               }
+                               err += " at [" + index + "] of " + Arrays.asList(args);
+                               throw new BuildException(err);
+                       }
+               } // class Args
+
+               Args in = new Args(args);
+               String flag;
+               while (in.hasNext()) {
+                       flag = in.next();
+                       if ("-1.3".equals(flag)) {
+                               setCompliance(flag);
+                       } else if ("-1.4".equals(flag)) {
+                               setCompliance(flag);
+                       } else if ("-1.5".equals(flag)) {
+                               setCompliance("1.5");
+                       } else if ("-argfile".equals(flag)) {
+                               setArgfiles(new Path(project, in.next()));
+                       } else if ("-aspectpath".equals(flag)) {
+                               setAspectpath(new Path(project, in.next()));
+                       } else if ("-classpath".equals(flag)) {
+                               setClasspath(new Path(project, in.next()));
+                       } else if ("-extdirs".equals(flag)) {
+                               setExtdirs(new Path(project, in.next()));
+                       } else if ("-Xcopyinjars".equals(flag)) {
+                               setCopyInjars(true); // ignored - will be flagged by setter
+                       } else if ("-g".equals(flag)) {
+                               setDebug(true);
+                       } else if (flag.startsWith("-g:")) {
+                               setDebugLevel(flag.substring(2));
+                       } else if ("-deprecation".equals(flag)) {
+                               setDeprecation(true);
+                       } else if ("-d".equals(flag)) {
+                               setDestdir(new File(in.next()));
+                       } else if ("-crossrefs".equals(flag)) {
+                               setCrossrefs(true);
+                       } else if ("-emacssym".equals(flag)) {
+                               setEmacssym(true);
+                       } else if ("-encoding".equals(flag)) {
+                               setEncoding(in.next());
+                       } else if ("-Xfailonerror".equals(flag)) {
+                               setFailonerror(true);
+                       } else if ("-fork".equals(flag)) {
+                               setFork(true);
+                       } else if ("-forkclasspath".equals(flag)) {
+                               setForkclasspath(new Path(project, in.next()));
+                       } else if ("-help".equals(flag)) {
+                               setHelp(true);
+                       } else if ("-incremental".equals(flag)) {
+                               setIncremental(true);
+                       } else if ("-injars".equals(flag)) {
+                               setInjars(new Path(project, in.next()));
+                       } else if ("-inpath".equals(flag)) {
+                               setInpath(new Path(project, in.next()));
+                       } else if ("-Xlistfileargs".equals(flag)) {
+                               setListFileArgs(true);
+                       } else if ("-Xmaxmem".equals(flag)) {
+                               setMaxmem(in.next());
+                       } else if ("-Xmessageholderclass".equals(flag)) {
+                               setMessageHolderClass(in.next());
+                       } else if ("-noexit".equals(flag)) {
+                               setNoExit(true);
+                       } else if ("-noimport".equals(flag)) {
+                               setNoExit(true);
+                       } else if ("-noExit".equals(flag)) {
+                               setNoExit(true);
+                       } else if ("-noImportError".equals(flag)) {
+                               setNoImportError(true);
+                       } else if ("-noWarn".equals(flag)) {
+                               setNowarn(true);
+                       } else if ("-noexit".equals(flag)) {
+                               setNoExit(true);
+                       } else if ("-outjar".equals(flag)) {
+                               setOutjar(new File(in.next()));
+                       } else if ("-outxml".equals(flag)) {
+                               setOutxml(true);
+                       } else if ("-outxmlfile".equals(flag)) {
+                               setOutxmlfile(in.next());
+                       } else if ("-preserveAllLocals".equals(flag)) {
+                               setPreserveAllLocals(true);
+                       } else if ("-proceedOnError".equals(flag)) {
+                               setProceedOnError(true);
+                       } else if ("-referenceInfo".equals(flag)) {
+                               setReferenceInfo(true);
+                       } else if ("-source".equals(flag)) {
+                               setSource(in.next());
+                       } else if ("-Xsourcerootcopyfilter".equals(flag)) {
+                               setSourceRootCopyFilter(in.next());
+                       } else if ("-sourceroots".equals(flag)) {
+                               setSourceRoots(new Path(project, in.next()));
+                       } else if ("-Xsrcdir".equals(flag)) {
+                               setSrcDir(new Path(project, in.next()));
+                       } else if ("-Xtagfile".equals(flag)) {
+                               setTagFile(new File(in.next()));
+                       } else if ("-target".equals(flag)) {
+                               setTarget(in.next());
+                       } else if ("-time".equals(flag)) {
+                               setTime(true);
+                       } else if ("-time".equals(flag)) {
+                               setTime(true);
+                       } else if ("-verbose".equals(flag)) {
+                               setVerbose(true);
+                       } else if ("-showWeaveInfo".equals(flag)) {
+                               setShowWeaveInfo(true);
+                       } else if ("-version".equals(flag)) {
+                               setVersion(true);
+                       } else if ("-warn".equals(flag)) {
+                               setWarn(in.next());
+                       } else if (flag.startsWith("-warn:")) {
+                               setWarn(flag.substring(6));
+                       } else if ("-Xlint".equals(flag)) {
+                               setXlintwarnings(true);
+                       } else if (flag.startsWith("-Xlint:")) {
+                               setXlint(flag.substring(7));
+                       } else if ("-Xlintfile".equals(flag)) {
+                               setXlintfile(new File(in.next()));
+                       } else if ("-XterminateAfterCompilation".equals(flag)) {
+                               setXTerminateAfterCompilation(true);
+                       } else if ("-Xreweavable".equals(flag)) {
+                               setXReweavable(true);
+                       } else if ("-XnotReweavable".equals(flag)) {
+                               setXNotReweavable(true);
+                       } else if (flag.startsWith("@")) {
+                               File file = new File(flag.substring(1));
+                               if (file.canRead()) {
+                                       setArgfiles(new Path(project, file.getPath()));
+                               } else {
+                                       ignore(flag);
+                               }
+                       } else {
+                               File file = new File(flag);
+                               if (file.isFile() && file.canRead() && FileUtil.hasSourceSuffix(file)) {
+                                       addFile(file);
+                               } else {
+                                       ignore(flag);
+                               }
+                       }
+               }
+
+       }
+
+       protected void logVerbose(String text) {
+               if (this.verbose) {
+                       this.logger.info(text);
+               } else {
+                       this.logger.verbose(text);
+               }
+       }
+
+       /**
+        * Commandline wrapper that only permits addition of non-empty values and converts to argfile form if necessary.
+        */
+       public static class GuardedCommand {
+               Commandline command;
+
+               // int size;
+
+               static boolean isEmpty(String s) {
+                       return ((null == s) || (0 == s.trim().length()));
+               }
+
+               GuardedCommand() {
+                       command = new Commandline();
+               }
+
+               void addFlag(String flag, boolean doAdd) {
+                       if (doAdd && !isEmpty(flag)) {
+                               command.createArgument().setValue(flag);
+                               // size += 1 + flag.length();
+                       }
+               }
+
+               /** @return null if added or ignoreString otherwise */
+               String addOption(String prefix, String[] validOptions, String input) {
+                       if (isEmpty(input)) {
+                               return null;
+                       }
+                       for (int i = 0; i < validOptions.length; i++) {
+                               if (input.equals(validOptions[i])) {
+                                       if (isEmpty(prefix)) {
+                                               addFlag(input, true);
+                                       } else {
+                                               addFlagged(prefix, input);
+                                       }
+                                       return null;
+                               }
+                       }
+                       return (null == prefix ? input : prefix + " " + input);
+               }
+
+               void addFlagged(String flag, String argument) {
+                       if (!isEmpty(flag) && !isEmpty(argument)) {
+                               command.addArguments(new String[] { flag, argument });
+                               // size += 1 + flag.length() + argument.length();
+                       }
+               }
+
+               // private void addFile(File file) {
+               // if (null != file) {
+               // String path = file.getAbsolutePath();
+               // addFlag(path, true);
+               // }
+               // }
+
+               List extractArguments() {
+                       ArrayList result = new ArrayList();
+                       String[] cmds = command.getArguments();
+                       if (!LangUtil.isEmpty(cmds)) {
+                               result.addAll(Arrays.asList(cmds));
+                       }
+                       return result;
+               }
+
+               /**
+                * Adjust args for size if necessary by creating an argument file, which should be deleted by the client after the compiler
+                * run has completed.
+                * 
+                * @param max the int maximum length of the command line (in char)
+                * @return the temp File for the arguments (if generated), for deletion when done.
+                * @throws IllegalArgumentException if max is negative
+                */
+               static String[] limitTo(String[] args, int max, Location location) {
+                       if (max < 0) {
+                               throw new IllegalArgumentException("negative max: " + max);
+                       }
+                       // sigh - have to count anyway for now
+                       int size = 0;
+                       for (int i = 0; (i < args.length) && (size < max); i++) {
+                               size += 1 + (null == args[i] ? 0 : args[i].length());
+                       }
+                       if (size <= max) {
+                               return args;
+                       }
+                       File tmpFile = null;
+                       PrintWriter out = null;
+                       // adapted from DefaultCompilerAdapter.executeExternalCompile
+                       try {
+                               String userDirName = System.getProperty("user.dir");
+                               File userDir = new File(userDirName);
+                               tmpFile = File.createTempFile("argfile", "", userDir);
+                               out = new PrintWriter(new FileWriter(tmpFile));
+                               for (int i = 0; i < args.length; i++) {
+                                       out.println(args[i]);
+                               }
+                               out.flush();
+                               return new String[] { "-argfile", tmpFile.getAbsolutePath() };
+                       } catch (IOException e) {
+                               throw new BuildException("Error creating temporary file", e, location);
+                       } finally {
+                               if (out != null) {
+                                       try {
+                                               out.close();
+                                       } catch (Throwable t) {
+                                       }
+                               }
+                       }
+               }
+       }
+
+       private static class AntMessageHandler implements IMessageHandler {
+
+               private TaskLogger logger;
+               private final boolean taskLevelVerbose;
+               private final boolean handledMessage;
+
+               public AntMessageHandler(TaskLogger logger, boolean taskVerbose, boolean handledMessage) {
+                       this.logger = logger;
+                       this.taskLevelVerbose = taskVerbose;
+                       this.handledMessage = handledMessage;
+               }
+
+               /*
+                * (non-Javadoc)
+                * 
+                * @see org.aspectj.bridge.IMessageHandler#handleMessage(org.aspectj.bridge.IMessage)
+                */
+               @Override
+               public boolean handleMessage(IMessage message) throws AbortException {
+                       Kind messageKind = message.getKind();
+                       String messageText = message.toString();
+                       if (messageKind == IMessage.ABORT) {
+                               this.logger.error(messageText);
+                       } else if (messageKind == IMessage.DEBUG) {
+                               this.logger.debug(messageText);
+                       } else if (messageKind == IMessage.ERROR) {
+                               this.logger.error(messageText);
+                       } else if (messageKind == IMessage.FAIL) {
+                               this.logger.error(messageText);
+                       } else if (messageKind == IMessage.INFO) {
+                               if (this.taskLevelVerbose) {
+                                       this.logger.info(messageText);
+                               } else {
+                                       this.logger.verbose(messageText);
+                               }
+                       } else if (messageKind == IMessage.WARNING) {
+                               this.logger.warning(messageText);
+                       } else if (messageKind == IMessage.WEAVEINFO) {
+                               this.logger.info(messageText);
+                       } else if (messageKind == IMessage.TASKTAG) {
+                               // ignore
+                       } else {
+                               throw new BuildException("Unknown message kind from AspectJ compiler: " + messageKind.toString());
+                       }
+                       return handledMessage;
+               }
+
+               /*
+                * (non-Javadoc)
+                * 
+                * @see org.aspectj.bridge.IMessageHandler#isIgnoring(org.aspectj.bridge.IMessage.Kind)
+                */
+               @Override
+               public boolean isIgnoring(Kind kind) {
+                       return false;
+               }
+
+               /*
+                * (non-Javadoc)
+                * 
+                * @see org.aspectj.bridge.IMessageHandler#dontIgnore(org.aspectj.bridge.IMessage.Kind)
+                */
+               @Override
+               public void dontIgnore(Kind kind) {
+               }
+
+               /*
+                * (non-Javadoc)
+                * 
+                * @see org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind)
+                */
+               @Override
+               public void ignore(Kind kind) {
+               }
+
+       }
+}
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java
new file mode 100644 (file)
index 0000000..b787a2f
--- /dev/null
@@ -0,0 +1,775 @@
+/* *******************************************************************
+ * Copyright (c) 2000-2001 Xerox Corporation. 
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation 
+ *     2006, Arno Schmidmeier, (reactivated the source and removed deprecated calls)
+ * ******************************************************************/
+
+
+package org.aspectj.tools.ant.taskdefs;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Location;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.taskdefs.Javadoc.AccessType;
+import org.apache.tools.ant.taskdefs.Javadoc.Html;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+import org.aspectj.tools.ajdoc.Main;
+
+/**
+ * A task to run the ajdoc tool.
+ *
+ * @author Jeff Palm
+ */
+public class Ajdoc extends MatchingTask {
+    /** The name of ajdoc class we're using. */
+    public final static String AJDOC_CLASSNAME = "org.aspectj.tools.ajdoc.Main";
+
+    /** If true, ignore fork param and use FORCE_FORK_VALUE  */
+    public final static boolean FORCE_FORK = false;
+
+    /** value used as fork when FORCE_FORK is true  */
+    public final static boolean FORCE_FORK_VALUE = true;
+
+    protected Commandline cmd;
+    protected Commandline vmcmd;
+    private Path sourcepath;
+    private File destdir;
+    private Collection<String> sourcefiles;
+    private Collection<String> packagenames;
+    private File packageList;
+    private Path bootclasspath;
+    private Path extdirs;
+    private Path classpath;
+    private Path internalclasspath;
+    private List<File> argfiles;
+    private Path docletpath;
+    private Collection<Link> links;
+    private Collection<Group> groups;
+    private Doclet doclet;
+    private boolean failonerror;
+    private boolean fork;
+       private String source;
+       private Html bottom;
+    private Vector<FileSet> fileSets = new Vector<FileSet>();
+    /** reset all to initial values - permit gc if Ajdoc is held */
+    public Ajdoc() {
+        reset();
+    }
+
+    protected void reset() {
+        cmd = new Commandline();
+        vmcmd = new Commandline();
+        sourcepath  = null;
+        destdir  = null ;
+        sourcefiles  = null;
+        packagenames  = null;
+        packageList  = null;
+        bootclasspath  = null;
+        extdirs  = null;
+        classpath  = null;
+        internalclasspath  = null;
+        argfiles  = null;
+        docletpath  = null;
+        links = new ArrayList<Link>();
+        groups = new ArrayList<Group>();
+        doclet  = null;
+        failonerror  = false;
+        fork = false;
+        source = null;
+        bottom = null;
+    }
+
+    protected final boolean setif(boolean b, String flag) {
+        if (b) cmd.createArgument().setValue(flag);
+        return b;
+    }
+
+    protected final void setfile(String flag, String file) {
+        set(flag, getProject().resolveFile(file).getAbsolutePath());
+    }
+
+    protected final void set(String flag, String val) {
+        setif(true, flag, val);
+    }
+
+    protected final boolean setif(boolean b, String flag, String val) {
+        if (setif(b, flag)) cmd.createArgument().setValue(val);
+        return b;
+    }
+    
+    public void setSource(String input) {
+        source = input;
+    }
+
+    public void setSourcepath(Path path) {
+        if (sourcepath == null) {
+            sourcepath = path;
+        } else {
+            sourcepath.append(path);
+        }
+    }
+
+    public Path createSourcepath() {
+        return sourcepath == null ?
+            (sourcepath = new Path(getProject())) :
+            sourcepath.createPath();
+    }
+
+    public void setSourcepathRef(Reference id) {
+        createSourcepath().setRefid(id);
+    }
+
+    public void setSrcdir(Path path) { setSourcepath(path); }
+
+    public Path createSrcdir() { return createSourcepath(); }
+
+    public void setSrcdirRef(Reference id) { setSourcepathRef(id); }
+
+    public void setDestdir(String destdir) {
+        this.destdir = getProject().resolveFile(destdir);
+    }
+
+    public void setSourcefiles(String list) {
+        (sourcefiles == null ?
+         sourcefiles = new ArrayList() :
+         sourcefiles).addAll(strings(list));
+    }
+
+    public void addFileset(FileSet fs) {
+        fileSets.addElement(fs);
+    }
+    
+    private void addFileSets() {
+       if(sourcefiles == null)
+               sourcefiles = new ArrayList<String>();
+       
+        Enumeration<FileSet> e = fileSets.elements();
+        while (e.hasMoreElements()) {
+            FileSet fs = (FileSet) e.nextElement();
+            if (!fs.hasPatterns() && !fs.hasSelectors()) {
+                fs = (FileSet) fs.clone();
+                fs.createInclude().setName("**/*.java");
+                fs.createInclude().setName("**/*.aj");
+            }
+            File baseDir = fs.getDir(getProject());
+            DirectoryScanner ds = fs.getDirectoryScanner(getProject());
+            String[] files = ds.getIncludedFiles();
+            for (int i = 0; i < files.length; i++) {
+               sourcefiles.add((new File(baseDir, files[i])).getAbsolutePath());
+            }
+        }
+    }
+    
+    public void setPackagenames(String list) {
+        (packagenames == null ?
+         packagenames = new ArrayList<String>() :
+         packagenames).addAll(strings(list, true));
+    }
+    
+    public void setAccess(AccessType at) {
+        cmd.createArgument().setValue("-" + at.getValue());
+    }
+    
+    public void setPackageList(String packageList) {
+        this.packageList = getProject().resolveFile(packageList);
+    }
+
+    public void setClasspath(Path path) {
+        if (classpath == null) {
+            classpath = path;
+        } else {
+            classpath.append(path);
+        }
+    }
+
+    public Path createClasspath() {
+        return (classpath == null ?
+                classpath = new Path(getProject()) :
+                classpath).createPath();
+    }
+    
+    public void setClasspathref(Reference id) {
+        createClasspath().setRefid(id);
+    }
+    
+    public void setBootclasspath(Path path) { // todo: unsupported
+        if (bootclasspath == null) {
+            bootclasspath = path;
+        } else {
+         bootclasspath.append(path);
+        }
+    }
+
+    public Path createBootclasspath() { // todo: unsupported
+        return (bootclasspath == null ?
+                bootclasspath = new Path(getProject()) :
+                bootclasspath).createPath();
+    }
+    
+    public void setBootclasspathref(Reference bootclasspathref) { // todo: unsupported
+        createBootclasspath().setRefid(bootclasspathref);
+    }
+
+    public void setInternalclasspath(Path internalclasspath) { 
+        if (this.internalclasspath == null) {
+            this.internalclasspath = internalclasspath;
+        } else {
+            this.internalclasspath.append(internalclasspath);
+        }
+    }
+
+    public Path createInternalclasspath() {
+        if (internalclasspath == null) {
+            internalclasspath = new Path(getProject());
+        }
+        return internalclasspath.createPath();
+    }
+        
+    
+    public void setInternalclasspathref(Reference internalclasspathref) {
+        createInternalclasspath().setRefid(internalclasspathref);
+    }
+    
+    public void setExtdirs(Path path) {
+        if (extdirs == null) {
+            extdirs = path;
+        } else {
+            extdirs.append(path);
+        }
+    }
+
+    public List<File> createArgfiles() {
+        return (argfiles == null ?
+                argfiles = new ArrayList<File>() :
+                argfiles);
+    }
+
+    public void setArgfile(String argfile) {
+        createArgfiles().add(getProject().resolveFile(argfile));
+    }
+
+    public void setArgfiles(String argfiles) {
+        createArgfiles().addAll(files(argfiles));
+    }
+
+    public void setOverview(String overview) {
+        setfile("-overview", overview);
+    }
+
+    public void setPublic(boolean b) {
+        setif(b, "-public");
+    }
+
+    public void setPackage(boolean b) {
+        setif(b, "-package");
+    }
+
+    public void setProtected(boolean b) {
+        setif(b, "-protected");
+    }
+
+    public void setPrivate(boolean b) {
+        setif(b, "-private");
+    }
+
+    public void setOld(boolean old) {
+        setif(old, "-old");
+    }
+
+    public void setAuthor(boolean author) {
+        setif(author, "-author");
+    }
+
+    public void setSplitindex(boolean splitindex) {
+        setif(splitindex, "-splitindex");
+    }
+
+    public void setWindowtitle(String windowtitle) {
+        set("-windowtitle", windowtitle);
+    }
+
+    public void setDoctitle(String doctitle) {
+        set("-doctitle", doctitle);
+    }
+
+    public void setHeader(String header) {
+        set("-header", header);
+    }
+
+    public void setFooter(String footer) {
+        set("-footer", footer);
+    }
+
+    public void setBottom(String bottom) {
+        Html html = new Html();
+        html.addText(bottom);
+        addBottom(html);
+    }
+
+    public void addBottom(Html text) {
+        bottom = text;
+    }
+    
+    public void setVerbose(boolean b) {
+        setif(b, "-verbose");
+    }
+
+    public void setVersion(boolean b) {
+        setif(b, "-version");
+    }
+
+    public void setUse(boolean b) {
+        setif(b, "-use");
+    }
+
+    public void setStandard(boolean b) {
+        setif(b, "-standard");
+    }
+
+    public class Link {
+        protected String href;
+        protected boolean offline;
+        protected String packagelistLoc;
+        public Link() {}
+        public void setHref(String href) {
+            this.href = href;
+        }
+        public void setOffline(boolean offline) {
+            this.offline = offline;
+        }
+        public void setPackagelistLoc(String packagelistLoc) {
+            this.packagelistLoc = packagelistLoc;
+        }
+    }
+
+    public void setLink(String href) {
+        createLink().setHref(href);
+    }
+
+    public Link createLink() {
+        Link link = new Link();
+        links.add(link);
+        return link;
+    }
+
+    public void setLinkoffline(String linkoffline) {
+        Link link = createLink();
+        int ispace = linkoffline.indexOf(" ");
+        if (ispace == -1) {
+            throw new BuildException("linkoffline usage: <url> <url2>!", getLocation());
+        }
+        link.setHref(linkoffline.substring(0, ispace).trim());
+        link.setPackagelistLoc(linkoffline.substring(ispace+1).trim());
+    }
+
+    public class Group {
+        private String title;
+        private List<String> packages;
+        public Group() {}
+        public void setTitle(String title) {
+            this.title = title;
+        }
+        public final void setPackages(String packages) {
+            setPackagenames(packages);
+        }
+        public void setPackagenames(String packages) {
+            this.packages = strings(packages);
+        }
+    }
+
+    public void setGroup(String str) {
+        for (StringTokenizer t = new StringTokenizer(str, ",", false);
+             t.hasMoreTokens();) {
+            String s = t.nextToken().trim();
+            int ispace = s.indexOf(' ');
+            if (ispace != -1) {
+                Group group = createGroup();
+                group.setTitle(s.substring(0, ispace));
+                group.setPackagenames(s.substring(ispace+1));
+            } else {
+                throw new BuildException
+                    ("group usage: group=[<title> <pkglist>]*", getLocation());
+            }
+        }
+    }
+    
+    public Group createGroup() {
+        Group group = new Group();
+        groups.add(group);
+        return group;
+    }
+
+    public void setNodeprecated(boolean nodeprecated) {
+        setif(nodeprecated, "-nodeprecated");
+    }
+
+    public void setNodeprecatedlist(boolean nodeprecatedlist) {
+        setif(nodeprecatedlist, "-nodeprecatedlist");
+    }
+
+    public void setNotree(boolean notree) {
+        setif(notree, "-notree");
+    }
+
+    public void setNoindex(boolean noindex) {
+        setif(noindex, "-noindex");
+    }
+
+    public void setNohelp(boolean nohelp) {
+        setif(nohelp, "-nohelp");
+    }
+
+    public void setNonavbar(boolean nonavbar) {
+        setif(nonavbar, "-nonavbar");
+    }
+
+    public void setSerialwarn(boolean serialwarn) {
+        setif(serialwarn, "-serialwarn"); 
+    }
+
+    public void setHelpfile(String helpfile) {
+        setfile("-helpfile", helpfile);
+    }
+
+    public void setStylesheetfile(String stylesheetfile) {
+        setfile("-stylesheetfile", stylesheetfile);
+    }
+
+    public void setCharset(String charset) { set("-charset", charset); }
+
+    public void setDocencoding(String docencoding) {
+        set("-docencoding", docencoding);
+    }
+
+    public void setDoclet(String doclet) {
+        createDoclet().setName(doclet);
+    }
+
+    public static class Param {
+        protected String name;
+        protected String value;
+        public Param() {}
+        public void setName(String name) { this.name  = name; }
+        public void setValue(String value) { this.value = value; }
+    }
+
+    public class Doclet {
+        protected String name;
+        protected Path path;
+        protected List<Param> params = new ArrayList<Param>();
+        public Doclet() {}
+        public void setName(String name) {
+            this.name = name;
+        }
+        public void setPath(Path path) {
+            if (this.path == null) {
+                this.path = path;
+            } else {
+                this.path.append(path);
+            }
+        }
+        public Path createPath() {
+            return (path == null ?
+                    path = new Path(getProject()) :
+                    path).createPath();
+        }
+        public Param createParam() {
+            Param param = new Param();
+            params.add(param);
+            return param;
+        }
+    }
+
+    public Doclet createDoclet() {
+        if (doclet != null) {
+            throw new BuildException("Only one doclet is allowed!");
+        }
+        return doclet = new Doclet();
+    }
+
+    public void setDocletpath(Path path) {
+        (docletpath == null ?
+         docletpath = path :
+         docletpath).append(path);
+    }
+
+    public Path createDocletpath() {
+        return docletpath == null ?
+            (docletpath = new Path(getProject())) :
+            docletpath.createPath();
+    }
+
+    public void setDocletpathRef(Reference id) {
+        createDocletpath().setRefid(id);
+    }
+
+    public void setAdditionalparam(String additionalparam) {
+        cmd.createArgument().setLine(additionalparam);
+    }
+
+    public void setFailonerror(boolean failonerror) {
+        this.failonerror = failonerror;
+    }
+
+    public void setFork(boolean fork) {
+        this.fork = fork;
+    }
+
+    public Commandline.Argument createJvmarg() {
+        return vmcmd.createArgument();
+    }
+
+    public void setMaxmemory(String max) {
+        createJvmarg().setValue((Project.getJavaVersion().
+                                 startsWith("1.1") ?
+                                 "-mx" : "-Xmx") +max);
+    }
+
+    public void execute() throws BuildException {
+        if (sourcepath == null && argfiles == null && fileSets.size() == 0) {
+            throw new BuildException("one of sourcepath or argfiles must be set!",
+                       getLocation());
+        }
+        if (sourcepath != null) {
+            cmd.createArgument().setValue("-sourcepath");
+            cmd.createArgument().setPath(sourcepath);
+        }
+        if (destdir != null) {
+            cmd.createArgument().setValue("-d");
+            cmd.createArgument().setFile(destdir);
+        }
+        if (classpath != null) {
+            cmd.createArgument().setValue("-classpath");
+            cmd.createArgument().setPath(classpath);
+        }
+        if (bootclasspath != null) {
+            cmd.createArgument().setValue("-bootclasspath");
+            cmd.createArgument().setPath(bootclasspath);
+        }
+        if (extdirs != null) {
+            cmd.createArgument().setValue("-extdirs");
+            cmd.createArgument().setPath(extdirs);
+        }
+        if (source != null) {
+            cmd.createArgument().setValue("-source");
+            cmd.createArgument().setValue(source);
+        }
+        if (bottom != null) {
+               cmd.createArgument().setValue("-bottom");
+               cmd.createArgument().setValue(getProject().replaceProperties(bottom.getText()));
+        }
+        
+        for (Link link: links) {
+            if (link.href == null) {
+                throw new BuildException("Link href cannot be null!", getLocation());
+            }
+            if (link.packagelistLoc != null) {
+                cmd.createArgument().setValue("-linkoffline");
+                cmd.createArgument().setValue(link.href);
+                cmd.createArgument().setValue(link.packagelistLoc);
+            } else {
+                cmd.createArgument().setValue("-link");
+                cmd.createArgument().setValue(link.href);
+            }
+        }
+        if (doclet != null) {
+            if (doclet.name == null) {
+                throw new BuildException("Doclet name cannot be null!", getLocation());
+            }
+            cmd.createArgument().setValue("-doclet");
+            cmd.createArgument().setValue(doclet.name);
+            if (doclet.path != null) {
+                cmd.createArgument().setValue("-docletpath");
+                cmd.createArgument().setPath(doclet.path);
+            }
+            for (Iterator i = doclet.params.iterator(); i.hasNext();) {
+                Param param = (Param)i.next();
+                if (param.name == null) {
+                    throw new BuildException("Doclet params cannot be null!",
+                                             getLocation());
+                }
+                cmd.createArgument().setValue(param.name);
+                if (param.value == null) {
+                    cmd.createArgument().setValue(param.value);
+                }
+            }
+        }
+        Map<String,List<String>> groupMap = new HashMap<String,List<String>>();
+        for (Group group: groups) {
+            if (group.title == null) {
+                throw new BuildException("Group names cannot be null!",
+                                         getLocation());
+            }
+            if (group.packages == null) {
+                throw new BuildException("Group packages cannot be null!",
+                                         getLocation());
+            }
+            List<String> packages = groupMap.get(group.title);
+            if (packages == null) {
+                packages = new ArrayList<String>();
+            }
+            packages.addAll(group.packages);
+            groupMap.put(group.title, packages);
+        }
+        for (String title: groupMap.keySet()) {
+            List<String> packages = groupMap.get(title);
+            String pkgstr = "";
+            for (Iterator<String> j = packages.iterator(); j.hasNext();) {
+                pkgstr += j.next();
+                if (j.hasNext()) pkgstr += ",";
+            }
+            cmd.createArgument().setValue("-group");
+            cmd.createArgument().setValue(title);
+            cmd.createArgument().setValue(pkgstr);
+        }
+        if (argfiles != null) {
+            for (Iterator i = argfiles.iterator(); i.hasNext();) {
+                String name = i.next()+"";
+                File argfile = getProject().resolveFile(name);
+                if (check(argfile, name, false, getLocation())) {
+                    cmd.createArgument().setValue("-argfile");
+                    cmd.createArgument().setFile(argfile);
+                }
+            }
+        }
+        if (packageList != null) {
+            cmd.createArgument().setValue("@" + packageList);
+        }
+        if (null != packagenames) {
+            for (Iterator<String> i = packagenames.iterator(); i.hasNext();) {
+                cmd.createArgument().setValue((String)i.next());
+            }
+        }
+        // support for include parameter as a MatchingTask
+        int numfiles = 0;
+        if (sourcepath != null) {
+            String[] dirs = sourcepath.list();
+            for (int i = 0; i < dirs.length; i++) {
+                File dir = getProject().resolveFile(dirs[i]);
+                check(dir, dirs[i], true, getLocation());
+                String[] files = getDirectoryScanner(dir).getIncludedFiles();
+                for (int j = 0; j < files.length; j++) {
+                    File file = new File(dir, files[j]);
+                    if (file.getName().endsWith(".java")
+                        || file.getName().endsWith(".aj")) {
+                        cmd.createArgument().setFile(file);
+                        numfiles++;
+                    }
+                }
+            }
+        }
+
+       addFileSets();
+        if (sourcefiles != null) {
+            for (Iterator<String> i = sourcefiles.iterator(); i.hasNext();) {
+                // let ajdoc resolve sourcefiles relative to sourcepath,
+                cmd.createArgument().setValue(i.next());
+            }
+        }
+        // XXX PR682 weak way to report errors - need to refactor
+        int result = compile();
+        if (failonerror && (0 != result)) {
+            throw new BuildException("Ajdoc failed with code " + result);
+        }
+        reset();
+    }
+
+    protected int compile() throws BuildException { // todo: doc that fork is ignored
+        try {
+            String[] args = cmd.getArguments(); 
+            if (fork) {
+                log("Warning: fork is ignored ", Project.MSG_WARN);
+            }
+            Main.main(args); 
+            if (Main.hasAborted())
+               return 1;
+            else 
+               return 0;
+        } catch (Throwable t) {
+            throw new BuildException(t);
+        }
+    }
+
+    protected interface Mapper<T> {
+        public T map(String str);
+    }
+
+    protected final <T> List<T> list(String str, Mapper<T> mapper) {
+        if (str == null) return Collections.emptyList();
+        List<T> list = new ArrayList<T>();
+        for (StringTokenizer t = new StringTokenizer(str, ",", false);
+             t.hasMoreTokens();) {
+            list.add(mapper.map(t.nextToken().trim()));
+        }
+        return list;
+    }
+
+    protected final List<File> files(String str) {
+        return list(str, new Mapper<File>() {
+                public File map(String s) {
+                    return getProject().resolveFile(s);
+                }
+            });
+    }
+
+    protected final List<String> strings(String str) {
+        return strings(str, false);
+    }
+
+    protected final List<String> strings(String str, final boolean filterSlashes) {
+        return list(str, new Mapper<String>() {
+                public String map(String s) {
+                    return filterSlashes ? filterSlashes(s) : s;
+                }
+            });
+    }
+
+    protected final String filterSlashes(String str) {
+        if (str == null) return null;
+        return str.
+            replace('/', '.').
+            replace('\\', '.').
+            replace(File.separatorChar, '.');
+    }
+
+    protected final boolean check(File file, String name,
+                                  boolean isDir, Location loc) {
+        loc = loc != null ? loc : getLocation();
+        if (file == null) {
+            throw new BuildException(name + " is null!", loc);
+        }
+        if (!file.exists()) {
+            throw new BuildException(file + "doesn't exist!", loc);
+        }
+        if (isDir ^ file.isDirectory()) {
+            throw new BuildException(file + " should" +
+                                     (!isDir ? "n't" : "") +
+                                     " be a directory!", loc);
+        }
+        return true;
+    }
+}
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/ICommandEditor.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/ICommandEditor.java
new file mode 100644 (file)
index 0000000..2010f7a
--- /dev/null
@@ -0,0 +1,27 @@
+/* *******************************************************************
+ * Copyright (c) 2003 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Wes Isberg     initial implementation 
+ * ******************************************************************/
+
+package org.aspectj.tools.ant.taskdefs;
+
+/**
+ * Preprocess command-lines
+ * @author Wes Isberg
+ */
+public interface ICommandEditor {
+    /**
+     * Edit command being used.
+     * @param command the String[] to edit
+     * @return String[] input command if unchanged, 
+     *         or new non-null array of non-null components otherwise
+     */
+    String[] editCommand(String[] command);
+}
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties
new file mode 100644 (file)
index 0000000..dfcfee6
--- /dev/null
@@ -0,0 +1,3 @@
+ajc=org.aspectj.tools.ant.taskdefs.Ajc10
+iajc=org.aspectj.tools.ant.taskdefs.AjcTask
+ajdoc=org.aspectj.tools.ant.taskdefs.Ajdoc
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java
new file mode 100644 (file)
index 0000000..690cccf
--- /dev/null
@@ -0,0 +1,222 @@
+/* *******************************************************************
+ * Copyright (c) 2000-2001 Xerox Corporation. 
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation 
+ * ******************************************************************/
+
+package org.aspectj.tools.ant.taskdefs.compilers;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Javac;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter;
+import org.apache.tools.ant.types.Commandline;
+
+/**
+ * Ajc uses this as the CompilerAdapter.
+ *
+ * This task was developed by the <a href="http://aspectj.org">AspectJ Project</a>
+ *
+ * @author <a href="mailto:palm@parc.xerox.com">Jeffrey Palm</a>
+ * @see    org.aspectj.tools.ant.taskdefs.Ajc
+ */
+public class Ajc extends DefaultCompilerAdapter {
+
+    /** The value of a compiler success. */
+    public final static int AJC_COMPILER_SUCCESS = 0;
+
+    /** The name of the compiler's main class. */
+    private final static String MAIN_CLASS_NAME = "org.aspectj.tools.ajc.Main";
+    
+    /**
+     * List of arguments allowed only by javac and <b>not</b> ajc.
+     */    
+    final static List<String> javacOnlyFlags
+        = finalList(new String[] { "-g:none", "-g:lines",
+        "-g:vars", "-g:source", "-nowarn"});
+    final static List<String> javacOnlyArgs  
+        = finalList(new String[] { "-sourcepath",
+        "-encoding", "-target" });
+
+    private static List<String> finalList(String[] args) {
+        List<String> result = new ArrayList<String>();
+        result.addAll(Arrays.asList(args));
+        return Collections.unmodifiableList(result);
+    }
+
+    /**
+     * Checks the command line for arguments allowed only in AJC and
+     * disallowed by AJC and then calls the <code>compile()<code> method.
+     *
+     * @return true if a good compile, false otherwise.
+     * @throws org.apache.tools.ant.BuildException
+     */
+    @Override
+       public boolean execute() throws BuildException {
+        attributes.log("Using AJC", Project.MSG_VERBOSE);
+        return compile(addAjcOptions(setupJavacCommand()));
+    }
+
+    /**
+     * Invokes the AJC compiler using reflection.
+     *
+     * @param cline the command line to pass the compiler
+     * @return      true for a good compile (0), false otherwise
+     * @throws      org.apache.tools.ant.BuildException
+     */
+    private boolean compile(Commandline cline) throws BuildException {
+        PrintStream err = System.err;
+        PrintStream out = System.out;
+        try {
+            Class main = Class.forName(MAIN_CLASS_NAME);
+            if (main == null) {
+                throw new ClassNotFoundException(MAIN_CLASS_NAME);
+            }
+            PrintStream logstr =
+                new PrintStream(new LogOutputStream(attributes,
+                                                    Project.MSG_WARN));
+            System.setOut(logstr);
+            System.setErr(logstr);
+            return ((Integer)main.getMethod
+                    ("compile", new Class[]{String[].class}).invoke
+                    (main.newInstance(), new Object[]{
+                        removeUnsupported(cline, logstr)
+                    })).intValue() == AJC_COMPILER_SUCCESS;
+        } catch (Exception e) {
+            if (e instanceof BuildException) {
+                throw (BuildException)e;
+            } else {
+                throw new BuildException("Error starting AJC compiler",
+                                         e, location);
+            }
+        } finally {
+            System.setErr(err);
+            System.setOut(out);
+        }
+    }
+
+    
+    /**
+     * Removes unsupported arguments from <code>cline</code>
+     * issuing warnings for each using <code>log</code>.
+     *
+     * @param cline the <code>org.apache.tools.ant.types.Commandline</code> from
+     *              which the argument is removed.
+     * @return      a new <code>java.lang.String</code> array containing all the
+     *              supported arguments found in <code>cline</code>.
+     * @throws      org.apache.tools.ant.BuildException
+     */
+    private String[] removeUnsupported(Commandline cline, PrintStream log) {
+        if (null == log) log = System.err;
+        String[] args = cline.getCommandline();
+        List argsList = new ArrayList();
+        for (int i = 0; i < args.length; i++) {
+            String arg = args[i];
+            if (javacOnlyFlags.contains(arg)) {
+              log.println("ignored by ajc " + arg);
+            } else if (javacOnlyArgs.contains(arg)) {
+              i++;
+              if (i < args.length) {
+                arg = arg + " " + args[i];
+              }
+              log.println("ignored by ajc " + arg);
+            } else {
+                argsList.add(args[i]);
+            }
+        }
+        return (String[])argsList.toArray(new String[argsList.size()]);
+    }
+    
+    /**
+     * Adds arguments that setupJavacCommand() doesn't pick up.
+     *
+     * @param cline <code>org.apache.tools.ant.types.Commandline</code> to
+     *              which arguments are added.
+     * @throws      org.apache.tools.ant.BuildException
+     * @see         AjcCompiler#ajcOnlyArgs
+     * @see         org.apache.tools.ant.taskdefs.compilers#DefaultCompilerAdapter.setupJavacCommand()
+     */
+    private Commandline addAjcOptions(Commandline cline) throws BuildException {
+        Javac javac = getJavac();
+                               
+        org.aspectj.tools.ant.taskdefs.Ajc2 ajc = null;
+
+        try {
+            ajc = (org.aspectj.tools.ant.taskdefs.Ajc2)javac;
+        } catch (ClassCastException cce) {
+            throw new BuildException(cce+"");
+        }
+        
+        if (ajc.getThreads() != null) {
+            cline.createArgument().setValue("-threads");
+            cline.createArgument().setValue(ajc.getThreads() + "");
+        }
+        if (ajc.getNocomments()) {
+            cline.createArgument().setValue("-nocomments");
+        }
+        if (ajc.getNosymbols()) {
+            cline.createArgument().setValue("-nosymbols");
+        }
+        if (ajc.getPreprocess()) {
+            cline.createArgument().setValue("-preprocess");
+        }
+        if (ajc.getWorkingdir() != null) {
+            cline.createArgument().setValue("-workingdir");
+            cline.createArgument().setFile(ajc.getWorkingdir());
+        }
+
+        return cline;
+    }
+
+    /**
+     * Logs the compilation parameters, adds the files to compile and logs the 
+     * &qout;niceSourceList&quot;
+     */
+    @Override
+       protected void logAndAddFilesToCompile(Commandline cmd) {
+
+        // Same behavior as DefaultCompilerAdapter.logAndAddFilesToCompile
+        attributes.log("Compilation args: " + cmd.toString(), Project.MSG_VERBOSE);
+        StringBuffer niceSourceList = new StringBuffer("File");
+        if (compileList.length != 1) {
+            niceSourceList.append("s");
+        }
+        niceSourceList.append(" to be compiled:");
+        niceSourceList.append(lSep);
+
+        for (int i=0; i < compileList.length; i++) {
+
+            // DefaultCompilerAdapter only expects .java files but we must deal
+            // with .lst files also
+            File file = compileList[i];
+
+            if (file == null) continue;
+
+            String arg = file.getAbsolutePath();
+            String rest = "";
+            String name = file.getName();
+
+            // For .java files take the default behavior and add that
+            // file to the command line
+            if (name.endsWith(".java")) {
+                cmd.createArgument().setValue(arg);
+            }
+            niceSourceList.append("   " + arg + rest + lSep);
+        }
+        attributes.log(niceSourceList.toString(), Project.MSG_VERBOSE);
+    }    
+}
diff --git a/taskdefs/src/main/resources/org/aspectj/antlib.xml b/taskdefs/src/main/resources/org/aspectj/antlib.xml
new file mode 100644 (file)
index 0000000..82022f0
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<antlib>
+       <typedef 
+               name="iajc" 
+               classname="org.aspectj.tools.ant.taskdefs.AjcTask"
+               uri="aspectjtools:/aspectj.org"
+               />
+       <typedef 
+               name="ajc" 
+               classname="org.aspectj.tools.ant.taskdefs.Ajc10"
+               uri="aspectjtools:/aspectj.org"
+               />
+</antlib>
diff --git a/taskdefs/src/org/aspectj/antlib.xml b/taskdefs/src/org/aspectj/antlib.xml
deleted file mode 100644 (file)
index 82022f0..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<antlib>
-       <typedef 
-               name="iajc" 
-               classname="org.aspectj.tools.ant.taskdefs.AjcTask"
-               uri="aspectjtools:/aspectj.org"
-               />
-       <typedef 
-               name="ajc" 
-               classname="org.aspectj.tools.ant.taskdefs.Ajc10"
-               uri="aspectjtools:/aspectj.org"
-               />
-</antlib>
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java
deleted file mode 100644 (file)
index 065f44e..0000000
+++ /dev/null
@@ -1,662 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2000-2001 Xerox Corporation. 
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Xerox/PARC     initial implementation 
- * ******************************************************************/
-
-package org.aspectj.tools.ant.taskdefs;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Location;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.MatchingTask;
-import org.apache.tools.ant.types.Commandline;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.Reference;
-import org.aspectj.bridge.AbortException;
-import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.IMessageHandler;
-import org.aspectj.bridge.IMessageHolder;
-import org.aspectj.bridge.MessageHandler;
-import org.aspectj.tools.ajc.Main;
-import org.aspectj.tools.ajc.Main.MessagePrinter;
-import org.aspectj.util.FileUtil;
-
-/**
- * Main taskdef class for the AspectJ 1.0 compiler, <code>ajc</code>.
- * See the README and examples/build.xml for more information.
- */
-public class Ajc10 extends MatchingTask {
-
-    private static final List<String> VALID_XOPTIONS;
-    static {
-        String[] xs = new String[] 
-            {   "lint", "serializableAspects", "targetNearSource", "OcodeSize",
-                "incrementalFile" };
-        VALID_XOPTIONS = Collections.unmodifiableList(Arrays.asList(xs));
-    }
-    //protected boolean version;
-    protected boolean source14;
-    protected Set ignoredOptions;
-    protected Commandline cmd;
-    protected Commandline vmcmd;
-    private int threads = -1;
-    private File destdir;
-    private File workingdir;
-    private Path internalclasspath;
-    private Path classpath;
-    private Path bootclasspath;
-    private Path extdirs;
-    private Path srcdir;
-    private List argfiles;
-    private boolean fork;
-    private boolean failonerror;
-    private boolean verbose;
-       private String encoding;
-       private String source;
-
-    public Ajc10() {
-        reset();
-    }
-
-    // ------------------------- options 
-    // find option types and whether ignored:
-    //   sed -n '/void set/p' Ajc.java | sed 's/.*\/\/ //' | sort -u
-    //   sed -n '/ignoredOptions/d;/ignored/p' Ajc.java 
-    // each option may be "ignored" and is one+ of:
-    //   ajc-old             used to be an ajc option
-    //   ajc-only            only an option for ajc, not javac
-    //   ajc-taskdef only    only an option for ajc taskdef, not ajc
-    //   javac-also          also an option in javac
-    //   eajc-also
-
-    // ------------------------- options in order per ajc output
-
-    public void setVerbose(boolean verbose) {  // javac-also eajc-also docDone
-        setif(verbose, "-verbose");
-        this.verbose = verbose;
-    }
-
-    public void setVersion(boolean version) {  // javac-also eajc-also docDone
-        // let the compiler handle it
-        if (version) {
-            setif(true, "-version");
-        }
-        //this.version = version;
-    }
-    
-    public void setNocomments(boolean nocomments) { // ajc-only not-eajc docDone
-        if (nocomments) {
-            ignore("-nocomments");
-        }
-        //setif(nocomments, "-nocomments");
-    }
-
-    public void setEmacssym(boolean input) {  // ajc-only  eajc-also docDone
-        setif(input, "-emacssym"); 
-    }
-
-    public void setUsejavac(boolean input) {  // ajc-only not-eajc docDone
-        if (input) {
-            ignore("-usejavac");
-        }
-        //setif(input, "-usejavac"); 
-    }
-
-    public void setPreprocess(boolean preprocess) { // ajc-only not-eajc docDone
-        if (preprocess) {
-            ignore("-preprocess");
-            //setif(preprocess, "-preprocess");
-        }
-    }
-
-    public void setWorkingdir(String workingdir) { // ajc-only not-eajc ocDone
-        ignore("-workingdir");
-        //this.workingdir = project.resolveFile(workingdir);
-    }
-
-    public void setDestdir(String destdir) { // javac-also eajc-also  docDone
-        this.destdir = project.resolveFile(destdir);
-    }
-
-    public void setOptimize(boolean optimize) { // javac-also ignored docDone
-        setif(optimize, "-O");
-    }
-   
-
-    public void setClasspath(Path classpath) {  // javac-also eajc-also docDone
-        if (this.classpath == null) {
-            this.classpath = classpath;
-        } else {
-            this.classpath.append(classpath);
-        }
-    }
-    public Path createClasspath() {  // javac-also docDone
-        if (classpath == null) {
-            classpath = new Path(project);
-        }
-        return classpath.createPath();
-    }        
-    
-    public void setClasspathref(Reference classpathref) {  // javac-also docDone
-        createClasspath().setRefid(classpathref);
-    }
-    
-    public void setBootclasspath(Path bootclasspath) {  // javac-also not-eajc docDone
-        ignore("bootclasspath"); // XXX may jury-rig
-//        if (this.bootclasspath == null) {
-//            this.bootclasspath = bootclasspath;
-//        } else {
-//            this.bootclasspath.append(bootclasspath);
-//        }
-    }
-    public Path createBootclasspath() {  // javac-also not-eajc docDone
-        ignore("bootclasspath"); // XXX may jury-rig
-        if (bootclasspath == null) {
-            bootclasspath = new Path(project);
-        }
-        return bootclasspath.createPath();
-    }    
-    
-    public void setBootclasspathref(Reference bootclasspathref) {  // javac-also not-eajc docDone
-        ignore("bootclasspath"); // XXX may jury-rig
-//        createBootclasspath().setRefid(bootclasspathref);
-    }
-    
-    public void setExtdirs(Path extdirs) {  // javac-also not-eajc docDone
-        ignore("-extdirs");
-//        if (this.extdirs == null) {
-//            this.extdirs = extdirs;
-//        } else {
-//            this.extdirs.append(extdirs);
-//        }
-    }
-
-    public Path createExtdirs() {  // javac-also not-eajc docDone
-        ignore("-extdirs");
-        if (extdirs == null) {
-            extdirs = new Path(project);
-        }
-        return extdirs.createPath();
-    }  
-
-    public void setArgfile(File argfile) { // ajc-only eajc-also docDone
-        if (argfiles == null) {
-            argfiles = new Vector();
-        }
-        argfiles.add(argfile);
-    }
-
-    public void setArgfiles(String argfiles) { // ajc-only eajc-also docDone
-        StringTokenizer tok = new StringTokenizer(argfiles, ", ", false);
-        if (tok.hasMoreTokens() && this.argfiles == null) {
-            this.argfiles = new Vector();
-        }
-        while (tok.hasMoreTokens()) {
-            this.argfiles.add(project.resolveFile(tok.nextToken().trim()));
-        }
-    }
-
-    public void setEncoding(String encoding) { // ignored eajc-also docDone
-        // XXX add support
-        //ignore("encoding");
-        this.encoding = encoding;
-    }
-
-    public void setSource(String input) {    // javac-also (Ant 1.4) eajc-also docDone
-        source = input;
-        //source14 = "1.4".equals(input); // XXX todo
-    }
-
-    public void setLenient(boolean input) {  // ajc-only not-eajc docDone
-        ignore("-lenient");
-        //setif(input, "-lenient"); 
-    }
-
-    public void setStrict(boolean input) {  // ajc-only not-eajc docDone
-        ignore("-strict");
-        //setif(input, "-strict"); 
-    }
-
-    public void setPorting(boolean input) {  // ajc-only not-eajc docDone
-        ignore("-porting");
-        //setif(input, "-porting"); 
-    }
-
-    public void setX(String input) {  // ajc-only eajc-also docDone
-        StringTokenizer tokens = new StringTokenizer(input, ",", false);
-        while (tokens.hasMoreTokens()) {
-            String token = tokens.nextToken().trim();
-            if (1 < token.length()) {
-                if (VALID_XOPTIONS.contains(token)) {
-                    setif(true, "-X" + token); 
-                } else {
-                    ignore("-X" + token);
-                }
-            }
-        }
-    }
-
-    // ------------------------- vestigial
-    public void setThreads(int threads) { // ajc-old docDone ignored
-        ignore("-threads");
-        //this.threads = threads;
-    }
-    
-    public void setDumpstack(boolean dumpstack) { // ajc-old
-        ignore("-dumpstack");
-        //setif(dumpstack, "-dumpstack");
-    }
-
-    // ------------------------- specific to taskdef
-
-    public void setInternalclasspath(Path internalclasspath) { // ajc-taskdef only
-        if (this.internalclasspath == null) {
-            this.internalclasspath = internalclasspath;
-        } else {
-            this.internalclasspath.append(internalclasspath);
-        }
-    }
-    public Path createInternalclasspath() { // ajc-taskdef only
-        if (internalclasspath == null) {
-            internalclasspath = new Path(project);
-        }
-        return internalclasspath.createPath();
-    }        
-    
-    public void setInternalclasspathref(Reference internalclasspathref) { // ajc-taskdef only
-        createInternalclasspath().setRefid(internalclasspathref);
-    }
-
-     public void setSrcdir(Path srcdir) { // javac-also eajc-also docDone
-        if (this.srcdir == null) {
-            this.srcdir = srcdir;
-        } else {
-            this.srcdir.append(srcdir);
-        }
-    }
-
-    public Path createSrc() { // javac-also eajc-also docDone
-        return createSrcdir();
-    }
-
-    public Path createSrcdir() { // javac-also eajc-also docDone
-        if (srcdir == null) {
-            srcdir = new Path(project);
-        }
-        return srcdir.createPath();
-    }
-
-    public void setFork(boolean fork) { // ajc-only not-eajc docDone
-        ignore("fork");
-        //this.fork = fork;
-    }
-
-    public void setFailonerror(boolean failonerror) {  // javac-also docDone
-        this.failonerror = failonerror;
-    }
-
-    public void setMaxmemory(String max) { // ajc-taskdef only docDone
-        ignore("-maxmemory");
-        // we do not run under 1.1 anyway...
-//        createJvmarg().setValue((Project.getJavaVersion().
-//                                 startsWith("1.1") ?
-//                                 "-mx" : "-Xmx") +max);
-    }
-
-    public void setJvmarg(String input) {  // ajc-taskdef only docDone
-        ignore("jvmarg"); // XXX fork
-        //vmcmd.createArgument().setValue(input);
-    }
-
-    public Commandline.Argument createJvmarg() { // ajc-taskdef only docDone
-        ignore("jvmarg"); // XXX fork
-        return vmcmd.createArgument();
-    }
-
-    // ------------------------- javac task compatibility
-    public void setNosymbols(boolean nosymbols) { // todo remove?
-        ignore("-nosymbols");
-        //setif(nosymbols, "-nosymbols");
-    }
-    
-    public void setDebug(boolean debug) { // javac-also eajc-also docDone
-        setif(debug, "-g"); // todo: changed from -debug
-    }
-    
-    public void setDeprecation(boolean deprecation) { // javac-also eajc-also docDone
-        setif(deprecation, "-deprecation"); // XXX eajc: also "warn:deprecation"
-    }
-
-    // ------------------------- javac task compatibility - ignored
-    public void setTarget(String target) {  // javac-also ignored docDone
-        ignore("target"); // todo: ajc accepts but doesn't use - pass in?
-    }
-    public void setDepend(String depend) {  // javac-also ignored docDone
-        ignore("depend");
-    }
-    public void setIncludeantruntime(boolean includeAntruntime) {  // javac-also ignored docDone
-        ignore("includeantruntime");
-    }
-    public void setIncludejavaruntime(boolean includeJavaruntime ) {  // javac-also ignored docDone
-        ignore("includeJavaruntime");
-    }
-
-    // ------------------------- other state methods
-    
-    protected final void ignore(String attribute) {
-        ignoredOptions.add(attribute);
-    }
-
-    public void backdoorSetFile(File file) {
-        if (null != file) {
-            cmd.createArgument().setFile(file);
-        }
-    }
-    
-    /** reset variables to permit gc */
-    public void reset() {
-        //version = false;
-        source14 = false;
-        ignoredOptions = new HashSet();
-        cmd = new Commandline();
-        vmcmd = new Commandline();
-        threads = -1;
-        destdir = null;
-        workingdir = null;
-        internalclasspath = null;
-        classpath = null;
-        bootclasspath = null;
-        extdirs = null;
-        srcdir = null;
-        argfiles = null;
-        fork = false;
-        failonerror = true;
-        encoding = null;
-        source = null;
-    }
-
-    protected final void setif(boolean b, String flag) {
-        if (b) cmd.createArgument().setValue(flag);
-    }
-
-    // ------------------------- operational methods
-
-    @Override
-       public void execute() throws BuildException {
-        if (srcdir == null && argfiles == null) {
-            throw new BuildException("one of srcdir or argfiles must be set!",
-                                     location);
-        }
-//        if (threads != -1) {
-//            cmd.createArgument().setValue("-threads");
-//            cmd.createArgument().setValue(threads+"");
-//        }
-//        if (workingdir != null) {
-//            cmd.createArgument().setValue("-workingdir");
-//            cmd.createArgument().setFile(workingdir);
-//        }
-        if (destdir != null) {
-            cmd.createArgument().setValue("-d");
-            cmd.createArgument().setFile(destdir);
-        }
-        if (classpath != null) {
-            cmd.createArgument().setValue("-classpath");
-            cmd.createArgument().setPath(classpath);
-        }
-        if (bootclasspath != null) {
-            cmd.createArgument().setValue("-bootclasspath");
-            cmd.createArgument().setPath(bootclasspath);
-        }
-        if (extdirs != null) {
-            cmd.createArgument().setValue("-extdirs");
-            cmd.createArgument().setPath(extdirs);
-        }
-        if (null != encoding) {
-            cmd.createArgument().setValue("-encoding");
-            cmd.createArgument().setValue(encoding);
-        }
-        if (null != source) {
-            cmd.createArgument().setValue("-source");
-            cmd.createArgument().setValue(source);
-        }
-
-        int numargfiles = 0;
-        if (argfiles != null) {
-            for (Iterator i = argfiles.iterator(); i.hasNext();) {
-                String name = i.next()+"";
-                File argfile = project.resolveFile(name);
-                if (check(argfile, name, false, location)) {
-                    cmd.createArgument().setValue("-argfile");
-                    cmd.createArgument().setFile(argfile);
-                    numargfiles++;    
-                }
-            }
-        }
-        int numfiles = 0;
-        if (srcdir != null) {
-            // todo: ignore any srcdir if any argfiles and no explicit includes
-            String[] dirs = srcdir.list();
-            for (int i = 0; i < dirs.length; i++) {
-                File dir = project.resolveFile(dirs[i]);
-                check(dir, dirs[i], true, location);
-                String[] files = getDirectoryScanner(dir).getIncludedFiles();
-                for (int j = 0; j < files.length; j++) {
-                    File file = new File(dir, files[j]);
-                    if (FileUtil.hasSourceSuffix(file)) {
-                        cmd.createArgument().setFile(file);
-                        numfiles++;
-                    }
-                }
-            }
-        }
-        if ((null != ignoredOptions) && (ignoredOptions.size() > 0)) {
-            log("The following attributes were ignored " + ignoredOptions,
-                Project.MSG_WARN);
-            if (ignoredOptions.contains("-preprocess")) {
-                throw new BuildException("preprocess no longer supported");
-            }
-        }
-        log("Compiling " + numfiles + " source and " +
-            + numargfiles + " arg files" 
-            + (null == destdir ? "" : " to " + destdir.getPath()), Project.MSG_INFO);
-
-         // here is the actual invocation
-        //int result = (fork || (internalclasspath != null)) ? fork() : spoon();
-        if (fork || (internalclasspath != null))  {
-               log("WARNING: fork not supported", Project.MSG_WARN);
-        }
-        int result = spoon();
-        if (result != 0) {
-            String msg = "Compilation error: " + result;
-            if (failonerror) {
-                reset();
-                throw new BuildException(msg);
-            } else {
-                log(msg, Project.MSG_WARN);
-            }
-        }
-        reset(); // see throw above
-    }
-
-// now leaving version to compiler - remove
-//    protected void version(Path classpath) {
-//        try {
-//            Class main = findClass("org.aspectj.tools.ajc.Main",
-//                                   classpath);
-//            Method printVersion = main.getDeclaredMethod("printVersion",
-//                                                         new Class[]{});
-//            printVersion.setAccessible(true);
-//            printVersion.invoke(main.newInstance(), new Object[]{});
-//        } catch (Exception e) {}
-//    }
-//
-//    protected Class findClass(String classname, Path classpathPath) {
-//        String classpath = (classpathPath != null ?
-//                            classpathPath+"" : "").trim();
-//        if (classpath.length() == 0) {
-//            try {
-//                return Class.forName(classname);
-//            } catch (ClassNotFoundException e){}
-//        }
-//        List urls = new ArrayList();
-//        for (StringTokenizer t = new StringTokenizer(classpath,
-//                                                     File.pathSeparator);
-//             t.hasMoreTokens();) {
-//            File f = new File(t.nextToken().trim());
-//            try {
-//                if (f.exists()) {
-//                    URL url = f.toURL();
-//                    if (url != null) urls.add(url);
-//                }
-//            } catch (MalformedURLException e) {}
-//        }
-//        if (urls.size() == 0) return null;
-//        try {
-//            return new URLClassLoader((URL[])urls.toArray
-//                                      (new URL[urls.size()]),
-//                                      null).loadClass(classname);
-//        } catch (ClassNotFoundException e) {}
-//        return null;
-//    }
-
-// unused now, but leave in
-//    protected int fork() throws BuildException {
-//        Java java = (Java)project.createTask("java");
-//        java.setTaskName(getTaskName());
-//        Path compileClasspath;
-//        if (internalclasspath != null) {
-//            compileClasspath = internalclasspath;
-//            compileClasspath.append(Path.systemClasspath);
-//        } else {
-//            compileClasspath = Path.systemClasspath;
-//        }
-//        //if (version) version(compileClasspath);
-//        java.setClasspath(compileClasspath);
-//        java.setClassname(FALSE_MAIN);
-//        String[] args;
-//        args = cmd.getArguments();
-//        for (int i = 0; i < args.length; i++) {
-//            java.createArg().setValue(args[i]);
-//        }
-//        args = vmcmd.getArguments();
-//        for (int i = 0; i < args.length; i++) {
-//            java.createJvmarg().setValue(args[i]);
-//        }
-//        java.setFork(fork);
-//        // java handles its own verbose logging when forking
-//        return java.executeJava();
-//    }
-
-    /** utility to render String[] for logging */
-    public static String render(String[] args) {
-        if (null == args) return "";
-        StringBuffer sb = new StringBuffer();
-        for (int i = 0; i < args.length; i++) {
-            sb.append(args[i]);
-            sb.append(" ");
-        }
-        return sb.toString();
-    }
-
-    protected int spoon() throws BuildException {
-        //if (version) version(null);
-        int result = -1;
-        final IMessageHolder holder;
-        {
-               MessageHandler handler = new MessageHandler();
-               if (!verbose) {
-                               handler.ignore(IMessage.INFO);
-                       }
-               final IMessageHandler delegate 
-                       = verbose ? MessagePrinter.VERBOSE: MessagePrinter.TERSE;
-                       handler.setInterceptor(delegate);
-                       holder = handler;
-        }
-        try {
-            String[] args = cmd.getCommandline();
-            // XXX avoid rendering if not verbosely logging?
-            log("Running  in-process using " 
-                + Ajc10.render(cmd.getCommandline()), Project.MSG_VERBOSE);
-               
-               Main main = new Main();
-               main.run(args, holder);
-               int errs = holder.numMessages(IMessage.ERROR, true);
-               if (0 < errs) {
-                       result = 1;
-               } else {
-                result = 0;
-            }
-        } catch (Throwable t) {
-            while (t instanceof AbortException) {
-                // check for "just quit -- message printed already"
-                if (((AbortException)t).isSilent()) { 
-                    t = null;
-                    break;
-                }
-                IMessage m = ((AbortException) t).getIMessage();
-                if (null == m) {
-                    break;
-                } else {
-                    Throwable tt = m.getThrown();
-                    if (null != tt) {
-                        t = tt;   
-                    } else {
-                        break;
-                    }
-                }
-            }
-            if (null != t) {
-                // t.printStackTrace(); // let recipient print
-                throw new BuildException("Compiler failure", t, location);
-            }
-        } finally {
-               // now printing messages as we go, above
-//                     IMessage.Kind level = (verbose ? IMessage.INFO : IMessage.WARNING);
-//             if (0 < holder.numMessages(level, true)) {
-//                     final String prefix = "";
-//                     final boolean printSummary = false;
-//                     MessageUtil.print(System.err, 
-//                             holder, 
-//                             prefix, 
-//                             MessageUtil.MESSAGE_ALL,
-//                             (verbose ? MessageUtil.PICK_INFO_PLUS : MessageUtil.PICK_WARNING_PLUS),
-//                             printSummary);
-//             }
-        }
-        return result;
-    }
-
-    protected final boolean check(File file, String name,
-                                  boolean isDir, Location loc) {
-        loc = loc != null ? loc : location;
-        if (file == null) {
-            throw new BuildException(name + " is null!", loc);
-        }
-        if (!file.exists()) {
-            throw new BuildException(file + "doesn't exist!", loc);
-        }
-        if (isDir ^ file.isDirectory()) {
-            String e = file + " should" + (isDir ? "" : "n't")  +
-                " be a directory!";
-            throw new BuildException(e, loc);
-        }
-        return true;
-    }
-}
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapter.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapter.java
deleted file mode 100644 (file)
index a64c513..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2003 Contributors.
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Wes Isberg     initial implementation
- * ******************************************************************/
-
-package org.aspectj.tools.ant.taskdefs;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Javac;
-import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
-import org.aspectj.util.FileUtil;
-
-import java.io.File;
-//import java.io.FileFilter;
-//import java.io.FileWriter;
-//import java.io.IOException;
-
-/**
- * Adapt ajc to javac commands.
- * Note that the srcdirs set for javac are NOT passed on to ajc;
- * instead, the list of source files generated is passed to ajc.
- * <p>
- * Javac usually prunes the source file list based on the timestamps
- * of corresponding .class files, which is wrong for ajc which
- * requires all the files every time.  To work around this,
- * set the global property CLEAN ("build.compiler.clean") to delete
- * all .class files in the destination directory before compiling.
- * 
- * <p><u>Warnings</u>: 
- * <ol>
- * <li>cleaning will not work if no destination directory
- *     is specified in the javac task.
- *     (RFE: find and kill .class files in source dirs?)</li>
- * <li>cleaning will makes stepwise build processes fail
- * if they depend on the results of the prior compilation being
- * in the same directory, since this deletes <strong>all</strong>
- * .class files.</li>
- * <li>If no files are out of date, then the adapter is <b>never</b> called
- *     and thus cannot gain control to clean out the destination dir.
- *     </li>
- * <p>
- * 
- * @author Wes Isberg
- * @since AspectJ 1.1, Ant 1.5.1
- */
-public class Ajc11CompilerAdapter implements CompilerAdapter {
-
-    /** 
-     * Define this system/project property to signal that the 
-     * destination directory should be cleaned 
-     * and javac reinvoked
-     * to get the complete list of files every time.
-     */
-    public static final String CLEAN = "build.compiler.clean";
-
-    /** track whether we re-called <code>javac.execute()</code> */
-    private static final ThreadLocal inSelfCall = new ThreadLocal() {
-        public Object initialValue() {
-            return Boolean.FALSE;
-        }
-    };
-
-    Javac javac;
-
-    public void setJavac(Javac javac) {
-        this.javac = javac;
-        javac.setTaskName(javac.getTaskName() + " - ajc");
-    }
-
-    public boolean execute() throws BuildException {
-        if (null == javac) {
-            throw new IllegalStateException("null javac");
-        }
-        if (!((Boolean) inSelfCall.get()).booleanValue()
-            && afterCleaningDirs()) {
-            // if we are not re-calling ourself and we cleaned dirs,
-            // then re-call javac to get the list of all source files.
-            inSelfCall.set(Boolean.TRUE);
-            javac.execute();
-            // javac re-invokes us after recalculating file list
-        } else {
-            try {
-                AjcTask ajc = new AjcTask();
-                String err = ajc.setupAjc(javac);
-                if (null != err) {
-                    throw new BuildException(err, javac.getLocation());
-                }
-                ajc.execute();
-                // handles BuildException for failonerror, etc.
-            } finally {
-                inSelfCall.set(Boolean.FALSE);
-            }
-        }
-        return true;
-    }
-
-    /**
-     * If destDir exists and property CLEAN is set, 
-     * this cleans out the dest dir of any .class files,
-     * and returns true to signal a recursive call.
-     * @return true if destDir was cleaned.
-     */
-    private boolean afterCleaningDirs() {
-        String clean = javac.getProject().getProperty(CLEAN);
-        if (null == clean) {
-            return false;
-        }
-        File destDir = javac.getDestdir();
-        if (null == destDir) {
-            javac.log(
-                CLEAN + " specified, but no dest dir to clean",
-                Project.MSG_WARN);
-            return false;
-        }
-        javac.log(
-            CLEAN + " cleaning .class files from " + destDir,
-            Project.MSG_VERBOSE);
-        FileUtil.deleteContents(
-            destDir,
-            FileUtil.DIRS_AND_WRITABLE_CLASSES,
-            true);
-        return true;
-    }
-}
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc2.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc2.java
deleted file mode 100644 (file)
index f31c755..0000000
+++ /dev/null
@@ -1,540 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2000-2001 Xerox Corporation. 
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Xerox/PARC     initial implementation 
- * ******************************************************************/
-
-package org.aspectj.tools.ant.taskdefs;
-
-import org.apache.tools.ant.*;
-import org.apache.tools.ant.types.*;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.taskdefs.*;
-import org.apache.tools.ant.util.JavaEnvUtils;
-
-import java.io.*;
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-/**
- * Ant task for the AspectJ compiler -- AJC.
- * List (.lst) files are passed in as includes.
- *
- * This task was developed by the <a href="http://aspectj.org">AspectJ Project</a>
- *
- * @author <a href="mailto:palm@parc.xerox.com">Jeffrey Palm</a>
- * @see    org.aspectj.tools.ant.taskdefs.compilers.AjcCompiler
- */
-public class Ajc2 extends Javac {
-
-    /**
-     * The name of the adapter we use.
-     */
-    public final static String ADAPTER_CLASS =
-        "org.aspectj.tools.ant.taskdefs.compilers.Ajc";
-
-    /* ----------------------------------------------------------------------
-     * Attribute members
-     * ----------------------------------------------------------------------
-     */
-   
-    /**
-     * How many concurrent threads to use for compilation,
-     * defaults to 0 -- multi-threading disabled.
-     */
-    private Integer threads;
-
-    /**
-     * Don't generate any comments into the woven code.
-     */
-    private boolean nocomments;
-
-    /**
-     * Don't generate .ajsym or .ajsline files.
-     */
-    private boolean nosymbols;
-
-    /**
-     * Generate regular Java code into <workingdir>.
-     */
-    private boolean preprocess;
-
-    /**
-     * Specify where to place intermediate .java files <dir>
-     * defaults to ./ajworkingdir.
-     */
-    private File workingdir;
-
-    /**
-     * The file is a line-delimited list of arguments
-     * these arguments are inserted into the argument list
-     */
-    private List argfiles;
-
-
-    /* ----------------------------------------------------------------------
-     * Misc. members
-     * ----------------------------------------------------------------------
-     */
-
-    /**
-     * Whether we have used the <code>excludes</code> attribute.
-     */
-    private boolean haveExcludes = false;
-
-    /**
-     * Whether we have used the <code>includes</code> attribute.
-     */
-    private boolean haveIncludes = false;
-
-    /**
-     * Whether we have used the <code>excludes</code> attribute.
-     * @return Whether we have used the <code>excludes</code> attribute.
-     */
-    protected boolean hasExcludes() {
-        return haveExcludes;
-    }
-
-    /**
-     * Whether we have used the <code>includes</code> attribute.
-     * @return Whether we have used the <code>includes</code> attribute.
-     */
-    protected boolean hasIncludes() {
-        return haveIncludes;
-    }
-
-    /* ----------------------------------------------------------------------
-     * Attribute access methods
-     * ----------------------------------------------------------------------
-     */
-    
-    /**
-     * Sets the number of threads.
-     *
-     * @param threads the number of threads.
-     * @see           Ajc2#threads
-     */
-    public void setThreads(Integer threads) {
-        this.threads = threads;
-    }
-
-    /**
-     * Returns the number of threads.
-     *
-     * @return the number of threads.
-     * @see    Ajc2#threads
-     */
-    public Integer getThreads() {
-        return threads;
-    }
-
-    /**
-     * Set the <code>-nocomments</code> flag.
-     *
-     * @param nocomments true turns on the flag.
-     * @see              Ajc2#nocomments
-     */
-    public void setNocomments(boolean nocomments) {
-        this.nocomments = nocomments;
-    }
-
-    /**
-     * Returns if the <code>-nocomments</code> flag is turned on.
-     *
-     * @return <code>true</code> if the <code>-nocomments</code> flag is on.
-     * @see    Ajc2#nocomments
-     */
-    public boolean getNocomments() {
-        return nocomments;
-    }
-
-    /**
-     * Set the <code>-nosymbols</code> flag.
-     *
-     * @param nosymbols true turns on the flag.
-     * @see             Ajc2#nosymbols
-     */
-    public void setNosymbols(boolean nosymbols) {
-        this.nosymbols = nosymbols;
-    }
-
-    /**
-     * Returns if the <code>-nosymbols</code> flag is turned on.
-     *
-     * @return <code>true</code> if the <code>-nosymbols</code> flag is on.
-     * @see    Ajc2#nosymbols
-     */    
-    public boolean getNosymbols() {
-        return nosymbols;
-    }
-
-    /**
-     * Returns if the <code>-preprocess</code> flag is turned on.
-     *
-     * @return <code>true</code> if the <code>-preprocess</code> flag is on.
-     * @see    Ajc2#preprocess
-     */
-    public void setPreprocess(boolean preprocess) {
-        this.preprocess = preprocess;
-    }
-
-    /**
-     * Returns if the <code>-preprocess</code> flag is turned on.
-     *
-     * @return <code>true</code> if the <code>-preprocess</code> flag is on.
-     * @see    Ajc2#preprocess
-     */      
-    public boolean getPreprocess() {
-        return preprocess;
-    }
-
-    /**
-     * Sets the workingdir.
-     *
-     * @param workingdir the new workingdir.
-     * @see   Ajc2#workingdir
-     */
-    public void setWorkingdir(File workingdir) {
-        this.workingdir = workingdir;
-    }
-
-    /**
-     * Returns the current workingdir.
-     *
-     * @return the current workingdir.
-     * @see    Ajc2#workingdir
-     */
-    public File getWorkingdir() {
-        return workingdir;
-    }
-
-    /**
-     * Sets the the argument files by the comma-delimited String passed in.
-     *
-     * @param argfiles comma-delimited String contained argument files.
-     */
-    public void setArgfiles(String argfiles) {
-        StringTokenizer tok = new StringTokenizer(argfiles, ",");
-        while (tok.hasMoreTokens()) {
-            File argfile = project.resolveFile(tok.nextToken());
-            if (argfile != null && argfile.exists() && !argfile.isDirectory()) {
-                createArgfile().setFile(argfile);
-            }
-        }
-    }
-
-    /**
-     * Creates a nested <code>Argfile</code>, add it to the list
-     * <code>argfiles</code>, and returns the new <code>Argfile</code>
-     * instance.
-     *
-     * @return a new <code>Argfile</code> instance.
-     */
-    public Argfile createArgfile() {
-        Argfile argfile = new Argfile();
-        if (argfiles == null) {
-            argfiles = new ArrayList();
-        }
-        argfiles.add(argfile);
-        return argfile;
-    }
-
-    /**
-     * Returns the java.util.List of argfiles.
-     * This could be <code>null</code>.
-     *
-     * @return the list of argfiles.
-     */
-    public List getArgfiles() {
-        return argfiles;
-    }
-
-    /**
-     * A simple class with one member -- <code>file</code> -- that
-     * represents an argument file.
-     */
-    public static class Argfile {
-        private File file;
-        public void setFile(File file) { this.file = file; }
-        public File getFile() { return file; }
-        public String toString() { return file.getAbsolutePath(); }
-    }
-
-    /* ----------------------------------------------------------------------
-     * Misc. methods
-     * ----------------------------------------------------------------------
-     */
-
-    /* Leaving the includes blank in the Javac task defaults to including all.
-     * In Ajc, if the user specifies an argfile, but leaves the includes and
-     * excludes blank that person probably meant to just includes to argfile.
-     * So, we keep track of whether includes and/or excludes have been explicitly
-     * used with the have{In,Ex}cludes members, and setting these flags
-     * in the create... and set... methods.
-     *
-     * When constructing the compileList, if both haveIncludes and haveExcludes
-     * are false, but the user has specified an argfile, then we set includes
-     * to '!**' before adding the contents of the argfile.
-     */
-
-    /**
-     * Override Javac.createInclude() to set <code>haveIncludes</code>
-     * to <code>true</code>.
-     *
-     * @return new PatternSet.NameEntry to be added to the include list.
-     * @see    org.apache.tools.taskdefs.Javac#createInclude()
-     */
-    public PatternSet.NameEntry createInclude() {
-        haveIncludes = true;
-        return super.createInclude();
-    }
-
-    /**
-     * Override Javac.createExclude() to set <code>haveExcludes</code>
-     * to <code>true</code>.
-     *
-     * @return new PatternSet.NameEntry to be added to the exclude list.
-     * @see    org.apache.tools.taskdefs.Javac#createExclude()
-     */    
-    public PatternSet.NameEntry createExclude() {
-        haveExcludes = true;
-        return super.createExclude();
-    }
-
-    /**
-     * Override Javac.setIncludes(String) to set <code>haveIncludes</code>
-     * to <code>true</code>.
-     *
-     * @param includes Comma-separated list of includes.
-     * @see   org.apache.tools.taskdefs.Javac#setIncludes(java.lang.String)
-     */
-    public void setIncludes(String includes) {
-        haveIncludes = true;
-        super.setIncludes(includes);
-    }
-
-    /**
-     * Override Javac.setExcludes(String) to set <code>haveExcludes</code>
-     * to <code>true</code>.
-     *
-     * @param excludes Comma-separated list of excludes.
-     * @see   org.apache.tools.taskdefs.Javac#setExcludes(java.lang.String)
-     */    
-    public void setExcludes(String excludes) {
-        haveExcludes = true;
-        super.setExcludes(excludes);
-    }
-
-    public String getAdapterClass() {
-        return ADAPTER_CLASS;
-    }
-    
-
-    public final void execute() throws BuildException {
-        prepare();
-        executeAfterPrepare();
-    }
-
-    /**
-     * Executes by first setting the <code>build.compiler</code> property
-     * to AjcCompiler, then invokes the super.execute() method.
-     *
-     * @throws org.apache.tools.ant.BuildException
-     * @see    org.apache.tools.ant.taskdefs.Javac#execute()
-     */    
-    public void executeAfterPrepare() throws BuildException {
-        
-        // Save the old build.compiler property
-        String oldBuildCompiler = project.getProperty("build.compiler");
-
-        // If oldBuildCompiler is null try to resolve it
-        if (oldBuildCompiler == null) {
-            String javaVersion = JavaEnvUtils.getJavaVersion();
-            if (javaVersion.equals(JavaEnvUtils.JAVA_1_0)) {
-                // Cannot happen
-            } else if (javaVersion.equals(JavaEnvUtils.JAVA_1_1)) {
-                oldBuildCompiler = "classic";
-            } else if (javaVersion.equals(JavaEnvUtils.JAVA_1_2)) {
-                oldBuildCompiler = "classic";
-            } else if (javaVersion.equals(JavaEnvUtils.JAVA_1_3)) {
-                oldBuildCompiler = "modern";
-            }
-        }
-
-        // Set the new adapter
-        project.setProperty("build.compiler", getAdapterClass());
-        BuildException caught = null;
-        try {
-            super.execute();
-        } catch (BuildException be) {
-            caught = be;
-        } finally {
-            
-            // Reset to the old compiler
-            if (oldBuildCompiler != null) {
-                project.setProperty("build.compiler", oldBuildCompiler);
-            }
-        }
-
-        // If we caught an exception executing throw it
-        if (caught != null) {
-            throw caught;
-        }
-     }
-
-    /**
-     * Guaranteed to be called before doing real execute.
-     */
-    public void prepare() {
-        if (argfiles != null && !haveIncludes &&
-            !haveExcludes && getSrcdir() == null) {
-            useDefaultSrcdir();
-        }
-    }
-
-    protected final void useDefaultSrcdir() {
-        setSrcdir(new Path(project, "."));
-    }
-
-    /**
-     * Overrides Javac.scanDir(..) so that it doesn't check dependencies.
-     *
-     * @see org.apache.tools.ant.taskdefs.Javac#scanDir
-     */
-    protected void scanDir(File srcDir, File destDir, String files[]) {
-        List newFiles = new ArrayList();
-
-        // Add the files listed in the argfiles to the includes
-        List newIncludes = new ArrayList();
-        List newArguments = new ArrayList();
-        if (argfiles != null) {
-            Iterator iter = argfiles.iterator();
-            while (iter.hasNext()) {
-                File argfile = ((Argfile)iter.next()).getFile();
-                expandArgfile(argfile, newIncludes, newArguments);
-            }
-        }
-
-        // If there aren't any includes, but we've used an argfile then we should
-        // set the includes to be the one's found in newIncludes
-        // If we do this, we need to re-read files from the directory scanner
-        if (!haveIncludes && !haveExcludes && argfiles != null) {
-            log("Setting includes to '!**'", Project.MSG_VERBOSE);
-            setIncludes("!**");
-            //files = getDirectoryScanner(srcDir).getIncludedFiles();
-        }
-
-        // Otherwise we want to add all .java files to the compileList
-        else {
-            for (int i = 0; i < files.length; i++) {
-                File newFile = new File(srcDir, files[i]);
-                if (newFile != null &&
-                    newFile.exists() &&
-                    newFile.getName().endsWith(".java")) {
-                    newFiles.add(newFile);
-                }
-            }
-        }
-
-        // Add the new included files
-        Iterator iter = newIncludes.iterator();
-        while (iter.hasNext()) {
-            newFiles.add((File)iter.next());
-        }
-
-        // This is the same behavior found in Javac
-        int newFileSize = newFiles.size();
-        if (newFileSize > 0) {
-            File[] newCompileList = new File[compileList.length + newFileSize];
-            System.arraycopy(compileList, 0, newCompileList, 0, compileList.length);
-            System.arraycopy(newFiles.toArray(), 0, newCompileList,
-                             compileList.length, newFileSize);
-            compileList = newCompileList;
-        }
-    }
-
-    private void expandArgfile(File argfile, List includes, List arguments) {
-
-        log("argfile:" + argfile, Project.MSG_VERBOSE);
-        
-        // All paths are relative to the parent
-        File parent = argfile.getParentFile();
-
-        // Sanity check
-        if (parent == null || !parent.exists() || !parent.isDirectory()) {
-            return;
-        }
-
-        // Read the file
-        BufferedReader in = null;
-        try {
-            in = new BufferedReader(new FileReader(argfile));
-            String line;
-            while ((line = in.readLine()) != null) {
-                line = line.trim();
-
-                // Skip blank lines
-                if ("".equals(line)) {
-                    continue;
-                }
-
-                // Allow '#' and '//' line comments
-                int isharp = line.indexOf("#");
-                if (isharp != -1) {
-                    line = line.substring(0, isharp);
-                }
-
-//                int istar = -1;
-
-                // Argument
-                if (line.startsWith("-")) {
-                    arguments.add(line);
-                }
-
-                // If there are stars we'll try to resolve the file here
-                else if (line.indexOf("*") != -1) {
-                    log("The argfile line '" + line + "' is invalid",
-                        Project.MSG_WARN);
-                }
-
-                // Another argfile
-                else if (line.startsWith("@")) {
-                    String newArgfileName = line.substring(1);
-                    File newArgfile = new File(parent, newArgfileName);
-                    expandArgfile(newArgfile, includes, arguments);
-                }
-
-                // Source file
-                else {
-                    File newfile = new File(line);
-                    if (!newfile.isAbsolute()) {
-                        newfile = new File(parent, line);
-                    }
-                    if (newfile != null && newfile.exists() &&
-                        !newfile.isDirectory() &&
-                        newfile.getName().endsWith(".java")) {
-                        includes.add(newfile);
-                    }
-                }
-
-            }
-        } catch (IOException ioe) {
-            log("trouble with argfile: " + argfile + ":" + ioe, Project.MSG_ERR);
-        } finally {
-            try {
-                if (in != null) {
-                    in.close();
-                }
-            } catch (IOException ioe2) {
-            }
-        }
-    }
-}
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcCompilerAdapter.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcCompilerAdapter.java
deleted file mode 100644 (file)
index 1542f6c..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2000-2001 Xerox Corporation. 
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Xerox/PARC     initial implementation 
- * ******************************************************************/
-
-package org.aspectj.tools.ant.taskdefs;
-
-import org.apache.tools.ant.taskdefs.Javac;
-import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Path;
-
-
-import java.io.File;
-
-/**
- * Partial implementation of CompilerAdapter for ajc task.
- * The Javac interface does not support argfiles which are
- * typically necessary to compile under ajc, so this 
- * implementation is not documented, recommended, or supported.
- * See Apache request for enhancement 
- * <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7542">
- * 7542</a>.
- * @see CompilerAdapter
- */
-public class AjcCompilerAdapter implements CompilerAdapter {
-    // Cannot extend Ajc because CompilerAdapter.execute() returns boolean.
-
-    Ajc10 ajc = null;
-
-    /** @see CompilerAdapter */
-    public void setJavac(Javac javac) {
-        if (null == javac) {
-            throw new IllegalArgumentException("null javac");
-        }
-        Object task = javac.getProject().createTask("ajc"); 
-        String err = null;
-        if (null == task) {
-            err = "ajc not defined - put ajc taskdef library on classpath";
-        } else if (!(task instanceof Ajc10)) {
-            String name = task.getClass().getName();
-            err = "Wrong class for Ajc task - ";
-            if (name.equals(Ajc10.class.getName())) {
-                err = err + "second class loader - put ajc taskdef library "
-                    + "only on system classpath via ant/lib";
-            } else {
-                err = err + name;
-            }
-        }
-        if (null != err) {
-            throw new Error(err);
-        }
-
-        Ajc10 tempAjc = (Ajc10) task;
-        Path srcDir = javac.getSrcdir();
-        if (null != srcDir) {
-            tempAjc.setSrcdir(srcDir);
-        }
-        File destDir = javac.getDestdir();
-        if (null != destDir) {
-            tempAjc.setDestdir(destDir.getPath());
-        }
-        Path classpath = javac.getClasspath();
-        if (null != classpath) {
-            tempAjc.setClasspath(classpath);
-        }
-        Path bootclasspath = javac.getBootclasspath();
-        if (null != bootclasspath) {
-            tempAjc.setBootclasspath(bootclasspath);
-        }
-        Path extDirs = javac.getExtdirs();
-        if (null != extDirs) {
-            tempAjc.setExtdirs(extDirs);
-        }
-
-        tempAjc.setFailonerror(javac.getFailonerror());
-        tempAjc.setDeprecation(javac.getDeprecation()); // XXX unsupported
-        tempAjc.setEncoding(javac.getEncoding());
-        tempAjc.setDebug(javac.getDebug()); // XXX unsupported
-        tempAjc.setOptimize(javac.getOptimize()); // XXX unsupported
-        tempAjc.setDepend(javac.getDepend()?"on":"off"); // XXX unsupported
-        tempAjc.setVerbose(javac.getVerbose()); 
-        String target = javac.getTarget();
-        if (null != target) {
-            tempAjc.setTarget(target);
-        }
-        tempAjc.setIncludeantruntime(javac.getIncludeantruntime()); // XXX unsupported
-        File[] files = javac.getFileList();
-        if (null != files) {
-            for (int i = 0; i < files.length; i++) {
-                tempAjc.backdoorSetFile(files[i]);
-            } 
-        }
-        ajc = tempAjc;
-    }
-
-    /** 
-     * Run the compiler.
-     * @see CompilerAdapter#execute() 
-     * @throws BuildException if setJavac(Javac) was not called before each call of this
-     */
-    public boolean execute() throws BuildException {
-        if (null == ajc) {
-            throw new BuildException("setJavac(Javac) not completed");
-        }
-        ajc.execute();
-        ajc = null; // enforce one-shot
-        return true;
-    }
-}
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
deleted file mode 100644 (file)
index fe6be92..0000000
+++ /dev/null
@@ -1,2171 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2001-2001 Xerox Corporation, 
- *               2002 Palo Alto Research Center, Incorporated (PARC)
- *               2003-2004 Contributors.
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Xerox/PARC     initial implementation 
- *     Wes Isberg     2003-2004 changes
- * ******************************************************************/
-
-package org.aspectj.tools.ant.taskdefs;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.apache.tools.ant.AntClassLoader;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Location;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Copy;
-import org.apache.tools.ant.taskdefs.Delete;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.Expand;
-import org.apache.tools.ant.taskdefs.Javac;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.taskdefs.MatchingTask;
-import org.apache.tools.ant.taskdefs.Mkdir;
-import org.apache.tools.ant.taskdefs.PumpStreamHandler;
-import org.apache.tools.ant.taskdefs.Zip;
-import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter;
-import org.apache.tools.ant.types.Commandline;
-import org.apache.tools.ant.types.CommandlineJava;
-import org.apache.tools.ant.types.FileSet;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.PatternSet;
-import org.apache.tools.ant.types.Reference;
-import org.apache.tools.ant.types.ZipFileSet;
-import org.apache.tools.ant.util.TaskLogger;
-import org.aspectj.bridge.AbortException;
-import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.IMessage.Kind;
-import org.aspectj.bridge.IMessageHandler;
-import org.aspectj.bridge.IMessageHolder;
-import org.aspectj.bridge.MessageHandler;
-import org.aspectj.bridge.MessageUtil;
-import org.aspectj.tools.ajc.Main;
-import org.aspectj.util.FileUtil;
-import org.aspectj.util.LangUtil;
-
-/**
- * This runs the AspectJ 1.1 compiler, supporting all the command-line options. In 1.1.1, ajc copies resources from input jars, but
- * you can copy resources from the source directories using sourceRootCopyFilter. When not forking, things will be copied as needed
- * for each iterative compile, but when forking things are only copied at the completion of a successful compile.
- * <p>
- * See the development environment guide for usage documentation.
- * 
- * @since AspectJ 1.1, Ant 1.5
- */
-public class AjcTask extends MatchingTask {
-       /*
-        * This task mainly converts ant specification for ajc, verbosely ignoring improper input. It also has some special features for
-        * non-obvious clients: (1) Javac compiler adapter supported in <code>setupAjc(AjcTask, Javac, File)</code> and
-        * <code>readArguments(String[])</code>; (2) testing is supported by (a) permitting the same specification to be re-run with
-        * added flags (settings once made cannot be removed); and (b) permitting recycling the task with <code>reset()</code>
-        * (untested).
-        * 
-        * The parts that do more than convert ant specs are (a) code for forking; (b) code for copying resources.
-        * 
-        * If you maintain/upgrade this task, keep in mind: (1) changes to the semantics of ajc (new options, new values permitted,
-        * etc.) will have to be reflected here. (2) the clients: the iajc ant script, Javac compiler adapter, maven clients of iajc,
-        * and testing code.
-        */
-
-       // XXX move static methods after static initializer
-       /**
-        * This method extracts javac arguments to ajc, and add arguments to make ajc behave more like javac in copying resources.
-        * <p>
-        * Pass ajc-specific options using compilerarg sub-element:
-        * 
-        * <pre>
-        * &lt;javac srcdir=&quot;src&quot;&gt;
-        *     &lt;compilerarg compiler=&quot;...&quot; line=&quot;-argfile src/args.lst&quot;/&gt;
-        * &lt;javac&gt;
-        * </pre>
-        * 
-        * Some javac arguments are not supported in this component (yet):
-        * 
-        * <pre>
-        * String memoryInitialSize;
-        * boolean includeAntRuntime = true;
-        * boolean includeJavaRuntime = false;
-        * </pre>
-        * 
-        * Other javac arguments are not supported in ajc 1.1:
-        * 
-        * <pre>
-        * boolean optimize;
-        * String forkedExecutable;
-        * FacadeTaskHelper facade;
-        * boolean depend;
-        * String debugLevel;
-        * Path compileSourcepath;
-        * </pre>
-        * 
-        * @param javac the Javac command to implement (not null)
-        * @param ajc the AjcTask to adapt (not null)
-        * @param destDir the File class destination directory (may be null)
-        * @return null if no error, or String error otherwise
-        */
-       public String setupAjc(Javac javac) {
-               if (null == javac) {
-                       return "null javac";
-               }
-               AjcTask ajc = this;
-               // no null checks b/c AjcTask handles null input gracefully
-               ajc.setProject(javac.getProject());
-               ajc.setLocation(javac.getLocation());
-               ajc.setTaskName("javac-iajc");
-               ajc.setDebug(javac.getDebug());
-               ajc.setDeprecation(javac.getDeprecation());
-               ajc.setFailonerror(javac.getFailonerror());
-               final boolean fork = javac.isForkedJavac();
-               ajc.setFork(fork);
-               if (fork) {
-                       ajc.setMaxmem(javac.getMemoryMaximumSize());
-               }
-               ajc.setNowarn(javac.getNowarn());
-               ajc.setListFileArgs(javac.getListfiles());
-               ajc.setVerbose(javac.getVerbose());
-               ajc.setTarget(javac.getTarget());
-               ajc.setSource(javac.getSource());
-               ajc.setEncoding(javac.getEncoding());
-               File javacDestDir = javac.getDestdir();
-               if (null != javacDestDir) {
-                       ajc.setDestdir(javacDestDir);
-                       // filter requires dest dir
-                       // mimic Javac task's behavior in copying resources,
-                       ajc.setSourceRootCopyFilter("**/CVS/*,**/*.java,**/*.aj");
-               }
-               ajc.setBootclasspath(javac.getBootclasspath());
-               ajc.setExtdirs(javac.getExtdirs());
-               ajc.setClasspath(javac.getClasspath());
-               // ignore srcDir -- all files picked up in recalculated file list
-               // ajc.setSrcDir(javac.getSrcdir());
-               ajc.addFiles(javac.getFileList());
-               // arguments can override the filter, add to paths, override options
-               ajc.readArguments(javac.getCurrentCompilerArgs());
-
-               return null;
-       }
-
-       /**
-        * Find aspectjtools.jar on the task or system classpath. Accept <code>aspectj{-}tools{...}.jar</code> mainly to support build
-        * systems using maven-style re-naming (e.g., <code>aspectj-tools-1.1.0.jar</code>. Note that we search the task classpath
-        * first, though an entry on the system classpath would be loaded first, because it seems more correct as the more specific one.
-        * 
-        * @return readable File for aspectjtools.jar, or null if not found.
-        */
-       public static File findAspectjtoolsJar() {
-               File result = null;
-               ClassLoader loader = AjcTask.class.getClassLoader();
-               if (loader instanceof AntClassLoader) {
-                       AntClassLoader taskLoader = (AntClassLoader) loader;
-                       String cp = taskLoader.getClasspath();
-                       String[] cps = LangUtil.splitClasspath(cp);
-                       for (int i = 0; (i < cps.length) && (null == result); i++) {
-                               result = isAspectjtoolsjar(cps[i]);
-                       }
-               }
-               if (null == result) {
-                       final Path classpath = Path.systemClasspath;
-                       final String[] paths = classpath.list();
-                       for (int i = 0; (i < paths.length) && (null == result); i++) {
-                               result = isAspectjtoolsjar(paths[i]);
-                       }
-               }
-               return (null == result ? null : result.getAbsoluteFile());
-       }
-
-       /** @return File if readable jar with aspectj tools name, or null */
-       private static File isAspectjtoolsjar(String path) {
-               if (null == path) {
-                       return null;
-               }
-               final String prefix = "aspectj";
-               final String infix = "tools";
-               final String altInfix = "-tools";
-               final String suffix = ".jar";
-               final int prefixLength = 7; // prefix.length();
-               final int minLength = 16;
-               // prefixLength + infix.length() + suffix.length();
-               if (!path.endsWith(suffix)) {
-                       return null;
-               }
-               int loc = path.lastIndexOf(prefix);
-               if ((-1 != loc) && ((loc + minLength) <= path.length())) {
-                       String rest = path.substring(loc + prefixLength);
-                       if (-1 != rest.indexOf(File.pathSeparator)) {
-                               return null;
-                       }
-                       if (rest.startsWith(infix) || rest.startsWith(altInfix)) {
-                               File result = new File(path);
-                               if (result.canRead() && result.isFile()) {
-                                       return result;
-                               }
-                       }
-               }
-               return null;
-       }
-
-       /**
-        * Maximum length (in chars) of command line before converting to an argfile when forking
-        */
-       private static final int MAX_COMMANDLINE = 4096;
-
-       private static final File DEFAULT_DESTDIR = new File(".") {
-               @Override
-               public String toString() {
-                       return "(no destination dir specified)";
-               }
-       };
-
-       /** do not throw BuildException on fail/abort message with usage */
-       private static final String USAGE_SUBSTRING = "AspectJ-specific options";
-
-       /** valid -X[...] options other than -Xlint variants */
-       private static final List VALID_XOPTIONS;
-
-       /** valid warning (-warn:[...]) variants */
-       private static final List VALID_WARNINGS;
-
-       /** valid debugging (-g:[...]) variants */
-       private static final List VALID_DEBUG;
-
-       /**
-        * -Xlint variants (error, warning, ignore)
-        * 
-        * @see org.aspectj.weaver.Lint
-        */
-       private static final List VALID_XLINT;
-
-       public static final String COMMAND_EDITOR_NAME = AjcTask.class.getName() + ".COMMAND_EDITOR";
-
-       static final String[] TARGET_INPUTS = new String[] { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11" };
-       static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11"};
-       static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", "-10", "-11" };
-
-       private static final ICommandEditor COMMAND_EDITOR;
-
-       static {
-               // many now deprecated: reweavable*
-               String[] xs = new String[] { "serializableAspects", "incrementalFile", "lazyTjp", "reweavable", "reweavable:compress",
-                               "notReweavable", "noInline", "terminateAfterCompilation", "hasMember", "ajruntimetarget:1.2",
-                               "ajruntimetarget:1.5", "addSerialVersionUID"
-
-               // , "targetNearSource", "OcodeSize",
-               };
-               VALID_XOPTIONS = Collections.unmodifiableList(Arrays.asList(xs));
-
-               xs = new String[] { "constructorName", "packageDefaultMethod", "deprecation", "maskedCatchBlocks", "unusedLocals",
-                               "unusedArguments", "unusedImports", "syntheticAccess", "assertIdentifier", "allDeprecation", "allJavadoc",
-                               "charConcat", "conditionAssign",
-
-                               "emptyBlock", "fieldHiding", "finally", "indirectStatic", "intfNonInherited", "javadoc", "localHiding", "nls",
-                               "noEffectAssign", "pkgDefaultMethod", "semicolon", "unqualifiedField", "unusedPrivate", "unusedThrown",
-                               "uselessTypeCheck", "specialParamHiding", "staticReceiver", "syntheticAccess", "none" };
-               VALID_WARNINGS = Collections.unmodifiableList(Arrays.asList(xs));
-
-               xs = new String[] { "none", "lines", "vars", "source" };
-               VALID_DEBUG = Collections.unmodifiableList(Arrays.asList(xs));
-
-               xs = new String[] { "error", "warning", "ignore" };
-               VALID_XLINT = Collections.unmodifiableList(Arrays.asList(xs));
-
-               ICommandEditor editor = null;
-               try {
-                       String editorClassName = System.getProperty(COMMAND_EDITOR_NAME);
-                       if (null != editorClassName) {
-                               ClassLoader cl = AjcTask.class.getClassLoader();
-                               Class editorClass = cl.loadClass(editorClassName);
-                               editor = (ICommandEditor) editorClass.newInstance();
-                       }
-               } catch (Throwable t) {
-                       System.err.println("Warning: unable to load command editor");
-                       t.printStackTrace(System.err);
-               }
-               COMMAND_EDITOR = editor;
-       }
-       // ---------------------------- state and Ant interface thereto
-       private boolean verbose;
-       private boolean timers;
-       private boolean listFileArgs;
-       private boolean failonerror;
-       private boolean fork;
-       private String maxMem;
-       private TaskLogger logger;
-
-       // ------- single entries dumped into cmd
-       protected GuardedCommand cmd;
-
-       // ------- lists resolved in addListArgs() at execute() time
-       private Path srcdir;
-       private Path injars;
-       private Path inpath;
-       private Path classpath;
-       private Path bootclasspath;
-       private Path forkclasspath;
-       private Path extdirs;
-       private Path aspectpath;
-       private Path argfiles;
-       private Path inxmlfiles;
-       private List ignored;
-       private Path sourceRoots;
-       private File xweaveDir;
-       private String xdoneSignal;
-
-       private List<CompilerArg> compilerArgs;
-       
-       // ----- added by adapter - integrate better?
-       private List /* File */adapterFiles;
-       private String[] adapterArguments;
-
-       private IMessageHolder messageHolder;
-       private ICommandEditor commandEditor;
-
-       // -------- resource-copying
-       /** true if copying injar non-.class files to the output jar */
-       private boolean copyInjars;
-       private boolean copyInpath;
-
-       /** non-null if copying all source root files but the filtered ones */
-       private String sourceRootCopyFilter;
-
-       /** non-null if copying all inpath dir files but the filtered ones */
-       private String inpathDirCopyFilter;
-
-       /** directory sink for classes */
-       private File destDir;
-
-       /** zip file sink for classes */
-       private File outjar;
-
-       /** track whether we've supplied any temp outjar */
-       private boolean outjarFixedup;
-
-       /**
-        * When possibly copying resources to the output jar, pass ajc a fake output jar to copy from, so we don't change the
-        * modification time of the output jar when copying injars/inpath into the actual outjar.
-        */
-       private File tmpOutjar;
-
-       private boolean executing;
-
-       /** non-null only while executing in same vm */
-       private Main main;
-
-       /** true only when executing in other vm */
-       private boolean executingInOtherVM;
-
-       /** true if -incremental */
-       private boolean inIncrementalMode;
-
-       /** true if -XincrementalFile (i.e, setTagFile) */
-       private boolean inIncrementalFileMode;
-
-       /** log command in non-verbose mode */
-       private boolean logCommand;
-
-       /** used when forking */
-       private CommandlineJava javaCmd = new CommandlineJava();
-
-       // also note MatchingTask grabs source files...
-
-       public AjcTask() {
-               reset();
-       }
-
-       /** to use this same Task more than once (testing) */
-       public void reset() { // XXX possible to reset MatchingTask?
-               // need declare for "all fields initialized in ..."
-               adapterArguments = null;
-               adapterFiles = new ArrayList();
-               compilerArgs = null;
-               argfiles = null;
-               inxmlfiles = null;
-               executing = false;
-               aspectpath = null;
-               bootclasspath = null;
-               classpath = null;
-               cmd = new GuardedCommand();
-               copyInjars = false;
-               copyInpath = false;
-               destDir = DEFAULT_DESTDIR;
-               executing = false;
-               executingInOtherVM = false;
-               extdirs = null;
-               failonerror = true; // non-standard default
-               forkclasspath = null;
-               inIncrementalMode = false;
-               inIncrementalFileMode = false;
-               ignored = new ArrayList();
-               injars = null;
-               inpath = null;
-               listFileArgs = false;
-               maxMem = null;
-               messageHolder = null;
-               outjar = null;
-               sourceRootCopyFilter = null;
-               inpathDirCopyFilter = null;
-               sourceRoots = null;
-               srcdir = null;
-               tmpOutjar = null;
-               verbose = false;
-               timers = false;
-               xweaveDir = null;
-               xdoneSignal = null;
-               logCommand = false;
-               javaCmd = new CommandlineJava();
-       }
-
-       protected void ignore(String ignored) {
-               this.ignored.add(ignored + " at " + getLocation());
-       }
-
-       // ---------------------- option values
-
-       // used by entries with internal commas
-       protected String validCommaList(String list, List valid, String label) {
-               return validCommaList(list, valid, label, valid.size());
-       }
-
-       protected String validCommaList(String list, List valid, String label, int max) {
-               StringBuffer result = new StringBuffer();
-               StringTokenizer st = new StringTokenizer(list, ",");
-               int num = 0;
-               while (st.hasMoreTokens()) {
-                       String token = st.nextToken().trim();
-                       num++;
-                       if (num > max) {
-                               ignore("too many entries for -" + label + ": " + token);
-                               break;
-                       }
-                       if (!valid.contains(token)) {
-                               ignore("bad commaList entry for -" + label + ": " + token);
-                       } else {
-                               if (0 < result.length()) {
-                                       result.append(",");
-                               }
-                               result.append(token);
-                       }
-               }
-               return (0 == result.length() ? null : result.toString());
-       }
-
-  /**
-   * Controls whether annotation processing and/or compilation is done.
-   * -proc:none means that compilation takes place without annotation processing.
-   * -proc:only means that only annotation processing is done, without any subsequent compilation.
-   */
-  public void setProc(String proc) {
-    if (proc.equals("none")) {
-      cmd.addFlag("-proc:none", true);
-    } else if (proc.equals("only")) {
-      cmd.addFlag("-proc:only", true);
-    }
-  }
-
-  /**
-   * -processor class1[,class2,class3...]
-   *  Names of the annotation processors to run. This bypasses the default discovery process.
-   */
-  public void setProcessor(String processors) {
-    cmd.addFlagged("-processor", processors);
-  }
-  
-  /**
-   * -processorpath path
-   * Specify where to find annotation processors; if this option is not used, the class path will be searched for processors.
-   */
-  public void setProcessorpath(String processorpath) {
-    cmd.addFlagged("-processorpath", processorpath);
-  }
-
-  /**
-   * -s dir
-   * Specify the directory where to place generated source files. The directory must already exist; javac will not create it.
-   * If a class is part of a package, the compiler puts the source file in a subdirectory reflecting the package name,
-   * creating directories as needed.
-   *
-   * For example, if you specify -s C:\mysrc and the class is called com.mypackage.MyClass,
-   * then the source file will be placed in C:\mysrc\com\mypackage\MyClass.java.
-   */
-  public void setS(String s) {
-    cmd.addFlagged("-s", s);
-  }
-
-       public void setIncremental(boolean incremental) {
-               cmd.addFlag("-incremental", incremental);
-               inIncrementalMode = incremental;
-       }
-
-       public void setLogCommand(boolean logCommand) {
-               this.logCommand = logCommand;
-       }
-
-       public void setHelp(boolean help) {
-               cmd.addFlag("-help", help);
-       }
-
-       public void setVersion(boolean version) {
-               cmd.addFlag("-version", version);
-       }
-
-       public void setXTerminateAfterCompilation(boolean b) {
-               cmd.addFlag("-XterminateAfterCompilation", b);
-       }
-
-       public void setXReweavable(boolean reweavable) {
-               cmd.addFlag("-Xreweavable", reweavable);
-       }
-
-       public void setXmlConfigured(boolean xmlConfigured) {
-               cmd.addFlag("-xmlConfigured", xmlConfigured);
-       }
-
-       public void setXJoinpoints(String optionalJoinpoints) {
-               cmd.addFlag("-Xjoinpoints:" + optionalJoinpoints, true);
-       }
-
-       public void setCheckRuntimeVersion(boolean b) {
-               cmd.addFlag("-checkRuntimeVersion:" + b, true);
-       }
-
-       public void setXNoWeave(boolean b) {
-               if (logger != null) {
-                       logger.warning("the noweave option is no longer required and is being ignored");
-               }
-       }
-
-       public void setNoWeave(boolean b) {
-               if (logger != null) {
-                       logger.warning("the noweave option is no longer required and is being ignored");
-               }
-       }
-
-       public void setXNotReweavable(boolean notReweavable) {
-               cmd.addFlag("-XnotReweavable", notReweavable);
-       }
-
-       public void setXaddSerialVersionUID(boolean addUID) {
-               cmd.addFlag("-XaddSerialVersionUID", addUID);
-       }
-
-       public void setXNoInline(boolean noInline) {
-               cmd.addFlag("-XnoInline", noInline);
-       }
-
-       public void setShowWeaveInfo(boolean showweaveinfo) {
-               cmd.addFlag("-showWeaveInfo", showweaveinfo);
-       }
-
-       public void setNowarn(boolean nowarn) {
-               cmd.addFlag("-nowarn", nowarn);
-       }
-
-       public void setDeprecation(boolean deprecation) {
-               cmd.addFlag("-deprecation", deprecation);
-       }
-
-       public void setWarn(String warnings) {
-               warnings = validCommaList(warnings, VALID_WARNINGS, "warn");
-               cmd.addFlag("-warn:" + warnings, (null != warnings));
-       }
-
-       public void setDebug(boolean debug) {
-               cmd.addFlag("-g", debug);
-       }
-
-       public void setDebugLevel(String level) {
-               level = validCommaList(level, VALID_DEBUG, "g");
-               cmd.addFlag("-g:" + level, (null != level));
-       }
-
-       public void setEmacssym(boolean emacssym) {
-               cmd.addFlag("-emacssym", emacssym);
-       }
-
-       public void setCrossrefs(boolean on) {
-               cmd.addFlag("-crossrefs", on);
-       }
-
-       /**
-        * -Xlint - set default level of -Xlint messages to warning (same as </code>-Xlint:warning</code>)
-        */
-       public void setXlintwarnings(boolean xlintwarnings) {
-               cmd.addFlag("-Xlint", xlintwarnings);
-       }
-
-       /**
-        * -Xlint:{error|warning|info} - set default level for -Xlint messages
-        * 
-        * @param xlint the String with one of error, warning, ignored
-        */
-       public void setXlint(String xlint) {
-               xlint = validCommaList(xlint, VALID_XLINT, "Xlint", 1);
-               cmd.addFlag("-Xlint:" + xlint, (null != xlint));
-       }
-
-       /**
-        * -Xlintfile {lint.properties} - enable or disable specific forms of -Xlint messages based on a lint properties file (default
-        * is <code>org/aspectj/weaver/XLintDefault.properties</code>)
-        * 
-        * @param xlintFile the File with lint properties
-        */
-       public void setXlintfile(File xlintFile) {
-               cmd.addFlagged("-Xlintfile", xlintFile.getAbsolutePath());
-       }
-
-       public void setPreserveAllLocals(boolean preserveAllLocals) {
-               cmd.addFlag("-preserveAllLocals", preserveAllLocals);
-       }
-
-       public void setNoImportError(boolean noImportError) {
-               cmd.addFlag("-warn:-unusedImport", noImportError);
-       }
-
-       public void setEncoding(String encoding) {
-               cmd.addFlagged("-encoding", encoding);
-       }
-
-       public void setLog(File file) {
-               cmd.addFlagged("-log", file.getAbsolutePath());
-       }
-
-       public void setProceedOnError(boolean proceedOnError) {
-               cmd.addFlag("-proceedOnError", proceedOnError);
-       }
-
-       public void setVerbose(boolean verbose) {
-               cmd.addFlag("-verbose", verbose);
-               this.verbose = verbose;
-       }
-
-       public void setTimers(boolean timers) {
-               cmd.addFlag("-timers", timers);
-               this.timers = timers;
-       }
-
-       public void setListFileArgs(boolean listFileArgs) {
-               this.listFileArgs = listFileArgs;
-       }
-
-       public void setReferenceInfo(boolean referenceInfo) {
-               cmd.addFlag("-referenceInfo", referenceInfo);
-       }
-
-       public void setTime(boolean time) {
-               cmd.addFlag("-time", time);
-       }
-
-       public void setNoExit(boolean noExit) {
-               cmd.addFlag("-noExit", noExit);
-       }
-
-       public void setFailonerror(boolean failonerror) {
-               this.failonerror = failonerror;
-       }
-
-       /**
-        * @return true if fork was set
-        */
-       public boolean isForked() {
-               return fork;
-       }
-
-       public void setFork(boolean fork) {
-               this.fork = fork;
-       }
-
-       public void setMaxmem(String maxMem) {
-               this.maxMem = maxMem;
-       }
-
-       /** support for nested &lt;jvmarg&gt; elements */
-       public Commandline.Argument createJvmarg() {
-               return this.javaCmd.createVmArgument();
-       }
-       
-       public static class CompilerArg {
-
-               private String value;
-               
-               public String getValue() {
-                       return value;
-               }
-               
-               public void setValue(String value) {
-                       this.value = value;
-               }
-               
-               @Override
-               public String toString() {
-                       return value;
-               }
-       }
-
-       public CompilerArg createCompilerarg() {
-                CompilerArg compilerArg = new CompilerArg();
-                if (compilerArgs == null) {
-                        compilerArgs = new ArrayList<CompilerArg>();
-                }
-                compilerArgs.add(compilerArg);
-                return compilerArg;
-       }
-
-       // ----------------
-       public void setTagFile(File file) {
-               inIncrementalMode = true;
-               cmd.addFlagged(Main.CommandController.TAG_FILE_OPTION, file.getAbsolutePath());
-               inIncrementalFileMode = true;
-       }
-
-       public void setOutjar(File file) {
-               if (DEFAULT_DESTDIR != destDir) {
-                       String e = "specifying both output jar (" + file + ") and destination dir (" + destDir + ")";
-                       throw new BuildException(e);
-               }
-               outjar = file;
-               outjarFixedup = false;
-               tmpOutjar = null;
-       }
-
-       public void setOutxml(boolean outxml) {
-               cmd.addFlag("-outxml", outxml);
-       }
-
-       public void setOutxmlfile(String name) {
-               cmd.addFlagged("-outxmlfile", name);
-       }
-
-       public void setDestdir(File dir) {
-               if (null != outjar) {
-                       String e = "specifying both output jar (" + outjar + ") and destination dir (" + dir + ")";
-                       throw new BuildException(e);
-               }
-               cmd.addFlagged("-d", dir.getAbsolutePath());
-               destDir = dir;
-       }
-
-       /**
-        * @param input a String in TARGET_INPUTS
-        */
-       public void setTarget(String input) {
-               String ignore = cmd.addOption("-target", TARGET_INPUTS, input);
-               if (null != ignore) {
-                       ignore(ignore);
-               }
-       }
-
-       /**
-        * Language compliance level. If not set explicitly, eclipse default holds.
-        * 
-        * @param input a String in COMPLIANCE_INPUTS
-        */
-       public void setCompliance(String input) {
-               String ignore = cmd.addOption(null, COMPLIANCE_INPUTS, input);
-               if (null != ignore) {
-                       ignore(ignore);
-               }
-       }
-
-       /**
-        * Source compliance level. If not set explicitly, eclipse default holds.
-        * 
-        * @param input a String in SOURCE_INPUTS
-        */
-       public void setSource(String input) {
-               String ignore = cmd.addOption("-source", SOURCE_INPUTS, input);
-               if (null != ignore) {
-                       ignore(ignore);
-               }
-       }
-       
-       public void setParameters(boolean b) {
-               cmd.addFlag("-parameters",b);
-       }
-
-       /**
-        * Flag to copy all non-.class contents of injars to outjar after compile completes. Requires both injars and outjar.
-        * 
-        * @param doCopy
-        */
-       public void setCopyInjars(boolean doCopy) {
-               ignore("copyInJars");
-               log("copyInjars not required since 1.1.1.\n", Project.MSG_WARN);
-               // this.copyInjars = doCopy;
-       }
-
-       /**
-        * Option to copy all files from all source root directories except those specified here. If this is specified and sourceroots
-        * are specified, then this will copy all files except those specified in the filter pattern. Requires sourceroots.
-        * 
-        * @param filter a String acceptable as an excludes filter for an Ant Zip fileset.
-        */
-       public void setSourceRootCopyFilter(String filter) {
-               this.sourceRootCopyFilter = filter;
-       }
-
-       /**
-        * Option to copy all files from all inpath directories except the files specified here. If this is specified and inpath
-        * directories are specified, then this will copy all files except those specified in the filter pattern. Requires inpath. If
-        * the input does not contain "**\/*.class", then this prepends it, to avoid overwriting woven classes with unwoven input.
-        * 
-        * @param filter a String acceptable as an excludes filter for an Ant Zip fileset.
-        */
-       public void setInpathDirCopyFilter(String filter) {
-               if (null != filter) {
-                       if (-1 == filter.indexOf("**/*.class")) {
-                               filter = "**/*.class," + filter;
-                       }
-               }
-               this.inpathDirCopyFilter = filter;
-       }
-
-       public void setX(String input) { // ajc-only eajc-also docDone
-               StringTokenizer tokens = new StringTokenizer(input, ",", false);
-               while (tokens.hasMoreTokens()) {
-                       String token = tokens.nextToken().trim();
-                       if (1 < token.length()) {
-                               // new special case: allow -Xset:anything
-                               if (VALID_XOPTIONS.contains(token) || token.indexOf("set:") == 0 || token.indexOf("joinpoints:") == 0) {
-                                       cmd.addFlag("-X" + token, true);
-                               } else {
-                                       ignore("-X" + token);
-                               }
-                       }
-               }
-       }
-
-       public void setXDoneSignal(String doneSignal) {
-               this.xdoneSignal = doneSignal;
-       }
-
-       /** direct API for testing */
-       public void setMessageHolder(IMessageHolder holder) {
-               this.messageHolder = holder;
-       }
-
-       /**
-        * Setup custom message handling.
-        * 
-        * @param className the String fully-qualified-name of a class reachable from this object's class loader, implementing
-        *        IMessageHolder, and having a public no-argument constructor.
-        * @throws BuildException if unable to create instance of className
-        */
-       public void setMessageHolderClass(String className) {
-               try {
-                       Class mclass = Class.forName(className);
-                       IMessageHolder holder = (IMessageHolder) mclass.newInstance();
-                       setMessageHolder(holder);
-               } catch (Throwable t) {
-                       String m = "unable to instantiate message holder: " + className;
-                       throw new BuildException(m, t);
-               }
-       }
-
-       /** direct API for testing */
-       public void setCommandEditor(ICommandEditor editor) {
-               this.commandEditor = editor;
-       }
-
-       /**
-        * Setup command-line filter. To do this staticly, define the environment variable
-        * <code>org.aspectj.tools.ant.taskdefs.AjcTask.COMMAND_EDITOR</code> with the <code>className</code> parameter.
-        * 
-        * @param className the String fully-qualified-name of a class reachable from this object's class loader, implementing
-        *        ICommandEditor, and having a public no-argument constructor.
-        * @throws BuildException if unable to create instance of className
-        */
-       public void setCommandEditorClass(String className) { // skip Ant interface?
-               try {
-                       Class mclass = Class.forName(className);
-                       setCommandEditor((ICommandEditor) mclass.newInstance());
-               } catch (Throwable t) {
-                       String m = "unable to instantiate command editor: " + className;
-                       throw new BuildException(m, t);
-               }
-       }
-
-       // ---------------------- Path lists
-
-       /**
-        * Add path elements to source path and return result. Elements are added even if they do not exist.
-        * 
-        * @param source the Path to add to - may be null
-        * @param toAdd the Path to add - may be null
-        * @return the (never-null) Path that results
-        */
-       protected Path incPath(Path source, Path toAdd) {
-               if (null == source) {
-                       source = new Path(project);
-               }
-               if (null != toAdd) {
-                       source.append(toAdd);
-               }
-               return source;
-       }
-
-       public void setSourcerootsref(Reference ref) {
-               createSourceRoots().setRefid(ref);
-       }
-
-       public void setSourceRoots(Path roots) {
-               sourceRoots = incPath(sourceRoots, roots);
-       }
-
-       public Path createSourceRoots() {
-               if (sourceRoots == null) {
-                       sourceRoots = new Path(project);
-               }
-               return sourceRoots.createPath();
-       }
-
-       public void setXWeaveDir(File file) {
-               if ((null != file) && file.isDirectory() && file.canRead()) {
-                       xweaveDir = file;
-               }
-       }
-
-       public void setInjarsref(Reference ref) {
-               createInjars().setRefid(ref);
-       }
-
-       public void setInpathref(Reference ref) {
-               createInpath().setRefid(ref);
-       }
-
-       public void setInjars(Path path) {
-               injars = incPath(injars, path);
-       }
-
-       public void setInpath(Path path) {
-               inpath = incPath(inpath, path);
-       }
-
-       public Path createInjars() {
-               if (injars == null) {
-                       injars = new Path(project);
-               }
-               return injars.createPath();
-       }
-
-       public Path createInpath() {
-               if (inpath == null) {
-                       inpath = new Path(project);
-               }
-               return inpath.createPath();
-       }
-
-       public void setClasspath(Path path) {
-               classpath = incPath(classpath, path);
-       }
-
-       public void setClasspathref(Reference classpathref) {
-               createClasspath().setRefid(classpathref);
-       }
-
-       public Path createClasspath() {
-               if (classpath == null) {
-                       classpath = new Path(project);
-               }
-               return classpath.createPath();
-       }
-
-       public void setBootclasspath(Path path) {
-               bootclasspath = incPath(bootclasspath, path);
-       }
-
-       public void setBootclasspathref(Reference bootclasspathref) {
-               createBootclasspath().setRefid(bootclasspathref);
-       }
-
-       public Path createBootclasspath() {
-               if (bootclasspath == null) {
-                       bootclasspath = new Path(project);
-               }
-               return bootclasspath.createPath();
-       }
-
-       public void setForkclasspath(Path path) {
-               forkclasspath = incPath(forkclasspath, path);
-       }
-
-       public void setForkclasspathref(Reference forkclasspathref) {
-               createForkclasspath().setRefid(forkclasspathref);
-       }
-
-       public Path createForkclasspath() {
-               if (forkclasspath == null) {
-                       forkclasspath = new Path(project);
-               }
-               return forkclasspath.createPath();
-       }
-
-       public void setExtdirs(Path path) {
-               extdirs = incPath(extdirs, path);
-       }
-
-       public void setExtdirsref(Reference ref) {
-               createExtdirs().setRefid(ref);
-       }
-
-       public Path createExtdirs() {
-               if (extdirs == null) {
-                       extdirs = new Path(project);
-               }
-               return extdirs.createPath();
-       }
-
-       public void setAspectpathref(Reference ref) {
-               createAspectpath().setRefid(ref);
-       }
-
-       public void setAspectpath(Path path) {
-               aspectpath = incPath(aspectpath, path);
-       }
-
-       public Path createAspectpath() {
-               if (aspectpath == null) {
-                       aspectpath = new Path(project);
-               }
-               return aspectpath.createPath();
-       }
-
-       public void setSrcDir(Path path) {
-               srcdir = incPath(srcdir, path);
-       }
-
-       public Path createSrc() {
-               return createSrcdir();
-       }
-
-       public Path createSrcdir() {
-               if (srcdir == null) {
-                       srcdir = new Path(project);
-               }
-               return srcdir.createPath();
-       }
-
-       /** @return true if in incremental mode (command-line or file) */
-       public boolean isInIncrementalMode() {
-               return inIncrementalMode;
-       }
-
-       /** @return true if in incremental file mode */
-       public boolean isInIncrementalFileMode() {
-               return inIncrementalFileMode;
-       }
-
-       public void setArgfilesref(Reference ref) {
-               createArgfiles().setRefid(ref);
-       }
-
-       public void setArgfiles(Path path) { // ajc-only eajc-also docDone
-               argfiles = incPath(argfiles, path);
-       }
-
-       public Path createArgfiles() {
-               if (argfiles == null) {
-                       argfiles = new Path(project);
-               }
-               return argfiles.createPath();
-       }
-
-       public void setInxmlref(Reference ref) {
-               createArgfiles().setRefid(ref);
-       }
-
-       public void setInxml(Path path) { // ajc-only eajc-also docDone
-               inxmlfiles = incPath(inxmlfiles, path);
-       }
-
-       public Path createInxml() {
-               if (inxmlfiles == null) {
-                       inxmlfiles = new Path(project);
-               }
-               return inxmlfiles.createPath();
-       }
-
-       // ------------------------------ run
-
-       /**
-        * Compile using ajc per settings.
-        * 
-        * @exception BuildException if the compilation has problems or if there were compiler errors and failonerror is true.
-        */
-       @Override
-       public void execute() throws BuildException {
-               this.logger = new TaskLogger(this);
-               if (executing) {
-                       throw new IllegalStateException("already executing");
-               } else {
-                       executing = true;
-               }
-               setupOptions();
-               verifyOptions();
-               try {
-                       String[] args = makeCommand();
-                       if (logCommand) {
-                               log("ajc " + Arrays.asList(args));
-                       } else {
-                               logVerbose("ajc " + Arrays.asList(args));
-                       }
-                       if (!fork) {
-                               executeInSameVM(args);
-                       } else { // when forking, Adapter handles failonerror
-                               executeInOtherVM(args);
-                       }
-               } catch (BuildException e) {
-                       throw e;
-               } catch (Throwable x) {
-                       this.logger.error(Main.renderExceptionForUser(x));
-                       throw new BuildException("IGNORE -- See " + LangUtil.unqualifiedClassName(x) + " rendered to ant logger");
-               } finally {
-                       executing = false;
-                       if (null != tmpOutjar) {
-                               tmpOutjar.delete();
-                       }
-               }
-       }
-
-       /**
-        * Halt processing. This tells main in the same vm to quit. It fails when running in forked mode.
-        * 
-        * @return true if not in forked mode and main has quit or been told to quit
-        */
-       public boolean quit() {
-               if (executingInOtherVM) {
-                       return false;
-               }
-               Main me = main;
-               if (null != me) {
-                       me.quit();
-               }
-               return true;
-       }
-
-       // package-private for testing
-       String[] makeCommand() {
-               ArrayList result = new ArrayList();
-               if (0 < ignored.size()) {
-                       for (Iterator iter = ignored.iterator(); iter.hasNext();) {
-                               logVerbose("ignored: " + iter.next());
-                       }
-               }
-               // when copying resources, use temp jar for class output
-               // then copy temp jar contents and resources to output jar
-               if ((null != outjar) && !outjarFixedup) {
-                       if (copyInjars || copyInpath || (null != sourceRootCopyFilter) || (null != inpathDirCopyFilter)) {
-                               String path = outjar.getAbsolutePath();
-                               int len = FileUtil.zipSuffixLength(path);
-                               path = path.substring(0, path.length() - len) + ".tmp.jar";
-                               tmpOutjar = new File(path);
-                       }
-                       if (null == tmpOutjar) {
-                               cmd.addFlagged("-outjar", outjar.getAbsolutePath());
-                       } else {
-                               cmd.addFlagged("-outjar", tmpOutjar.getAbsolutePath());
-                       }
-                       outjarFixedup = true;
-               }
-
-               result.addAll(cmd.extractArguments());
-               addListArgs(result);
-
-               String[] command = (String[]) result.toArray(new String[0]);
-               if (null != commandEditor) {
-                       command = commandEditor.editCommand(command);
-               } else if (null != COMMAND_EDITOR) {
-                       command = COMMAND_EDITOR.editCommand(command);
-               }
-               return command;
-       }
-
-       /**
-        * Create any pseudo-options required to implement some of the macro options
-        * 
-        * @throws BuildException if options conflict
-        */
-       protected void setupOptions() {
-               if (null != xweaveDir) {
-                       if (DEFAULT_DESTDIR != destDir) {
-                               throw new BuildException("weaveDir forces destdir");
-                       }
-                       if (null != outjar) {
-                               throw new BuildException("weaveDir forces outjar");
-                       }
-                       if (null != injars) {
-                               throw new BuildException("weaveDir incompatible with injars now");
-                       }
-                       if (null != inpath) {
-                               throw new BuildException("weaveDir incompatible with inpath now");
-                       }
-
-                       File injar = zipDirectory(xweaveDir);
-                       setInjars(new Path(getProject(), injar.getAbsolutePath()));
-                       setDestdir(xweaveDir);
-               }
-       }
-
-       protected File zipDirectory(File dir) {
-               File tempDir = new File(".");
-               try {
-                       tempDir = File.createTempFile("AjcTest", ".tmp");
-                       tempDir.mkdirs();
-                       tempDir.deleteOnExit(); // XXX remove zip explicitly..
-               } catch (IOException e) {
-                       // ignore
-               }
-               // File result = new File(tempDir,
-               String filename = "AjcTask-" + System.currentTimeMillis() + ".zip";
-               File result = new File(filename);
-               Zip zip = new Zip();
-               zip.setProject(getProject());
-               zip.setDestFile(result);
-               zip.setTaskName(getTaskName() + " - zip");
-               FileSet fileset = new FileSet();
-               fileset.setDir(dir);
-               zip.addFileset(fileset);
-               zip.execute();
-               Delete delete = new Delete();
-               delete.setProject(getProject());
-               delete.setTaskName(getTaskName() + " - delete");
-               delete.setDir(dir);
-               delete.execute();
-               Mkdir mkdir = new Mkdir();
-               mkdir.setProject(getProject());
-               mkdir.setTaskName(getTaskName() + " - mkdir");
-               mkdir.setDir(dir);
-               mkdir.execute();
-               return result;
-       }
-
-       /**
-        * @throw BuildException if options conflict
-        */
-       protected void verifyOptions() {
-               StringBuffer sb = new StringBuffer();
-               if (fork && isInIncrementalMode() && !isInIncrementalFileMode()) {
-                       sb.append("can fork incremental only using tag file.\n");
-               }
-               if (((null != inpathDirCopyFilter) || (null != sourceRootCopyFilter)) && (null == outjar) && (DEFAULT_DESTDIR == destDir)) {
-                       final String REQ = " requires dest dir or output jar.\n";
-                       if (null == inpathDirCopyFilter) {
-                               sb.append("sourceRootCopyFilter");
-                       } else if (null == sourceRootCopyFilter) {
-                               sb.append("inpathDirCopyFilter");
-                       } else {
-                               sb.append("sourceRootCopyFilter and inpathDirCopyFilter");
-                       }
-                       sb.append(REQ);
-               }
-               if (0 < sb.length()) {
-                       throw new BuildException(sb.toString());
-               }
-       }
-
-       /**
-        * Run the compile in the same VM by loading the compiler (Main), setting up any message holders, doing the compile, and
-        * converting abort/failure and error messages to BuildException, as appropriate.
-        * 
-        * @throws BuildException if abort or failure messages or if errors and failonerror.
-        * 
-        */
-       protected void executeInSameVM(String[] args) {
-               if (null != maxMem) {
-                       log("maxMem ignored unless forked: " + maxMem, Project.MSG_WARN);
-               }
-               IMessageHolder holder = messageHolder;
-               int numPreviousErrors;
-               if (null == holder) {
-                       MessageHandler mhandler = new MessageHandler(true);
-                       final IMessageHandler delegate;
-                       delegate = new AntMessageHandler(this.logger, this.verbose, false);
-                       mhandler.setInterceptor(delegate);
-                       holder = mhandler;
-                       numPreviousErrors = 0;
-               } else {
-                       numPreviousErrors = holder.numMessages(IMessage.ERROR, true);
-               }
-               {
-                       Main newmain = new Main();
-                       newmain.setHolder(holder);
-                       newmain.setCompletionRunner(new Runnable() {
-                               @Override
-                               public void run() {
-                                       doCompletionTasks();
-                               }
-                       });
-                       if (null != main) {
-                               MessageUtil.fail(holder, "still running prior main");
-                               return;
-                       }
-                       main = newmain;
-               }
-               main.runMain(args, false);
-               if (failonerror) {
-                       int errs = holder.numMessages(IMessage.ERROR, false);
-                       errs -= numPreviousErrors;
-                       if (0 < errs) {
-                               String m = errs + " errors";
-                               MessageUtil.print(System.err, holder, "", MessageUtil.MESSAGE_ALL, MessageUtil.PICK_ERROR, true);
-                               throw new BuildException(m);
-                       }
-               }
-               // Throw BuildException if there are any fail or abort
-               // messages.
-               // The BuildException message text has a list of class names
-               // for the exceptions found in the messages, or the
-               // number of fail/abort messages found if there were
-               // no exceptions for any of the fail/abort messages.
-               // The interceptor message handler should have already
-               // printed the messages, including any stack traces.
-               // HACK: this ignores the Usage message
-               {
-                       IMessage[] fails = holder.getMessages(IMessage.FAIL, true);
-                       if (!LangUtil.isEmpty(fails)) {
-                               StringBuffer sb = new StringBuffer();
-                               String prefix = "fail due to ";
-                               int numThrown = 0;
-                               for (int i = 0; i < fails.length; i++) {
-                                       String message = fails[i].getMessage();
-                                       if (LangUtil.isEmpty(message)) {
-                                               message = "<no message>";
-                                       } else if (-1 != message.indexOf(USAGE_SUBSTRING)) {
-                                               continue;
-                                       }
-                                       Throwable t = fails[i].getThrown();
-                                       if (null != t) {
-                                               numThrown++;
-                                               sb.append(prefix);
-                                               sb.append(LangUtil.unqualifiedClassName(t.getClass()));
-                                               String thrownMessage = t.getMessage();
-                                               if (!LangUtil.isEmpty(thrownMessage)) {
-                                                       sb.append(" \"" + thrownMessage + "\"");
-                                               }
-                                       }
-                                       sb.append("\"" + message + "\"");
-                                       prefix = ", ";
-                               }
-                               if (0 < sb.length()) {
-                                       sb.append(" (" + numThrown + " exceptions)");
-                                       throw new BuildException(sb.toString());
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Execute in a separate VM. Differences from normal same-VM execution:
-        * <ul>
-        * <li>ignores any message holder {class} set</li>
-        * <li>No resource-copying between interative runs</li>
-        * <li>failonerror fails when process interface fails to return negative values</li>
-        * </ul>
-        * 
-        * @param args String[] of the complete compiler command to execute
-        * 
-        * @see DefaultCompilerAdapter#executeExternalCompile(String[], int)
-        * @throws BuildException if ajc aborts (negative value) or if failonerror and there were compile errors.
-        */
-       protected void executeInOtherVM(String[] args) {
-               javaCmd.setClassname(org.aspectj.tools.ajc.Main.class.getName());
-
-               final Path vmClasspath = javaCmd.createClasspath(getProject());
-               {
-                       File aspectjtools = null;
-                       int vmClasspathSize = vmClasspath.size();
-                       if ((null != forkclasspath) && (0 != forkclasspath.size())) {
-                               vmClasspath.addExisting(forkclasspath);
-                       } else {
-                               aspectjtools = findAspectjtoolsJar();
-                               if (null != aspectjtools) {
-                                       vmClasspath.createPathElement().setLocation(aspectjtools);
-                               }
-                       }
-                       int newVmClasspathSize = vmClasspath.size();
-                       if (vmClasspathSize == newVmClasspathSize) {
-                               String m = "unable to find aspectjtools to fork - ";
-                               if (null != aspectjtools) {
-                                       m += "tried " + aspectjtools.toString();
-                               } else if (null != forkclasspath) {
-                                       m += "tried " + forkclasspath.toString();
-                               } else {
-                                       m += "define forkclasspath or put aspectjtools on classpath";
-                               }
-                               throw new BuildException(m);
-                       }
-               }
-               if (null != maxMem) {
-                       javaCmd.setMaxmemory(maxMem);
-               }
-               File tempFile = null;
-               int numArgs = args.length;
-               args = GuardedCommand.limitTo(args, MAX_COMMANDLINE, getLocation());
-
-               if (args.length != numArgs) {
-                       tempFile = new File(args[1]);
-               }
-               try {
-                       boolean setMessageHolderOnForking = (this.messageHolder != null);
-                       String[] javaArgs = javaCmd.getCommandline();
-                       String[] both = new String[javaArgs.length + args.length + (setMessageHolderOnForking ? 2 : 0)];
-                       System.arraycopy(javaArgs, 0, both, 0, javaArgs.length);
-                       System.arraycopy(args, 0, both, javaArgs.length, args.length);
-                       if (setMessageHolderOnForking) {
-                               both[both.length - 2] = "-messageHolder";
-                               both[both.length - 1] = this.messageHolder.getClass().getName();
-                       }
-                       // try to use javaw instead on windows
-                       if (both[0].endsWith("java.exe")) {
-                               String path = both[0];
-                               path = path.substring(0, path.length() - 4);
-                               path = path + "w.exe";
-                               File javaw = new File(path);
-                               if (javaw.canRead() && javaw.isFile()) {
-                                       both[0] = path;
-                               }
-                       }
-                       logVerbose("forking " + Arrays.asList(both));
-                       int result = execInOtherVM(both);
-                       if (0 > result) {
-                               throw new BuildException("failure[" + result + "] running ajc");
-                       } else if (failonerror && (0 < result)) {
-                               throw new BuildException("compile errors: " + result);
-                       }
-                       // when forking, do completion only at end and when successful
-                       doCompletionTasks();
-               } finally {
-                       if (null != tempFile) {
-                               tempFile.delete();
-                       }
-               }
-       }
-
-       /**
-        * Execute in another process using the same JDK and the base directory of the project. XXX correct?
-        */
-       protected int execInOtherVM(String[] args) {
-               try {
-
-                       Project project = getProject();
-                       PumpStreamHandler handler = new LogStreamHandler(this, verbose ? Project.MSG_VERBOSE : Project.MSG_INFO,
-                                       Project.MSG_WARN);
-
-                       // replace above two lines with what follows as an aid to debugging when running the unit tests....
-//                     LogStreamHandler handler = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN) {
-//
-//                             ByteArrayOutputStream baos = new ByteArrayOutputStream();
-//
-//                             /*
-//                              * @see
-//                              * org.apache.tools.ant.taskdefs.PumpStreamHandler#createProcessOutputPump(java.
-//                              * io.InputStream, java.io.OutputStream)
-//                              */
-//                             protected void createProcessErrorPump(InputStream is, OutputStream os) {
-//                                     super.createProcessErrorPump(is, baos);
-//                             }
-//
-//                             /*
-//                              * @see org.apache.tools.ant.taskdefs.LogStreamHandler#stop()
-//                              */
-//                             public void stop() {
-//                                     byte[] written = baos.toByteArray();
-//                                     System.err.print(new String(written));
-//                                     super.stop();
-//                             }
-//                     };
-
-                       Execute exe = new Execute(handler);
-                       exe.setAntRun(project);
-                       exe.setWorkingDirectory(project.getBaseDir());
-                       exe.setCommandline(args);
-                       try {
-                               if (executingInOtherVM) {
-                                       String s = "already running in other vm?";
-                                       throw new BuildException(s, location);
-                               }
-                               executingInOtherVM = true;
-                               exe.execute();
-                       } finally {
-                               executingInOtherVM = false;
-                       }
-                       return exe.getExitValue();
-               } catch (IOException e) {
-                       String m = "Error executing command " + Arrays.asList(args);
-                       throw new BuildException(m, e, location);
-               }
-       }
-
-       // ------------------------------ setup and reporting
-       /** @return null if path null or empty, String rendition otherwise */
-       protected static void addFlaggedPath(String flag, Path path, List<String> list) {
-               if (!LangUtil.isEmpty(flag) && ((null != path) && (0 < path.size()))) {
-                       list.add(flag);
-                       list.add(path.toString());
-               }
-       }
-
-       /**
-        * Add to list any path or plural arguments.
-        */
-       protected void addListArgs(List<String> list) throws BuildException {
-               addFlaggedPath("-classpath", classpath, list);
-               addFlaggedPath("-bootclasspath", bootclasspath, list);
-               addFlaggedPath("-extdirs", extdirs, list);
-               addFlaggedPath("-aspectpath", aspectpath, list);
-               addFlaggedPath("-injars", injars, list);
-               addFlaggedPath("-inpath", inpath, list);
-               addFlaggedPath("-sourceroots", sourceRoots, list);
-               
-               if (this.compilerArgs != null) {
-                       for (CompilerArg compilerArg:compilerArgs) {
-                               list.add(compilerArg.toString());
-                       }
-               }
-
-               if (argfiles != null) {
-                       String[] files = argfiles.list();
-                       for (int i = 0; i < files.length; i++) {
-                               File argfile = project.resolveFile(files[i]);
-                               if (check(argfile, files[i], false, location)) {
-                                       list.add("-argfile");
-                                       list.add(argfile.getAbsolutePath());
-                               }
-                       }
-               }
-               if (inxmlfiles != null) {
-                       String[] files = inxmlfiles.list();
-                       for (int i = 0; i < files.length; i++) {
-                               File inxmlfile = project.resolveFile(files[i]);
-                               if (check(inxmlfile, files[i], false, location)) {
-                                       list.add("-xmlConfigured");
-                                       list.add(inxmlfile.getAbsolutePath());
-                               }
-                       }
-               }
-               if (srcdir != null) {
-                       // todo: ignore any srcdir if any argfiles and no explicit includes
-                       String[] dirs = srcdir.list();
-                       for (int i = 0; i < dirs.length; i++) {
-                               File dir = project.resolveFile(dirs[i]);
-                               check(dir, dirs[i], true, location);
-                               // relies on compiler to prune non-source files
-                               String[] files = getDirectoryScanner(dir).getIncludedFiles();
-                               for (int j = 0; j < files.length; j++) {
-                                       File file = new File(dir, files[j]);
-                                       if (FileUtil.hasSourceSuffix(file)) {
-                                               if (!list.contains(file.getAbsolutePath())) {
-                                                       list.add(file.getAbsolutePath());
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (0 < adapterFiles.size()) {
-                       for (Iterator iter = adapterFiles.iterator(); iter.hasNext();) {
-                               File file = (File) iter.next();
-                               if (file.canRead() && FileUtil.hasSourceSuffix(file)) {
-                                       list.add(file.getAbsolutePath());
-                               } else {
-                                       this.logger.warning("skipping file: " + file);
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Throw BuildException unless file is valid.
-        * 
-        * @param file the File to check
-        * @param name the symbolic name to print on error
-        * @param isDir if true, verify file is a directory
-        * @param loc the Location used to create sensible BuildException
-        * @return
-        * @throws BuildException unless file valid
-        */
-       protected final boolean check(File file, String name, boolean isDir, Location loc) {
-               loc = loc != null ? loc : location;
-               if (file == null) {
-                       throw new BuildException(name + " is null!", loc);
-               }
-               if (!file.exists()) {
-                       throw new BuildException(file + " doesn't exist!", loc);
-               }
-               if (isDir ^ file.isDirectory()) {
-                       String e = file + " should" + (isDir ? "" : "n't") + " be a directory!";
-                       throw new BuildException(e, loc);
-               }
-               return true;
-       }
-
-       /**
-        * Called when compile or incremental compile is completing, this completes the output jar or directory by copying resources if
-        * requested. Note: this is a callback run synchronously by the compiler. That means exceptions thrown here are caught by
-        * Main.run(..) and passed to the message handler.
-        */
-       protected void doCompletionTasks() {
-               if (!executing) {
-                       throw new IllegalStateException("should be executing");
-               }
-               if (null != outjar) {
-                       completeOutjar();
-               } else {
-                       completeDestdir();
-               }
-               if (null != xdoneSignal) {
-                       MessageUtil.info(messageHolder, xdoneSignal);
-               }
-       }
-
-       /**
-        * Complete the destination directory by copying resources from the source root directories (if the filter is specified) and
-        * non-.class files from the input jars (if XCopyInjars is enabled).
-        */
-       private void completeDestdir() {
-               if (!copyInjars && (null == sourceRootCopyFilter) && (null == inpathDirCopyFilter)) {
-                       return;
-               } else if ((destDir == DEFAULT_DESTDIR) || !destDir.canWrite()) {
-                       String s = "unable to copy resources to destDir: " + destDir;
-                       throw new BuildException(s);
-               }
-               final Project project = getProject();
-               if (copyInjars) { // XXXX remove as unused since 1.1.1
-                       if (null != inpath) {
-                               log("copyInjars does not support inpath.\n", Project.MSG_WARN);
-                       }
-                       String taskName = getTaskName() + " - unzip";
-                       String[] paths = injars.list();
-                       if (!LangUtil.isEmpty(paths)) {
-                               PatternSet patternSet = new PatternSet();
-                               patternSet.setProject(project);
-                               patternSet.setIncludes("**/*");
-                               patternSet.setExcludes("**/*.class");
-                               for (int i = 0; i < paths.length; i++) {
-                                       Expand unzip = new Expand();
-                                       unzip.setProject(project);
-                                       unzip.setTaskName(taskName);
-                                       unzip.setDest(destDir);
-                                       unzip.setSrc(new File(paths[i]));
-                                       unzip.addPatternset(patternSet);
-                                       unzip.execute();
-                               }
-                       }
-               }
-               if ((null != sourceRootCopyFilter) && (null != sourceRoots)) {
-                       String[] paths = sourceRoots.list();
-                       if (!LangUtil.isEmpty(paths)) {
-                               Copy copy = new Copy();
-                               copy.setProject(project);
-                               copy.setTodir(destDir);
-                               for (int i = 0; i < paths.length; i++) {
-                                       FileSet fileSet = new FileSet();
-                                       fileSet.setDir(new File(paths[i]));
-                                       fileSet.setIncludes("**/*");
-                                       fileSet.setExcludes(sourceRootCopyFilter);
-                                       copy.addFileset(fileSet);
-                               }
-                               copy.execute();
-                       }
-               }
-               if ((null != inpathDirCopyFilter) && (null != inpath)) {
-                       String[] paths = inpath.list();
-                       if (!LangUtil.isEmpty(paths)) {
-                               Copy copy = new Copy();
-                               copy.setProject(project);
-                               copy.setTodir(destDir);
-                               boolean gotDir = false;
-                               for (int i = 0; i < paths.length; i++) {
-                                       File inpathDir = new File(paths[i]);
-                                       if (inpathDir.isDirectory() && inpathDir.canRead()) {
-                                               if (!gotDir) {
-                                                       gotDir = true;
-                                               }
-                                               FileSet fileSet = new FileSet();
-                                               fileSet.setDir(inpathDir);
-                                               fileSet.setIncludes("**/*");
-                                               fileSet.setExcludes(inpathDirCopyFilter);
-                                               copy.addFileset(fileSet);
-                                       }
-                               }
-                               if (gotDir) {
-                                       copy.execute();
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Complete the output jar by copying resources from the source root directories if the filter is specified. and non-.class
-        * files from the input jars if enabled.
-        */
-       private void completeOutjar() {
-               if (((null == tmpOutjar) || !tmpOutjar.canRead())
-                               || (!copyInjars && (null == sourceRootCopyFilter) && (null == inpathDirCopyFilter))) {
-                       return;
-               }
-               Zip zip = new Zip();
-               Project project = getProject();
-               zip.setProject(project);
-               zip.setTaskName(getTaskName() + " - zip");
-               zip.setDestFile(outjar);
-               ZipFileSet zipfileset = new ZipFileSet();
-               zipfileset.setProject(project);
-               zipfileset.setSrc(tmpOutjar);
-               zipfileset.setIncludes("**/*.class");
-               zip.addZipfileset(zipfileset);
-               if (copyInjars) {
-                       String[] paths = injars.list();
-                       if (!LangUtil.isEmpty(paths)) {
-                               for (int i = 0; i < paths.length; i++) {
-                                       File jarFile = new File(paths[i]);
-                                       zipfileset = new ZipFileSet();
-                                       zipfileset.setProject(project);
-                                       zipfileset.setSrc(jarFile);
-                                       zipfileset.setIncludes("**/*");
-                                       zipfileset.setExcludes("**/*.class");
-                                       zip.addZipfileset(zipfileset);
-                               }
-                       }
-               }
-               if ((null != sourceRootCopyFilter) && (null != sourceRoots)) {
-                       String[] paths = sourceRoots.list();
-                       if (!LangUtil.isEmpty(paths)) {
-                               for (int i = 0; i < paths.length; i++) {
-                                       File srcRoot = new File(paths[i]);
-                                       FileSet fileset = new FileSet();
-                                       fileset.setProject(project);
-                                       fileset.setDir(srcRoot);
-                                       fileset.setIncludes("**/*");
-                                       fileset.setExcludes(sourceRootCopyFilter);
-                                       zip.addFileset(fileset);
-                               }
-                       }
-               }
-               if ((null != inpathDirCopyFilter) && (null != inpath)) {
-                       String[] paths = inpath.list();
-                       if (!LangUtil.isEmpty(paths)) {
-                               for (int i = 0; i < paths.length; i++) {
-                                       File inpathDir = new File(paths[i]);
-                                       if (inpathDir.isDirectory() && inpathDir.canRead()) {
-                                               FileSet fileset = new FileSet();
-                                               fileset.setProject(project);
-                                               fileset.setDir(inpathDir);
-                                               fileset.setIncludes("**/*");
-                                               fileset.setExcludes(inpathDirCopyFilter);
-                                               zip.addFileset(fileset);
-                                       }
-                               }
-                       }
-               }
-               zip.execute();
-       }
-
-       // -------------------------- compiler adapter interface extras
-
-       /**
-        * Add specified source files.
-        */
-       void addFiles(File[] paths) {
-               for (int i = 0; i < paths.length; i++) {
-                       addFile(paths[i]);
-               }
-       }
-
-       /**
-        * Add specified source file.
-        */
-       void addFile(File path) {
-               if (null != path) {
-                       adapterFiles.add(path);
-               }
-       }
-
-       /**
-        * Read arguments in as if from a command line, mainly to support compiler adapter compilerarg subelement.
-        * 
-        * @param args the String[] of arguments to read
-        */
-       public void readArguments(String[] args) { // XXX slow, stupid, unmaintainable
-               if ((null == args) || (0 == args.length)) {
-                       return;
-               }
-               /** String[] wrapper with increment, error reporting */
-               class Args {
-                       final String[] args;
-                       int index = 0;
-
-                       Args(String[] args) {
-                               this.args = args; // not null or empty
-                       }
-
-                       boolean hasNext() {
-                               return index < args.length;
-                       }
-
-                       String next() {
-                               String err = null;
-                               if (!hasNext()) {
-                                       err = "need arg for flag " + args[args.length - 1];
-                               } else {
-                                       String s = args[index++];
-                                       if (null == s) {
-                                               err = "null value";
-                                       } else {
-                                               s = s.trim();
-                                               if (0 == s.trim().length()) {
-                                                       err = "no value";
-                                               } else {
-                                                       return s;
-                                               }
-                                       }
-                               }
-                               err += " at [" + index + "] of " + Arrays.asList(args);
-                               throw new BuildException(err);
-                       }
-               } // class Args
-
-               Args in = new Args(args);
-               String flag;
-               while (in.hasNext()) {
-                       flag = in.next();
-                       if ("-1.3".equals(flag)) {
-                               setCompliance(flag);
-                       } else if ("-1.4".equals(flag)) {
-                               setCompliance(flag);
-                       } else if ("-1.5".equals(flag)) {
-                               setCompliance("1.5");
-                       } else if ("-argfile".equals(flag)) {
-                               setArgfiles(new Path(project, in.next()));
-                       } else if ("-aspectpath".equals(flag)) {
-                               setAspectpath(new Path(project, in.next()));
-                       } else if ("-classpath".equals(flag)) {
-                               setClasspath(new Path(project, in.next()));
-                       } else if ("-extdirs".equals(flag)) {
-                               setExtdirs(new Path(project, in.next()));
-                       } else if ("-Xcopyinjars".equals(flag)) {
-                               setCopyInjars(true); // ignored - will be flagged by setter
-                       } else if ("-g".equals(flag)) {
-                               setDebug(true);
-                       } else if (flag.startsWith("-g:")) {
-                               setDebugLevel(flag.substring(2));
-                       } else if ("-deprecation".equals(flag)) {
-                               setDeprecation(true);
-                       } else if ("-d".equals(flag)) {
-                               setDestdir(new File(in.next()));
-                       } else if ("-crossrefs".equals(flag)) {
-                               setCrossrefs(true);
-                       } else if ("-emacssym".equals(flag)) {
-                               setEmacssym(true);
-                       } else if ("-encoding".equals(flag)) {
-                               setEncoding(in.next());
-                       } else if ("-Xfailonerror".equals(flag)) {
-                               setFailonerror(true);
-                       } else if ("-fork".equals(flag)) {
-                               setFork(true);
-                       } else if ("-forkclasspath".equals(flag)) {
-                               setForkclasspath(new Path(project, in.next()));
-                       } else if ("-help".equals(flag)) {
-                               setHelp(true);
-                       } else if ("-incremental".equals(flag)) {
-                               setIncremental(true);
-                       } else if ("-injars".equals(flag)) {
-                               setInjars(new Path(project, in.next()));
-                       } else if ("-inpath".equals(flag)) {
-                               setInpath(new Path(project, in.next()));
-                       } else if ("-Xlistfileargs".equals(flag)) {
-                               setListFileArgs(true);
-                       } else if ("-Xmaxmem".equals(flag)) {
-                               setMaxmem(in.next());
-                       } else if ("-Xmessageholderclass".equals(flag)) {
-                               setMessageHolderClass(in.next());
-                       } else if ("-noexit".equals(flag)) {
-                               setNoExit(true);
-                       } else if ("-noimport".equals(flag)) {
-                               setNoExit(true);
-                       } else if ("-noExit".equals(flag)) {
-                               setNoExit(true);
-                       } else if ("-noImportError".equals(flag)) {
-                               setNoImportError(true);
-                       } else if ("-noWarn".equals(flag)) {
-                               setNowarn(true);
-                       } else if ("-noexit".equals(flag)) {
-                               setNoExit(true);
-                       } else if ("-outjar".equals(flag)) {
-                               setOutjar(new File(in.next()));
-                       } else if ("-outxml".equals(flag)) {
-                               setOutxml(true);
-                       } else if ("-outxmlfile".equals(flag)) {
-                               setOutxmlfile(in.next());
-                       } else if ("-preserveAllLocals".equals(flag)) {
-                               setPreserveAllLocals(true);
-                       } else if ("-proceedOnError".equals(flag)) {
-                               setProceedOnError(true);
-                       } else if ("-referenceInfo".equals(flag)) {
-                               setReferenceInfo(true);
-                       } else if ("-source".equals(flag)) {
-                               setSource(in.next());
-                       } else if ("-Xsourcerootcopyfilter".equals(flag)) {
-                               setSourceRootCopyFilter(in.next());
-                       } else if ("-sourceroots".equals(flag)) {
-                               setSourceRoots(new Path(project, in.next()));
-                       } else if ("-Xsrcdir".equals(flag)) {
-                               setSrcDir(new Path(project, in.next()));
-                       } else if ("-Xtagfile".equals(flag)) {
-                               setTagFile(new File(in.next()));
-                       } else if ("-target".equals(flag)) {
-                               setTarget(in.next());
-                       } else if ("-time".equals(flag)) {
-                               setTime(true);
-                       } else if ("-time".equals(flag)) {
-                               setTime(true);
-                       } else if ("-verbose".equals(flag)) {
-                               setVerbose(true);
-                       } else if ("-showWeaveInfo".equals(flag)) {
-                               setShowWeaveInfo(true);
-                       } else if ("-version".equals(flag)) {
-                               setVersion(true);
-                       } else if ("-warn".equals(flag)) {
-                               setWarn(in.next());
-                       } else if (flag.startsWith("-warn:")) {
-                               setWarn(flag.substring(6));
-                       } else if ("-Xlint".equals(flag)) {
-                               setXlintwarnings(true);
-                       } else if (flag.startsWith("-Xlint:")) {
-                               setXlint(flag.substring(7));
-                       } else if ("-Xlintfile".equals(flag)) {
-                               setXlintfile(new File(in.next()));
-                       } else if ("-XterminateAfterCompilation".equals(flag)) {
-                               setXTerminateAfterCompilation(true);
-                       } else if ("-Xreweavable".equals(flag)) {
-                               setXReweavable(true);
-                       } else if ("-XnotReweavable".equals(flag)) {
-                               setXNotReweavable(true);
-                       } else if (flag.startsWith("@")) {
-                               File file = new File(flag.substring(1));
-                               if (file.canRead()) {
-                                       setArgfiles(new Path(project, file.getPath()));
-                               } else {
-                                       ignore(flag);
-                               }
-                       } else {
-                               File file = new File(flag);
-                               if (file.isFile() && file.canRead() && FileUtil.hasSourceSuffix(file)) {
-                                       addFile(file);
-                               } else {
-                                       ignore(flag);
-                               }
-                       }
-               }
-
-       }
-
-       protected void logVerbose(String text) {
-               if (this.verbose) {
-                       this.logger.info(text);
-               } else {
-                       this.logger.verbose(text);
-               }
-       }
-
-       /**
-        * Commandline wrapper that only permits addition of non-empty values and converts to argfile form if necessary.
-        */
-       public static class GuardedCommand {
-               Commandline command;
-
-               // int size;
-
-               static boolean isEmpty(String s) {
-                       return ((null == s) || (0 == s.trim().length()));
-               }
-
-               GuardedCommand() {
-                       command = new Commandline();
-               }
-
-               void addFlag(String flag, boolean doAdd) {
-                       if (doAdd && !isEmpty(flag)) {
-                               command.createArgument().setValue(flag);
-                               // size += 1 + flag.length();
-                       }
-               }
-
-               /** @return null if added or ignoreString otherwise */
-               String addOption(String prefix, String[] validOptions, String input) {
-                       if (isEmpty(input)) {
-                               return null;
-                       }
-                       for (int i = 0; i < validOptions.length; i++) {
-                               if (input.equals(validOptions[i])) {
-                                       if (isEmpty(prefix)) {
-                                               addFlag(input, true);
-                                       } else {
-                                               addFlagged(prefix, input);
-                                       }
-                                       return null;
-                               }
-                       }
-                       return (null == prefix ? input : prefix + " " + input);
-               }
-
-               void addFlagged(String flag, String argument) {
-                       if (!isEmpty(flag) && !isEmpty(argument)) {
-                               command.addArguments(new String[] { flag, argument });
-                               // size += 1 + flag.length() + argument.length();
-                       }
-               }
-
-               // private void addFile(File file) {
-               // if (null != file) {
-               // String path = file.getAbsolutePath();
-               // addFlag(path, true);
-               // }
-               // }
-
-               List extractArguments() {
-                       ArrayList result = new ArrayList();
-                       String[] cmds = command.getArguments();
-                       if (!LangUtil.isEmpty(cmds)) {
-                               result.addAll(Arrays.asList(cmds));
-                       }
-                       return result;
-               }
-
-               /**
-                * Adjust args for size if necessary by creating an argument file, which should be deleted by the client after the compiler
-                * run has completed.
-                * 
-                * @param max the int maximum length of the command line (in char)
-                * @return the temp File for the arguments (if generated), for deletion when done.
-                * @throws IllegalArgumentException if max is negative
-                */
-               static String[] limitTo(String[] args, int max, Location location) {
-                       if (max < 0) {
-                               throw new IllegalArgumentException("negative max: " + max);
-                       }
-                       // sigh - have to count anyway for now
-                       int size = 0;
-                       for (int i = 0; (i < args.length) && (size < max); i++) {
-                               size += 1 + (null == args[i] ? 0 : args[i].length());
-                       }
-                       if (size <= max) {
-                               return args;
-                       }
-                       File tmpFile = null;
-                       PrintWriter out = null;
-                       // adapted from DefaultCompilerAdapter.executeExternalCompile
-                       try {
-                               String userDirName = System.getProperty("user.dir");
-                               File userDir = new File(userDirName);
-                               tmpFile = File.createTempFile("argfile", "", userDir);
-                               out = new PrintWriter(new FileWriter(tmpFile));
-                               for (int i = 0; i < args.length; i++) {
-                                       out.println(args[i]);
-                               }
-                               out.flush();
-                               return new String[] { "-argfile", tmpFile.getAbsolutePath() };
-                       } catch (IOException e) {
-                               throw new BuildException("Error creating temporary file", e, location);
-                       } finally {
-                               if (out != null) {
-                                       try {
-                                               out.close();
-                                       } catch (Throwable t) {
-                                       }
-                               }
-                       }
-               }
-       }
-
-       private static class AntMessageHandler implements IMessageHandler {
-
-               private TaskLogger logger;
-               private final boolean taskLevelVerbose;
-               private final boolean handledMessage;
-
-               public AntMessageHandler(TaskLogger logger, boolean taskVerbose, boolean handledMessage) {
-                       this.logger = logger;
-                       this.taskLevelVerbose = taskVerbose;
-                       this.handledMessage = handledMessage;
-               }
-
-               /*
-                * (non-Javadoc)
-                * 
-                * @see org.aspectj.bridge.IMessageHandler#handleMessage(org.aspectj.bridge.IMessage)
-                */
-               @Override
-               public boolean handleMessage(IMessage message) throws AbortException {
-                       Kind messageKind = message.getKind();
-                       String messageText = message.toString();
-                       if (messageKind == IMessage.ABORT) {
-                               this.logger.error(messageText);
-                       } else if (messageKind == IMessage.DEBUG) {
-                               this.logger.debug(messageText);
-                       } else if (messageKind == IMessage.ERROR) {
-                               this.logger.error(messageText);
-                       } else if (messageKind == IMessage.FAIL) {
-                               this.logger.error(messageText);
-                       } else if (messageKind == IMessage.INFO) {
-                               if (this.taskLevelVerbose) {
-                                       this.logger.info(messageText);
-                               } else {
-                                       this.logger.verbose(messageText);
-                               }
-                       } else if (messageKind == IMessage.WARNING) {
-                               this.logger.warning(messageText);
-                       } else if (messageKind == IMessage.WEAVEINFO) {
-                               this.logger.info(messageText);
-                       } else if (messageKind == IMessage.TASKTAG) {
-                               // ignore
-                       } else {
-                               throw new BuildException("Unknown message kind from AspectJ compiler: " + messageKind.toString());
-                       }
-                       return handledMessage;
-               }
-
-               /*
-                * (non-Javadoc)
-                * 
-                * @see org.aspectj.bridge.IMessageHandler#isIgnoring(org.aspectj.bridge.IMessage.Kind)
-                */
-               @Override
-               public boolean isIgnoring(Kind kind) {
-                       return false;
-               }
-
-               /*
-                * (non-Javadoc)
-                * 
-                * @see org.aspectj.bridge.IMessageHandler#dontIgnore(org.aspectj.bridge.IMessage.Kind)
-                */
-               @Override
-               public void dontIgnore(Kind kind) {
-               }
-
-               /*
-                * (non-Javadoc)
-                * 
-                * @see org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind)
-                */
-               @Override
-               public void ignore(Kind kind) {
-               }
-
-       }
-}
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajdoc.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajdoc.java
deleted file mode 100644 (file)
index b787a2f..0000000
+++ /dev/null
@@ -1,775 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2000-2001 Xerox Corporation. 
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Xerox/PARC     initial implementation 
- *     2006, Arno Schmidmeier, (reactivated the source and removed deprecated calls)
- * ******************************************************************/
-
-
-package org.aspectj.tools.ant.taskdefs;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Location;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.MatchingTask;
-import org.apache.tools.ant.taskdefs.Javadoc.AccessType;
-import org.apache.tools.ant.taskdefs.Javadoc.Html;
-import org.apache.tools.ant.types.Commandline;
-import org.apache.tools.ant.types.FileSet;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.Reference;
-import org.aspectj.tools.ajdoc.Main;
-
-/**
- * A task to run the ajdoc tool.
- *
- * @author Jeff Palm
- */
-public class Ajdoc extends MatchingTask {
-    /** The name of ajdoc class we're using. */
-    public final static String AJDOC_CLASSNAME = "org.aspectj.tools.ajdoc.Main";
-
-    /** If true, ignore fork param and use FORCE_FORK_VALUE  */
-    public final static boolean FORCE_FORK = false;
-
-    /** value used as fork when FORCE_FORK is true  */
-    public final static boolean FORCE_FORK_VALUE = true;
-
-    protected Commandline cmd;
-    protected Commandline vmcmd;
-    private Path sourcepath;
-    private File destdir;
-    private Collection<String> sourcefiles;
-    private Collection<String> packagenames;
-    private File packageList;
-    private Path bootclasspath;
-    private Path extdirs;
-    private Path classpath;
-    private Path internalclasspath;
-    private List<File> argfiles;
-    private Path docletpath;
-    private Collection<Link> links;
-    private Collection<Group> groups;
-    private Doclet doclet;
-    private boolean failonerror;
-    private boolean fork;
-       private String source;
-       private Html bottom;
-    private Vector<FileSet> fileSets = new Vector<FileSet>();
-    /** reset all to initial values - permit gc if Ajdoc is held */
-    public Ajdoc() {
-        reset();
-    }
-
-    protected void reset() {
-        cmd = new Commandline();
-        vmcmd = new Commandline();
-        sourcepath  = null;
-        destdir  = null ;
-        sourcefiles  = null;
-        packagenames  = null;
-        packageList  = null;
-        bootclasspath  = null;
-        extdirs  = null;
-        classpath  = null;
-        internalclasspath  = null;
-        argfiles  = null;
-        docletpath  = null;
-        links = new ArrayList<Link>();
-        groups = new ArrayList<Group>();
-        doclet  = null;
-        failonerror  = false;
-        fork = false;
-        source = null;
-        bottom = null;
-    }
-
-    protected final boolean setif(boolean b, String flag) {
-        if (b) cmd.createArgument().setValue(flag);
-        return b;
-    }
-
-    protected final void setfile(String flag, String file) {
-        set(flag, getProject().resolveFile(file).getAbsolutePath());
-    }
-
-    protected final void set(String flag, String val) {
-        setif(true, flag, val);
-    }
-
-    protected final boolean setif(boolean b, String flag, String val) {
-        if (setif(b, flag)) cmd.createArgument().setValue(val);
-        return b;
-    }
-    
-    public void setSource(String input) {
-        source = input;
-    }
-
-    public void setSourcepath(Path path) {
-        if (sourcepath == null) {
-            sourcepath = path;
-        } else {
-            sourcepath.append(path);
-        }
-    }
-
-    public Path createSourcepath() {
-        return sourcepath == null ?
-            (sourcepath = new Path(getProject())) :
-            sourcepath.createPath();
-    }
-
-    public void setSourcepathRef(Reference id) {
-        createSourcepath().setRefid(id);
-    }
-
-    public void setSrcdir(Path path) { setSourcepath(path); }
-
-    public Path createSrcdir() { return createSourcepath(); }
-
-    public void setSrcdirRef(Reference id) { setSourcepathRef(id); }
-
-    public void setDestdir(String destdir) {
-        this.destdir = getProject().resolveFile(destdir);
-    }
-
-    public void setSourcefiles(String list) {
-        (sourcefiles == null ?
-         sourcefiles = new ArrayList() :
-         sourcefiles).addAll(strings(list));
-    }
-
-    public void addFileset(FileSet fs) {
-        fileSets.addElement(fs);
-    }
-    
-    private void addFileSets() {
-       if(sourcefiles == null)
-               sourcefiles = new ArrayList<String>();
-       
-        Enumeration<FileSet> e = fileSets.elements();
-        while (e.hasMoreElements()) {
-            FileSet fs = (FileSet) e.nextElement();
-            if (!fs.hasPatterns() && !fs.hasSelectors()) {
-                fs = (FileSet) fs.clone();
-                fs.createInclude().setName("**/*.java");
-                fs.createInclude().setName("**/*.aj");
-            }
-            File baseDir = fs.getDir(getProject());
-            DirectoryScanner ds = fs.getDirectoryScanner(getProject());
-            String[] files = ds.getIncludedFiles();
-            for (int i = 0; i < files.length; i++) {
-               sourcefiles.add((new File(baseDir, files[i])).getAbsolutePath());
-            }
-        }
-    }
-    
-    public void setPackagenames(String list) {
-        (packagenames == null ?
-         packagenames = new ArrayList<String>() :
-         packagenames).addAll(strings(list, true));
-    }
-    
-    public void setAccess(AccessType at) {
-        cmd.createArgument().setValue("-" + at.getValue());
-    }
-    
-    public void setPackageList(String packageList) {
-        this.packageList = getProject().resolveFile(packageList);
-    }
-
-    public void setClasspath(Path path) {
-        if (classpath == null) {
-            classpath = path;
-        } else {
-            classpath.append(path);
-        }
-    }
-
-    public Path createClasspath() {
-        return (classpath == null ?
-                classpath = new Path(getProject()) :
-                classpath).createPath();
-    }
-    
-    public void setClasspathref(Reference id) {
-        createClasspath().setRefid(id);
-    }
-    
-    public void setBootclasspath(Path path) { // todo: unsupported
-        if (bootclasspath == null) {
-            bootclasspath = path;
-        } else {
-         bootclasspath.append(path);
-        }
-    }
-
-    public Path createBootclasspath() { // todo: unsupported
-        return (bootclasspath == null ?
-                bootclasspath = new Path(getProject()) :
-                bootclasspath).createPath();
-    }
-    
-    public void setBootclasspathref(Reference bootclasspathref) { // todo: unsupported
-        createBootclasspath().setRefid(bootclasspathref);
-    }
-
-    public void setInternalclasspath(Path internalclasspath) { 
-        if (this.internalclasspath == null) {
-            this.internalclasspath = internalclasspath;
-        } else {
-            this.internalclasspath.append(internalclasspath);
-        }
-    }
-
-    public Path createInternalclasspath() {
-        if (internalclasspath == null) {
-            internalclasspath = new Path(getProject());
-        }
-        return internalclasspath.createPath();
-    }
-        
-    
-    public void setInternalclasspathref(Reference internalclasspathref) {
-        createInternalclasspath().setRefid(internalclasspathref);
-    }
-    
-    public void setExtdirs(Path path) {
-        if (extdirs == null) {
-            extdirs = path;
-        } else {
-            extdirs.append(path);
-        }
-    }
-
-    public List<File> createArgfiles() {
-        return (argfiles == null ?
-                argfiles = new ArrayList<File>() :
-                argfiles);
-    }
-
-    public void setArgfile(String argfile) {
-        createArgfiles().add(getProject().resolveFile(argfile));
-    }
-
-    public void setArgfiles(String argfiles) {
-        createArgfiles().addAll(files(argfiles));
-    }
-
-    public void setOverview(String overview) {
-        setfile("-overview", overview);
-    }
-
-    public void setPublic(boolean b) {
-        setif(b, "-public");
-    }
-
-    public void setPackage(boolean b) {
-        setif(b, "-package");
-    }
-
-    public void setProtected(boolean b) {
-        setif(b, "-protected");
-    }
-
-    public void setPrivate(boolean b) {
-        setif(b, "-private");
-    }
-
-    public void setOld(boolean old) {
-        setif(old, "-old");
-    }
-
-    public void setAuthor(boolean author) {
-        setif(author, "-author");
-    }
-
-    public void setSplitindex(boolean splitindex) {
-        setif(splitindex, "-splitindex");
-    }
-
-    public void setWindowtitle(String windowtitle) {
-        set("-windowtitle", windowtitle);
-    }
-
-    public void setDoctitle(String doctitle) {
-        set("-doctitle", doctitle);
-    }
-
-    public void setHeader(String header) {
-        set("-header", header);
-    }
-
-    public void setFooter(String footer) {
-        set("-footer", footer);
-    }
-
-    public void setBottom(String bottom) {
-        Html html = new Html();
-        html.addText(bottom);
-        addBottom(html);
-    }
-
-    public void addBottom(Html text) {
-        bottom = text;
-    }
-    
-    public void setVerbose(boolean b) {
-        setif(b, "-verbose");
-    }
-
-    public void setVersion(boolean b) {
-        setif(b, "-version");
-    }
-
-    public void setUse(boolean b) {
-        setif(b, "-use");
-    }
-
-    public void setStandard(boolean b) {
-        setif(b, "-standard");
-    }
-
-    public class Link {
-        protected String href;
-        protected boolean offline;
-        protected String packagelistLoc;
-        public Link() {}
-        public void setHref(String href) {
-            this.href = href;
-        }
-        public void setOffline(boolean offline) {
-            this.offline = offline;
-        }
-        public void setPackagelistLoc(String packagelistLoc) {
-            this.packagelistLoc = packagelistLoc;
-        }
-    }
-
-    public void setLink(String href) {
-        createLink().setHref(href);
-    }
-
-    public Link createLink() {
-        Link link = new Link();
-        links.add(link);
-        return link;
-    }
-
-    public void setLinkoffline(String linkoffline) {
-        Link link = createLink();
-        int ispace = linkoffline.indexOf(" ");
-        if (ispace == -1) {
-            throw new BuildException("linkoffline usage: <url> <url2>!", getLocation());
-        }
-        link.setHref(linkoffline.substring(0, ispace).trim());
-        link.setPackagelistLoc(linkoffline.substring(ispace+1).trim());
-    }
-
-    public class Group {
-        private String title;
-        private List<String> packages;
-        public Group() {}
-        public void setTitle(String title) {
-            this.title = title;
-        }
-        public final void setPackages(String packages) {
-            setPackagenames(packages);
-        }
-        public void setPackagenames(String packages) {
-            this.packages = strings(packages);
-        }
-    }
-
-    public void setGroup(String str) {
-        for (StringTokenizer t = new StringTokenizer(str, ",", false);
-             t.hasMoreTokens();) {
-            String s = t.nextToken().trim();
-            int ispace = s.indexOf(' ');
-            if (ispace != -1) {
-                Group group = createGroup();
-                group.setTitle(s.substring(0, ispace));
-                group.setPackagenames(s.substring(ispace+1));
-            } else {
-                throw new BuildException
-                    ("group usage: group=[<title> <pkglist>]*", getLocation());
-            }
-        }
-    }
-    
-    public Group createGroup() {
-        Group group = new Group();
-        groups.add(group);
-        return group;
-    }
-
-    public void setNodeprecated(boolean nodeprecated) {
-        setif(nodeprecated, "-nodeprecated");
-    }
-
-    public void setNodeprecatedlist(boolean nodeprecatedlist) {
-        setif(nodeprecatedlist, "-nodeprecatedlist");
-    }
-
-    public void setNotree(boolean notree) {
-        setif(notree, "-notree");
-    }
-
-    public void setNoindex(boolean noindex) {
-        setif(noindex, "-noindex");
-    }
-
-    public void setNohelp(boolean nohelp) {
-        setif(nohelp, "-nohelp");
-    }
-
-    public void setNonavbar(boolean nonavbar) {
-        setif(nonavbar, "-nonavbar");
-    }
-
-    public void setSerialwarn(boolean serialwarn) {
-        setif(serialwarn, "-serialwarn"); 
-    }
-
-    public void setHelpfile(String helpfile) {
-        setfile("-helpfile", helpfile);
-    }
-
-    public void setStylesheetfile(String stylesheetfile) {
-        setfile("-stylesheetfile", stylesheetfile);
-    }
-
-    public void setCharset(String charset) { set("-charset", charset); }
-
-    public void setDocencoding(String docencoding) {
-        set("-docencoding", docencoding);
-    }
-
-    public void setDoclet(String doclet) {
-        createDoclet().setName(doclet);
-    }
-
-    public static class Param {
-        protected String name;
-        protected String value;
-        public Param() {}
-        public void setName(String name) { this.name  = name; }
-        public void setValue(String value) { this.value = value; }
-    }
-
-    public class Doclet {
-        protected String name;
-        protected Path path;
-        protected List<Param> params = new ArrayList<Param>();
-        public Doclet() {}
-        public void setName(String name) {
-            this.name = name;
-        }
-        public void setPath(Path path) {
-            if (this.path == null) {
-                this.path = path;
-            } else {
-                this.path.append(path);
-            }
-        }
-        public Path createPath() {
-            return (path == null ?
-                    path = new Path(getProject()) :
-                    path).createPath();
-        }
-        public Param createParam() {
-            Param param = new Param();
-            params.add(param);
-            return param;
-        }
-    }
-
-    public Doclet createDoclet() {
-        if (doclet != null) {
-            throw new BuildException("Only one doclet is allowed!");
-        }
-        return doclet = new Doclet();
-    }
-
-    public void setDocletpath(Path path) {
-        (docletpath == null ?
-         docletpath = path :
-         docletpath).append(path);
-    }
-
-    public Path createDocletpath() {
-        return docletpath == null ?
-            (docletpath = new Path(getProject())) :
-            docletpath.createPath();
-    }
-
-    public void setDocletpathRef(Reference id) {
-        createDocletpath().setRefid(id);
-    }
-
-    public void setAdditionalparam(String additionalparam) {
-        cmd.createArgument().setLine(additionalparam);
-    }
-
-    public void setFailonerror(boolean failonerror) {
-        this.failonerror = failonerror;
-    }
-
-    public void setFork(boolean fork) {
-        this.fork = fork;
-    }
-
-    public Commandline.Argument createJvmarg() {
-        return vmcmd.createArgument();
-    }
-
-    public void setMaxmemory(String max) {
-        createJvmarg().setValue((Project.getJavaVersion().
-                                 startsWith("1.1") ?
-                                 "-mx" : "-Xmx") +max);
-    }
-
-    public void execute() throws BuildException {
-        if (sourcepath == null && argfiles == null && fileSets.size() == 0) {
-            throw new BuildException("one of sourcepath or argfiles must be set!",
-                       getLocation());
-        }
-        if (sourcepath != null) {
-            cmd.createArgument().setValue("-sourcepath");
-            cmd.createArgument().setPath(sourcepath);
-        }
-        if (destdir != null) {
-            cmd.createArgument().setValue("-d");
-            cmd.createArgument().setFile(destdir);
-        }
-        if (classpath != null) {
-            cmd.createArgument().setValue("-classpath");
-            cmd.createArgument().setPath(classpath);
-        }
-        if (bootclasspath != null) {
-            cmd.createArgument().setValue("-bootclasspath");
-            cmd.createArgument().setPath(bootclasspath);
-        }
-        if (extdirs != null) {
-            cmd.createArgument().setValue("-extdirs");
-            cmd.createArgument().setPath(extdirs);
-        }
-        if (source != null) {
-            cmd.createArgument().setValue("-source");
-            cmd.createArgument().setValue(source);
-        }
-        if (bottom != null) {
-               cmd.createArgument().setValue("-bottom");
-               cmd.createArgument().setValue(getProject().replaceProperties(bottom.getText()));
-        }
-        
-        for (Link link: links) {
-            if (link.href == null) {
-                throw new BuildException("Link href cannot be null!", getLocation());
-            }
-            if (link.packagelistLoc != null) {
-                cmd.createArgument().setValue("-linkoffline");
-                cmd.createArgument().setValue(link.href);
-                cmd.createArgument().setValue(link.packagelistLoc);
-            } else {
-                cmd.createArgument().setValue("-link");
-                cmd.createArgument().setValue(link.href);
-            }
-        }
-        if (doclet != null) {
-            if (doclet.name == null) {
-                throw new BuildException("Doclet name cannot be null!", getLocation());
-            }
-            cmd.createArgument().setValue("-doclet");
-            cmd.createArgument().setValue(doclet.name);
-            if (doclet.path != null) {
-                cmd.createArgument().setValue("-docletpath");
-                cmd.createArgument().setPath(doclet.path);
-            }
-            for (Iterator i = doclet.params.iterator(); i.hasNext();) {
-                Param param = (Param)i.next();
-                if (param.name == null) {
-                    throw new BuildException("Doclet params cannot be null!",
-                                             getLocation());
-                }
-                cmd.createArgument().setValue(param.name);
-                if (param.value == null) {
-                    cmd.createArgument().setValue(param.value);
-                }
-            }
-        }
-        Map<String,List<String>> groupMap = new HashMap<String,List<String>>();
-        for (Group group: groups) {
-            if (group.title == null) {
-                throw new BuildException("Group names cannot be null!",
-                                         getLocation());
-            }
-            if (group.packages == null) {
-                throw new BuildException("Group packages cannot be null!",
-                                         getLocation());
-            }
-            List<String> packages = groupMap.get(group.title);
-            if (packages == null) {
-                packages = new ArrayList<String>();
-            }
-            packages.addAll(group.packages);
-            groupMap.put(group.title, packages);
-        }
-        for (String title: groupMap.keySet()) {
-            List<String> packages = groupMap.get(title);
-            String pkgstr = "";
-            for (Iterator<String> j = packages.iterator(); j.hasNext();) {
-                pkgstr += j.next();
-                if (j.hasNext()) pkgstr += ",";
-            }
-            cmd.createArgument().setValue("-group");
-            cmd.createArgument().setValue(title);
-            cmd.createArgument().setValue(pkgstr);
-        }
-        if (argfiles != null) {
-            for (Iterator i = argfiles.iterator(); i.hasNext();) {
-                String name = i.next()+"";
-                File argfile = getProject().resolveFile(name);
-                if (check(argfile, name, false, getLocation())) {
-                    cmd.createArgument().setValue("-argfile");
-                    cmd.createArgument().setFile(argfile);
-                }
-            }
-        }
-        if (packageList != null) {
-            cmd.createArgument().setValue("@" + packageList);
-        }
-        if (null != packagenames) {
-            for (Iterator<String> i = packagenames.iterator(); i.hasNext();) {
-                cmd.createArgument().setValue((String)i.next());
-            }
-        }
-        // support for include parameter as a MatchingTask
-        int numfiles = 0;
-        if (sourcepath != null) {
-            String[] dirs = sourcepath.list();
-            for (int i = 0; i < dirs.length; i++) {
-                File dir = getProject().resolveFile(dirs[i]);
-                check(dir, dirs[i], true, getLocation());
-                String[] files = getDirectoryScanner(dir).getIncludedFiles();
-                for (int j = 0; j < files.length; j++) {
-                    File file = new File(dir, files[j]);
-                    if (file.getName().endsWith(".java")
-                        || file.getName().endsWith(".aj")) {
-                        cmd.createArgument().setFile(file);
-                        numfiles++;
-                    }
-                }
-            }
-        }
-
-       addFileSets();
-        if (sourcefiles != null) {
-            for (Iterator<String> i = sourcefiles.iterator(); i.hasNext();) {
-                // let ajdoc resolve sourcefiles relative to sourcepath,
-                cmd.createArgument().setValue(i.next());
-            }
-        }
-        // XXX PR682 weak way to report errors - need to refactor
-        int result = compile();
-        if (failonerror && (0 != result)) {
-            throw new BuildException("Ajdoc failed with code " + result);
-        }
-        reset();
-    }
-
-    protected int compile() throws BuildException { // todo: doc that fork is ignored
-        try {
-            String[] args = cmd.getArguments(); 
-            if (fork) {
-                log("Warning: fork is ignored ", Project.MSG_WARN);
-            }
-            Main.main(args); 
-            if (Main.hasAborted())
-               return 1;
-            else 
-               return 0;
-        } catch (Throwable t) {
-            throw new BuildException(t);
-        }
-    }
-
-    protected interface Mapper<T> {
-        public T map(String str);
-    }
-
-    protected final <T> List<T> list(String str, Mapper<T> mapper) {
-        if (str == null) return Collections.emptyList();
-        List<T> list = new ArrayList<T>();
-        for (StringTokenizer t = new StringTokenizer(str, ",", false);
-             t.hasMoreTokens();) {
-            list.add(mapper.map(t.nextToken().trim()));
-        }
-        return list;
-    }
-
-    protected final List<File> files(String str) {
-        return list(str, new Mapper<File>() {
-                public File map(String s) {
-                    return getProject().resolveFile(s);
-                }
-            });
-    }
-
-    protected final List<String> strings(String str) {
-        return strings(str, false);
-    }
-
-    protected final List<String> strings(String str, final boolean filterSlashes) {
-        return list(str, new Mapper<String>() {
-                public String map(String s) {
-                    return filterSlashes ? filterSlashes(s) : s;
-                }
-            });
-    }
-
-    protected final String filterSlashes(String str) {
-        if (str == null) return null;
-        return str.
-            replace('/', '.').
-            replace('\\', '.').
-            replace(File.separatorChar, '.');
-    }
-
-    protected final boolean check(File file, String name,
-                                  boolean isDir, Location loc) {
-        loc = loc != null ? loc : getLocation();
-        if (file == null) {
-            throw new BuildException(name + " is null!", loc);
-        }
-        if (!file.exists()) {
-            throw new BuildException(file + "doesn't exist!", loc);
-        }
-        if (isDir ^ file.isDirectory()) {
-            throw new BuildException(file + " should" +
-                                     (!isDir ? "n't" : "") +
-                                     " be a directory!", loc);
-        }
-        return true;
-    }
-}
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/ICommandEditor.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/ICommandEditor.java
deleted file mode 100644 (file)
index 2010f7a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2003 Contributors.
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Wes Isberg     initial implementation 
- * ******************************************************************/
-
-package org.aspectj.tools.ant.taskdefs;
-
-/**
- * Preprocess command-lines
- * @author Wes Isberg
- */
-public interface ICommandEditor {
-    /**
-     * Edit command being used.
-     * @param command the String[] to edit
-     * @return String[] input command if unchanged, 
-     *         or new non-null array of non-null components otherwise
-     */
-    String[] editCommand(String[] command);
-}
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties b/taskdefs/src/org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties
deleted file mode 100644 (file)
index dfcfee6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-ajc=org.aspectj.tools.ant.taskdefs.Ajc10
-iajc=org.aspectj.tools.ant.taskdefs.AjcTask
-ajdoc=org.aspectj.tools.ant.taskdefs.Ajdoc
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java
deleted file mode 100644 (file)
index 690cccf..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2000-2001 Xerox Corporation. 
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Xerox/PARC     initial implementation 
- * ******************************************************************/
-
-package org.aspectj.tools.ant.taskdefs.compilers;
-
-import java.io.File;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Javac;
-import org.apache.tools.ant.taskdefs.LogOutputStream;
-import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter;
-import org.apache.tools.ant.types.Commandline;
-
-/**
- * Ajc uses this as the CompilerAdapter.
- *
- * This task was developed by the <a href="http://aspectj.org">AspectJ Project</a>
- *
- * @author <a href="mailto:palm@parc.xerox.com">Jeffrey Palm</a>
- * @see    org.aspectj.tools.ant.taskdefs.Ajc
- */
-public class Ajc extends DefaultCompilerAdapter {
-
-    /** The value of a compiler success. */
-    public final static int AJC_COMPILER_SUCCESS = 0;
-
-    /** The name of the compiler's main class. */
-    private final static String MAIN_CLASS_NAME = "org.aspectj.tools.ajc.Main";
-    
-    /**
-     * List of arguments allowed only by javac and <b>not</b> ajc.
-     */    
-    final static List<String> javacOnlyFlags
-        = finalList(new String[] { "-g:none", "-g:lines",
-        "-g:vars", "-g:source", "-nowarn"});
-    final static List<String> javacOnlyArgs  
-        = finalList(new String[] { "-sourcepath",
-        "-encoding", "-target" });
-
-    private static List<String> finalList(String[] args) {
-        List<String> result = new ArrayList<String>();
-        result.addAll(Arrays.asList(args));
-        return Collections.unmodifiableList(result);
-    }
-
-    /**
-     * Checks the command line for arguments allowed only in AJC and
-     * disallowed by AJC and then calls the <code>compile()<code> method.
-     *
-     * @return true if a good compile, false otherwise.
-     * @throws org.apache.tools.ant.BuildException
-     */
-    @Override
-       public boolean execute() throws BuildException {
-        attributes.log("Using AJC", Project.MSG_VERBOSE);
-        return compile(addAjcOptions(setupJavacCommand()));
-    }
-
-    /**
-     * Invokes the AJC compiler using reflection.
-     *
-     * @param cline the command line to pass the compiler
-     * @return      true for a good compile (0), false otherwise
-     * @throws      org.apache.tools.ant.BuildException
-     */
-    private boolean compile(Commandline cline) throws BuildException {
-        PrintStream err = System.err;
-        PrintStream out = System.out;
-        try {
-            Class main = Class.forName(MAIN_CLASS_NAME);
-            if (main == null) {
-                throw new ClassNotFoundException(MAIN_CLASS_NAME);
-            }
-            PrintStream logstr =
-                new PrintStream(new LogOutputStream(attributes,
-                                                    Project.MSG_WARN));
-            System.setOut(logstr);
-            System.setErr(logstr);
-            return ((Integer)main.getMethod
-                    ("compile", new Class[]{String[].class}).invoke
-                    (main.newInstance(), new Object[]{
-                        removeUnsupported(cline, logstr)
-                    })).intValue() == AJC_COMPILER_SUCCESS;
-        } catch (Exception e) {
-            if (e instanceof BuildException) {
-                throw (BuildException)e;
-            } else {
-                throw new BuildException("Error starting AJC compiler",
-                                         e, location);
-            }
-        } finally {
-            System.setErr(err);
-            System.setOut(out);
-        }
-    }
-
-    
-    /**
-     * Removes unsupported arguments from <code>cline</code>
-     * issuing warnings for each using <code>log</code>.
-     *
-     * @param cline the <code>org.apache.tools.ant.types.Commandline</code> from
-     *              which the argument is removed.
-     * @return      a new <code>java.lang.String</code> array containing all the
-     *              supported arguments found in <code>cline</code>.
-     * @throws      org.apache.tools.ant.BuildException
-     */
-    private String[] removeUnsupported(Commandline cline, PrintStream log) {
-        if (null == log) log = System.err;
-        String[] args = cline.getCommandline();
-        List argsList = new ArrayList();
-        for (int i = 0; i < args.length; i++) {
-            String arg = args[i];
-            if (javacOnlyFlags.contains(arg)) {
-              log.println("ignored by ajc " + arg);
-            } else if (javacOnlyArgs.contains(arg)) {
-              i++;
-              if (i < args.length) {
-                arg = arg + " " + args[i];
-              }
-              log.println("ignored by ajc " + arg);
-            } else {
-                argsList.add(args[i]);
-            }
-        }
-        return (String[])argsList.toArray(new String[argsList.size()]);
-    }
-    
-    /**
-     * Adds arguments that setupJavacCommand() doesn't pick up.
-     *
-     * @param cline <code>org.apache.tools.ant.types.Commandline</code> to
-     *              which arguments are added.
-     * @throws      org.apache.tools.ant.BuildException
-     * @see         AjcCompiler#ajcOnlyArgs
-     * @see         org.apache.tools.ant.taskdefs.compilers#DefaultCompilerAdapter.setupJavacCommand()
-     */
-    private Commandline addAjcOptions(Commandline cline) throws BuildException {
-        Javac javac = getJavac();
-                               
-        org.aspectj.tools.ant.taskdefs.Ajc2 ajc = null;
-
-        try {
-            ajc = (org.aspectj.tools.ant.taskdefs.Ajc2)javac;
-        } catch (ClassCastException cce) {
-            throw new BuildException(cce+"");
-        }
-        
-        if (ajc.getThreads() != null) {
-            cline.createArgument().setValue("-threads");
-            cline.createArgument().setValue(ajc.getThreads() + "");
-        }
-        if (ajc.getNocomments()) {
-            cline.createArgument().setValue("-nocomments");
-        }
-        if (ajc.getNosymbols()) {
-            cline.createArgument().setValue("-nosymbols");
-        }
-        if (ajc.getPreprocess()) {
-            cline.createArgument().setValue("-preprocess");
-        }
-        if (ajc.getWorkingdir() != null) {
-            cline.createArgument().setValue("-workingdir");
-            cline.createArgument().setFile(ajc.getWorkingdir());
-        }
-
-        return cline;
-    }
-
-    /**
-     * Logs the compilation parameters, adds the files to compile and logs the 
-     * &qout;niceSourceList&quot;
-     */
-    @Override
-       protected void logAndAddFilesToCompile(Commandline cmd) {
-
-        // Same behavior as DefaultCompilerAdapter.logAndAddFilesToCompile
-        attributes.log("Compilation args: " + cmd.toString(), Project.MSG_VERBOSE);
-        StringBuffer niceSourceList = new StringBuffer("File");
-        if (compileList.length != 1) {
-            niceSourceList.append("s");
-        }
-        niceSourceList.append(" to be compiled:");
-        niceSourceList.append(lSep);
-
-        for (int i=0; i < compileList.length; i++) {
-
-            // DefaultCompilerAdapter only expects .java files but we must deal
-            // with .lst files also
-            File file = compileList[i];
-
-            if (file == null) continue;
-
-            String arg = file.getAbsolutePath();
-            String rest = "";
-            String name = file.getName();
-
-            // For .java files take the default behavior and add that
-            // file to the command line
-            if (name.endsWith(".java")) {
-                cmd.createArgument().setValue(arg);
-            }
-            niceSourceList.append("   " + arg + rest + lSep);
-        }
-        attributes.log(niceSourceList.toString(), Project.MSG_VERBOSE);
-    }    
-}
diff --git a/taskdefs/src/test/java/org/aspectj/tools/ant/TaskdefsModuleTests.java b/taskdefs/src/test/java/org/aspectj/tools/ant/TaskdefsModuleTests.java
new file mode 100644 (file)
index 0000000..b47577e
--- /dev/null
@@ -0,0 +1,29 @@
+package org.aspectj.tools.ant;
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation, 
+ *               2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation 
+ * ******************************************************************/
+
+
+// default package
+
+import junit.framework.*;
+
+public class TaskdefsModuleTests extends TestCase {
+
+    public static TestSuite suite() { 
+        TestSuite suite = new TestSuite(TaskdefsModuleTests.class.getName());
+        suite.addTest(org.aspectj.tools.ant.taskdefs.TaskdefsTests.suite()); 
+        return suite;
+    }
+
+    public TaskdefsModuleTests(String name) { super(name); }
+}  
diff --git a/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java b/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java
new file mode 100644 (file)
index 0000000..3b95693
--- /dev/null
@@ -0,0 +1,103 @@
+/* *******************************************************************
+ * Copyright (c) 2003 Contributors. 
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Wes Isberg     initial implementation 
+ * ******************************************************************/
+
+package org.aspectj.tools.ant.taskdefs;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Javac;
+import org.apache.tools.ant.types.Path;
+import org.aspectj.util.FileUtil;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+/**
+ * 
+ */
+public class Ajc11CompilerAdapterTest extends TestCase {
+    public static boolean LOGGING = false;
+    ArrayList tempFiles = new ArrayList();
+    
+    public Ajc11CompilerAdapterTest(String name) {
+        super(name);
+    }
+    
+    public void tearDown() {
+        for (Iterator iter = tempFiles.iterator(); iter.hasNext();) {
+            File file = (File) iter.next();
+            FileUtil.deleteContents(file);
+            file.delete();
+        }
+    }
+    
+//    public void testCompilerAdapterWithJavac() { // XXX requires tools.jar 
+//        Javac javac = getJavac(new Project());
+//        setupTracingJava(javac);
+//        javac.execute();
+//    }
+
+    public void testCompilerAdapterWithAjc() { // XXX unverified        
+        Project project = new Project();
+        String cname = Ajc11CompilerAdapter.class.getName();
+        project.setProperty("build.compiler", cname);
+        Javac javac = getJavac(project);
+        setupTracingJava(javac);
+        log("---- first compile...");
+        System.out.flush();
+        javac.execute();
+        log("---- second compile (none: nothing out of date?)...");
+        javac.execute(); 
+    }
+
+    public void testCompilerAdapterWithAjcRecursively() { // XXX unverified
+        Project project = new Project();
+        String cname = Ajc11CompilerAdapter.class.getName();
+        project.setProperty("build.compiler", cname);
+        project.setProperty("build.compiler.clean", "yes");
+        Javac javac = getJavac(project);
+        setupTracingJava(javac);
+        log("---- first compile...");
+        System.out.flush();
+        javac.execute();
+        log("---- second compile...");
+        System.out.flush();
+        javac.execute(); // expecting full recompile - pre-cleaned
+    }
+
+    Javac getJavac(Project project) {
+        Javac javac = new Javac();
+        javac.setProject(project);
+        File classesDir = FileUtil.getTempDir("Ajc11CompilerAdapterTest");
+        tempFiles.add(classesDir);
+        javac.setDestdir(classesDir);
+        javac.setVerbose(LOGGING);
+        String rtpath = "../lib/test/aspectjrt.jar";
+        File rt = new File(rtpath);
+        assertTrue("can read " + rtpath, rt.canRead());
+        javac.setClasspath(new Path(project, rt.getAbsolutePath()));
+        return javac;
+    }
+    
+    void setupTracingJava(Javac javac) { // XXX assumes module dir, doc loc
+        String exDir = "../docs/dist/doc/examples"; 
+        javac.setSrcdir(new Path(javac.getProject(), exDir));
+        javac.setIncludes("tracing/*.java"); // XXX assumes tracing example
+    }
+    void log(String s) {
+        if (LOGGING) {
+            System.err.println(s);
+        }
+    }
+}
diff --git a/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java b/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java
new file mode 100644 (file)
index 0000000..f7f3908
--- /dev/null
@@ -0,0 +1,1122 @@
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation, 
+ *               2002 Palo Alto Research Center, Incorporated (PARC)
+ *               2003 Contributors.
+ *               2005 Contributors
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation
+ *     IBM                 ongoing maintenance 
+ * ******************************************************************/
+
+package org.aspectj.tools.ant.taskdefs;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Location;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.selectors.FilenameSelector;
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.IMessageHolder;
+import org.aspectj.bridge.MessageHandler;
+import org.aspectj.bridge.MessageUtil;
+import org.aspectj.tools.ant.taskdefs.AjcTask.CompilerArg;
+import org.aspectj.util.FileUtil;
+import org.aspectj.util.LangUtil;
+
+import junit.framework.TestCase;
+
+/**
+ * AjcTask test cases.
+ * Please put new ones with others between ------- comments.
+ * 
+ * Some API tests, but mostly functional tests driving
+ * the task execute using data in ../taskdefs/testdata.
+ * This will re-run in forked mode for any nonfailing
+ * compile if aspectjtools-dist is built into
+ * ../aj-build/dist/tools/lib/aspectjtools.jar.
+ */
+public class AjcTaskTest extends TestCase {
+
+       private static final Class NO_EXCEPTION = null;
+       private static final String NOFILE = "NOFILE";
+
+       private static final File tempDir;
+       private static final String aspectjtoolsJar;
+       private static final String testdataDir;
+       private static final StringBuffer MESSAGES = new StringBuffer();
+       /** accept writable .class files */
+       private static FileFilter PICK_CLASS_FILES;
+
+       static {
+               tempDir = new File("IncrementalAjcTaskTest-temp");
+               String toolsPath = "../aj-build/dist/tools/lib/aspectjtools.jar";
+               File toolsjar = new File(toolsPath);
+               if (toolsjar.canRead()) {
+                       aspectjtoolsJar = toolsjar.getAbsolutePath();
+               } else {
+                       aspectjtoolsJar = null;
+                       String s =
+                               "AjcTaskTest not forking - build aspectjtools-dist to get "
+                                       + toolsPath;
+                       System.out.println(s);
+               }
+               File dir = new File("../taskdefs/testdata");
+               if (dir.canRead() && dir.isDirectory()) {
+                       testdataDir = dir.getAbsolutePath();
+               } else {
+                       testdataDir = null;
+               }
+               PICK_CLASS_FILES = new FileFilter() {
+                       @Override
+                       public boolean accept(File file) {
+                               return (
+                                       (null != file)
+                                               && file.isFile()
+                                               && file.canWrite()
+                                               && file.getPath().endsWith(".class"));
+                       }
+
+               };
+       }
+
+       /** 
+         * Check that aspectjtools are found on the classpath,
+         * reporting any errors to System.err.
+         * 
+         * Run multiple times with different classpaths.
+         * This should find variants
+         * aspectjtools.jar,
+         * aspectj-tools.jar,
+         * aspectj-tools-1.1.jar, and
+         * aspectjtools-1.0.6.jar
+         * but not
+         * aspectjrt.jar or
+         * aspectj/tools.jar.
+         * XXX use testing aspect to stub out 
+         * <code>System.getProperty("java.class.path")</code>
+         * @param args a String[], first is expected path, if any
+         */
+       public static void main(String[] args) {
+               java.io.File toolsjar = AjcTask.findAspectjtoolsJar();
+               if ((null == args) || (0 == args.length)) {
+                       if (null != toolsjar) {
+                               System.err.println("FAIL - not expected: " + toolsjar);
+                       }
+               } else if ("-help".equals(args[0])) {
+                       System.out.println(
+                               "java "
+                                       + AjcTaskTest.class.getName()
+                                       + " <expectedPathToAspectjtoolsJar>");
+               } else if (null == toolsjar) {
+                       System.err.println("FAIL - expected: " + args[0]);
+               } else {
+                       String path = toolsjar.getAbsolutePath();
+                       if (!path.equals(args[0])) {
+                               System.err.println(
+                                       "FAIL - expected: " + args[0] + " actual: " + path);
+                       }
+               }
+       }
+
+       public static void collectMessage(String s) {
+               MESSAGES.append(s);
+       }
+
+       private static void deleteTempDir() {
+               if ((null != tempDir) && tempDir.exists()) {
+                       FileUtil.deleteContents(tempDir);
+                       tempDir.delete();
+                       // when tempDir not used...
+                       if (null != testdataDir) {
+                               File dataDir = new File(testdataDir);
+                               if (dataDir.canRead()) {
+                                       FileUtil.deleteContents(dataDir, PICK_CLASS_FILES, false);
+                               }
+                       }
+               }
+       }
+       private static final File getTempDir() {
+               return tempDir;
+       }
+
+       public AjcTaskTest(String name) {
+               super(name);
+       }
+
+       @Override
+       public void tearDown() {
+               deleteTempDir();
+               MESSAGES.setLength(0);
+       }
+    private void checkRun(AjcTask task, String exceptionString) {
+        try {
+            task.execute();
+            assertTrue(null == exceptionString);
+        } catch (BuildException e) {
+            if (null == exceptionString) {
+                assertTrue("unexpected " + e.getMessage(), false);
+            } else {
+                String m = e.getMessage();
+                if (null == m) {
+                    assertTrue("not " + exceptionString, false);
+                } else if (-1 == m.indexOf(exceptionString)) {
+                    assertEquals(exceptionString, e.getMessage());
+                }
+            }
+        }
+
+    }
+
+    private void checkContains(String[] cmd, String option, boolean contains) {
+        for (int i = 0; i < cmd.length; i++) {
+            if (option.equals(cmd[i])) {
+                if (contains) {
+                    return;
+                } else {
+                    assertTrue(
+                        "not expecting " + option + " in " + Arrays.asList(cmd),
+                        false);
+                }
+            }
+        }
+        if (contains) {
+            assertTrue(
+                "expecting " + option + " in " + Arrays.asList(cmd),
+                false);
+        }
+    }
+    protected AjcTask getTask(String input) {
+        return getTask(input, getTempDir());
+    }
+
+    protected AjcTask getTask(String input, File destDir) {
+        AjcTask task = new AjcTask();
+        Project p = new Project();
+        task.setProject(p);
+        if (null != destDir) {
+            task.setDestdir(destDir);
+        }
+        if (NOFILE.equals(input)) {
+            // add nothing
+        } else if (input.endsWith(".lst")) {
+            if (-1 != input.indexOf(",")) {
+                throw new IllegalArgumentException(
+                    "lists not supported: " + input);
+            } else if (null == testdataDir) {
+                throw new Error("testdata not found - run in ../taskdefs");
+            } else {
+                String path = testdataDir + File.separator + input;
+                task.setArgfiles(new Path(task.getProject(), path));
+            }
+        } else if ((input.endsWith(".java") || input.endsWith(".aj"))) {
+            FilenameSelector fns = new FilenameSelector();
+            fns.setName(input);
+            task.addFilename(fns);
+        } else {
+            String path = testdataDir + File.separator + input;
+            task.setSourceRoots(new Path(task.getProject(), path));
+        }
+        task.setClasspath(new Path(p, "../lib/test/aspectjrt.jar"));
+        return task;
+    }
+
+    /** used in testMessageHolderClassName */
+    public static class InfoHolder extends MessageHandler {
+        public InfoHolder() {
+        }
+        @Override
+               public boolean handleMessage(IMessage message) {
+            if (0 == IMessage.INFO.compareTo(message.getKind())) {
+                AjcTaskTest.collectMessage(message.getMessage());
+            }
+            return true;
+        }
+    }
+
+    /** used in testMessageHolderClassName */
+    public static class Holder extends MessageHandler {
+        public Holder() {
+        }
+        @Override
+               public boolean handleMessage(IMessage message) {
+            IMessage.Kind kind = message.getKind();
+            if (IMessage.ERROR.isSameOrLessThan(kind)) {
+                String m = kind.toString();
+                AjcTaskTest.collectMessage(m.substring(0, 1));
+            }
+            return true;
+        }
+    }
+
+    // ------------------------------------------------------
+    // ------------------------------------------------------
+    // ------------------------------------------------------
+    // ------------------------------------------------------
+    // ------------------------------------------------------
+    // ------------------------------------------------------
+    // Start of test cases
+    
+       public void testNullDestDir() {
+               AjcTask task = getTask(NOFILE, null);
+               String[] cmd = task.makeCommand();
+
+               for (int i = 0; i < cmd.length; i++) {
+                       assertTrue(!"-d".equals(cmd[i]));
+               }
+       }
+       
+       public void testOutputRequirement() {
+               AjcTask task = getTask("default.lst");
+               checkRun(task, null);
+
+               // copyInJars now just emits warning b/c unused
+               task = getTask("default.lst", null);
+               task.setCopyInjars(true);
+               checkRun(task, null);
+
+               // sourceRootCopyFilter requires destDir
+               task = getTask("default.lst", null);
+               task.setSourceRootCopyFilter("**/*.java");
+               checkRun(task, "sourceRoot");
+       }
+
+       public void testSourceRootCopyFilter() {
+               // sourceRootCopyFilter works..
+               File destDir = getTempDir();
+               assertTrue(
+                       "unable to create " + destDir,
+                       destDir.canRead() || destDir.mkdirs());
+               AjcTask task = getTask("sourceroot", destDir);
+               task.setSourceRootCopyFilter("doNotCopy,**/*.txt");
+               File file = new File(destDir, "Default.java").getAbsoluteFile();
+               assertTrue(file + ".canRead() prematurely", !file.canRead());
+               checkRun(task, null);
+               // got expected resources
+               assertTrue(file + ".canRead() failed", file.canRead());
+               File pack = new File(destDir, "pack");
+               file = new File(pack, "Pack.java").getAbsoluteFile();
+               assertTrue(file + ".canRead() failed", file.canRead());
+               file = new File(pack, "includeme").getAbsoluteFile();
+               assertTrue(file + ".canRead() failed", file.canRead());
+
+               // didn't get unexpected resources
+               file = new File(pack, "something.txt");
+               assertTrue(file + ".canRead() passed", !file.canRead());
+               file = new File(destDir, "doNotCopy");
+               assertTrue(file + ".canRead() passed", !file.canRead());
+               file = new File(destDir, "skipTxtFiles.txt");
+               assertTrue(file + ".canRead() passed", !file.canRead());
+       }
+
+    public void testInpathDirCopyFilter() {
+        // inpathDirCopyFilter works with output directory
+        File destDir = getTempDir();
+        assertTrue(
+            "unable to create " + destDir,
+            destDir.canRead() || destDir.mkdirs());
+        AjcTask task = getTask(NOFILE, destDir);        
+        Project p = task.getProject();
+        Path indirs = new Path(p);
+        File dir = new File(testdataDir, "inpathDirs").getAbsoluteFile();
+        indirs.addExisting(new Path(p, new File(dir, "inpathDirOne").getAbsolutePath()));
+        indirs.addExisting(new Path(p, new File(dir, "inpathDirTwo").getAbsolutePath()));
+        task.setInpath(indirs);
+        task.setInpathDirCopyFilter("doNotCopy,**/*.txt");
+        
+        File file = new File(destDir, "Default.java").getAbsoluteFile();
+        assertTrue(file + ".canRead() prematurely", !file.canRead());
+        checkRun(task, null);
+
+        // got expected resources
+        File pack = new File(destDir, "pack");
+        file = new File(pack, "includeme").getAbsoluteFile();
+        assertTrue(file + ".canRead() failed", file.canRead());
+        file = new File(pack, "Pack.class").getAbsoluteFile();
+        assertTrue(file + ".canRead() failed", file.canRead());
+        file = new File(destDir, "copyMe.htm").getAbsoluteFile();
+        assertTrue(file + ".canRead() failed", file.canRead());
+        file = new File(destDir, "Default.class").getAbsoluteFile();
+        assertTrue(file + ".canRead() failed", file.canRead());
+
+        // didn't get unexpected resources
+        file = new File(pack, "something.txt");
+        assertTrue(file + ".canRead() passed", !file.canRead());
+        file = new File(destDir, "doNotCopy");
+        assertTrue(file + ".canRead() passed", !file.canRead());
+        file = new File(destDir, "skipTxtFiles.txt");
+        assertTrue(file + ".canRead() passed", !file.canRead());
+    }
+    
+    public void testInpathDirCopyFilterWithJar() throws IOException {
+       checkInpathCopy("testInpathDirCopyFilterWithJar-out.jar");
+    }
+
+    // test resource copying for oddball jar files that don't end in .jar
+    public void testInpathDirCopyFilterWithOddjar() throws IOException {
+       checkInpathCopy("testInpathDirCopyFilterWithJar-outJarFile");
+    }
+    
+    private void checkInpathCopy(String outjarFileStr) throws IOException {
+        // inpathDirCopyFilter works with output jar
+        File destDir = getTempDir();
+        assertTrue(
+            "unable to create " + destDir,
+            destDir.canRead() || destDir.mkdirs());
+        AjcTask task = getTask(NOFILE, null);        
+        File destJar = new File(destDir, outjarFileStr);
+        task.setOutjar(destJar);
+        Project p = task.getProject();
+        Path indirs = new Path(p);
+        File dir = new File(testdataDir, "inpathDirs").getAbsoluteFile();
+        indirs.addExisting(new Path(p, new File(dir, "inpathDirOne").getAbsolutePath()));
+        indirs.addExisting(new Path(p, new File(dir, "inpathDirTwo").getAbsolutePath()));
+        task.setInpath(indirs);
+        task.setInpathDirCopyFilter("doNotCopy,**/*.txt,**/*.class");
+        
+        checkRun(task, null);
+
+        JarFile jarFile = new JarFile(destJar);
+        String[] expected = {"copyMe.htm", "pack/includeme", 
+                "pack/Pack.class", "Default.class"};
+        String[] unexpected = {"doNotCopy", "skipTxtFiles.txt", "pack/something.txt"};
+        for (int i = 0; i < expected.length; i++) {
+            JarEntry entry = jarFile.getJarEntry(expected[i]);
+            assertTrue(expected[i] + " not found", null != entry);
+        }
+        for (int i = 0; i < unexpected.length; i++) {
+            JarEntry entry = jarFile.getJarEntry(unexpected[i]);
+            assertTrue(unexpected[i] + " found", null == entry);
+        }
+    }
+
+    public void testInpathDirCopyFilterError() {
+        // inpathDirCopyFilter fails with no output directory or jar iff specified
+        AjcTask task = getTask(NOFILE, null);        
+        Project p = task.getProject();
+        Path indirs = new Path(p);
+        File dir = new File(testdataDir, "inpathDirs").getAbsoluteFile();
+        indirs.addExisting(new Path(p, new File(dir, "inpathDirOne").getAbsolutePath()));
+        indirs.addExisting(new Path(p, new File(dir, "inpathDirTwo").getAbsolutePath()));
+        task.setInpath(indirs);
+        task.setInpathDirCopyFilter("doNotCopy,**/*.txt,**/*.class");
+
+        // expecting error
+        checkRun(task, "inpathDirCopyFilter");
+    }
+
+       // this test method submitted by patch from Andrew Huff (IBM)
+       // verifies that the log attribute of AjcTask writes output to the given log file
+       public void testLoggingMode() {
+               AjcTask task = getTask("default.lst");
+               task.setFailonerror(false);
+               File logFile = new File("testLogFile1.txt");
+               String s = logFile.getAbsolutePath();
+               logFile.delete();
+               long initialLength = logFile.length();
+               task.setLog(logFile);
+               runTest(task,null,MessageHolderChecker.INFOS);
+               long newLength = logFile.length();
+               assertTrue(newLength > initialLength);
+               logFile.delete();
+       }
+
+
+       public void testCommandEditor() {
+               String className = VerboseCommandEditor.class.getName();
+               System.setProperty(AjcTask.COMMAND_EDITOR_NAME, className);
+               assertEquals(
+                       className,
+                       System.getProperty(AjcTask.COMMAND_EDITOR_NAME));
+               AjcTask task = getTask(NOFILE);
+               task.setCommandEditor(new VerboseCommandEditor());
+               String[] cmd = task.makeCommand();
+               assertEquals(VerboseCommandEditor.VERBOSE, cmd[0]);
+
+               task = getTask(NOFILE);
+               task.setCommandEditorClass(VerboseCommandEditor.class.getName());
+               cmd = task.makeCommand();
+               assertEquals(VerboseCommandEditor.VERBOSE, cmd[0]);
+       }
+       //    public void testStaticCommandEditor() {
+       //        // XXX need to test COMMAND_EDITOR, but can't require property when run
+       //    }
+
+       public void testLimitTo() {
+               int numArgs = 100;
+               String arg = "123456789";
+               String[] args = new String[numArgs];
+               for (int i = 0; i < args.length; i++) {
+                       args[i] = arg;
+               }
+               // no limit
+               int max = numArgs * (arg.length() + 1);
+               Location location = new Location("AjcTaskTest.java");
+               String[] newArgs = AjcTask.GuardedCommand.limitTo(args, max, location);
+               assertTrue("same", args == newArgs);
+
+               // limited - read file and verify arguments
+               max--;
+               newArgs = AjcTask.GuardedCommand.limitTo(args, max, location);
+               assertTrue("not same", args != newArgs);
+               assertTrue("not null", null != newArgs);
+               String label = "newArgs " + Arrays.asList(newArgs);
+               assertTrue("size 2" + label, 2 == newArgs.length);
+               assertEquals("-argfile", newArgs[0]);
+               File file = new File(newArgs[1]);
+               assertTrue("readable newArgs[1]" + label, file.canRead());
+               FileReader fin = null;
+               try {
+                       fin = new FileReader(file);
+                       BufferedReader reader = new BufferedReader(fin);
+                       String line;
+                       int i = 0;
+                       while (null != (line = reader.readLine())) {
+                               assertEquals(i + ": ", args[i++], line);
+                       }
+                       assertEquals("num entries", i, args.length);
+               } catch (IOException e) {
+                       assertTrue("IOException " + e.getMessage(), false);
+               } finally {
+                       if (null != fin) {
+                               try {
+                                       fin.close();
+                               } catch (IOException e) {
+                                       // ignore
+                               }
+                       }
+                       file.delete();
+               }
+       }
+
+       public void testFindAspectjtoolsJar() {
+               File toolsJar = AjcTask.findAspectjtoolsJar();
+               if (null != toolsJar) {
+                       assertNull("tools jar found?: " + toolsJar, toolsJar);
+               }
+               // not found when unit testing b/c not on system classpath
+               // so just checking for exceptions.
+               // XXX need aspect to stub out System.getProperty(..) 
+       }
+
+
+       public void testMessageHolderClassName() {
+               AjcTask task = getTask("compileError.lst");
+               task.setFailonerror(false);
+               MESSAGES.setLength(0);
+               runTest(
+                       task,
+                       null,
+                       MessageHolderChecker.ONE_ERROR,
+                       Holder.class.getName());
+               String result = MESSAGES.toString();
+               MESSAGES.setLength(0);
+               // The test program produces three errors with the current 1.8 compiler, this may change by 1.8 release and so
+               // this will need reverting back to "e"
+               assertEquals("messages", "eee", result);
+       }
+
+    // TODO skipped test - works locally but not on build machine?
+    public void skip_testMessageHolderClassWithDoneSignal() {
+        AjcTask task = getTask("default.lst");
+        task.setFailonerror(false);
+        String DONE = "This is a unique message, not confused with others.";
+        task.setXDoneSignal(DONE);
+        MESSAGES.setLength(0);
+        runTest(
+            task,
+            null,
+            MessageHolderChecker.INFOS,
+            InfoHolder.class.getName());
+        final String result = MESSAGES.toString();
+        String temp = new String(result);
+        MESSAGES.setLength(0);
+        if (!temp.endsWith(DONE)) {
+            if (temp.length() > 20) {
+                temp = "..." + temp.substring(temp.length()-20, temp.length());
+            }
+            assertTrue(DONE + " is not suffix of \"" + temp + "\"", false);
+        }
+        // exactly one such message
+        temp = new String(result);
+        temp = temp.substring(0, temp.length()-DONE.length());
+        if (temp.endsWith(DONE)) {
+            temp = new String(result);
+            if (temp.length() > 20) {
+                temp = "..." + temp.substring(temp.length()-20, temp.length());
+            }
+            assertTrue(DONE + " signalled twice: \"" + temp + "\"", false);
+        }
+    }
+
+       public void testDefaultListForkedNoTools() {
+               AjcTask task = getTask("default.lst");
+               task.setFork(true);
+               boolean passed = false;
+               try {
+                       runTest(task, BuildException.class, MessageHolderChecker.NONE);
+                       passed = true;
+               } finally {
+                       if (!passed) {
+                               String m =
+                                       "AjcTaskTest.testDefaultListForkedNoTools()"
+                                               + " fails if aspectjtools.jar is on the classpath";
+                               System.err.println(m);
+                       }
+               }
+       }
+
+       public void testDefaultListForkedIncremental() {
+               AjcTask task = getTask("default.lst");
+               task.setFork(true);
+               task.setIncremental(true);
+               runTest(task, BuildException.class, MessageHolderChecker.NONE);
+       }
+
+       /** failonerror should default to true, unlike other booleans */
+       public void testCompileErrorFailOnErrorDefault() {
+               AjcTask task = getTask("compileError.lst");
+        final PrintStream serr = System.err;
+        try {
+            System.setErr(new PrintStream(new java.io.ByteArrayOutputStream()));
+            // Current 1.8 compiler produces 3 errors for this test program, may need reverting to ONE_ERROR by release
+            runTest(task, BuildException.class, MessageHolderChecker.THREE_ERRORS);
+        } finally {
+            System.setErr(serr);
+        }
+       }
+    public void testCompileErrorListDefaultHolder() {
+        AjcTask task = getTask("compileError.lst");
+        final PrintStream serr = System.err;
+        try {
+            System.setErr(new PrintStream(new java.io.ByteArrayOutputStream()));
+            task.execute();
+            fail("expected BuildException from failed compile by default");
+        } catch (BuildException t) {
+            // ok
+        } finally {
+            System.setErr(serr);
+            deleteTempDir();
+        }
+    }
+
+       public void testDefaultList() {
+               AjcTask task = getTask("default.lst");
+               runTest(task, NO_EXCEPTION, MessageHolderChecker.INFOS);
+       }
+
+       public void testCompileErrorList() {
+               AjcTask task = getTask("compileError.lst");
+               task.setFailonerror(false);
+               // Prior to the 1.8 compiler there is one error here, 'syntax error on here'
+               // With 1.8 there are 3 errors about completing the method header, ending the class body, ending the method - this may
+               // change by 1.8 final... this might need reverting back to ONE_ERROR
+               runTest(task, NO_EXCEPTION, MessageHolderChecker.THREE_ERRORS);
+       }
+       
+       public void testShowWeaveInfo() {
+               AjcTask task = getTask("showweaveinfo.lst");
+               task.setShowWeaveInfo(true);
+               MessageHandler mh = new MessageHandler(false);
+               mh.dontIgnore(IMessage.WEAVEINFO);
+               MessageHolderChecker mhc = new MessageHolderChecker(0,0,0,0,MessageHolderChecker.IGNORE);
+               mhc.weaveinfos = 2; // Expect 2 weaving messages
+               runTest(task,NO_EXCEPTION,mhc);
+               mhc.weaveinfos = MessageHolderChecker.IGNORE;
+       }
+
+       public void testCompileWarningList() {
+               AjcTask task = getTask("compileWarning.lst");
+               runTest(task, NO_EXCEPTION, MessageHolderChecker.ONE_WARNING);
+       }
+
+       public void testNoSuchFileList() {
+               AjcTask task = getTask("NoSuchFile.lst");
+               task.setFailonerror(false);
+               runTest(task, NO_EXCEPTION, MessageHolderChecker.ONE_ERROR_ONE_ABORT);
+       }
+
+       public void testVersions() {
+        String[] inputs = AjcTask.TARGET_INPUTS;
+               for (int i = 0; i < inputs.length; i++) {
+                       AjcTask task = getTask(NOFILE);
+            task.setTarget(inputs[i]);
+                       String[] cmd = task.makeCommand();
+            checkContains(cmd, "-target", true);
+            checkContains(cmd, inputs[i], true);
+               }
+
+        inputs = AjcTask.SOURCE_INPUTS;
+        for (int i = 0; i < inputs.length; i++) {
+            AjcTask task = getTask(NOFILE);
+            task.setSource(inputs[i]);
+            String[] cmd = task.makeCommand();
+            checkContains(cmd, "-source", true);
+            checkContains(cmd, inputs[i], true);
+        }
+
+        inputs = AjcTask.COMPLIANCE_INPUTS;
+        for (int i = 0; i < inputs.length; i++) {
+            AjcTask task = getTask(NOFILE);
+            task.setCompliance(inputs[i]);
+            String[] cmd = task.makeCommand();
+            checkContains(cmd, inputs[i], true);
+        }
+       }
+    
+       public void testClasspath() {
+               AjcTask task = getTask(NOFILE);
+               String[] cmd = task.makeCommand();
+        checkContains(cmd, "-bootclasspath", false);
+               String classpath = null;
+               for (int i = 0; i < cmd.length; i++) {
+                       if ("-classpath".equals(cmd[i])) {
+                               classpath = cmd[i + 1];
+                break;
+                       }
+               }
+               assertTrue(
+                       "expecting aspectj in classpath",
+                       (-1 != classpath.indexOf("aspectjrt.jar")));
+       }
+       
+       CompilerArg createCompilerArg(String value) {
+               CompilerArg c = new CompilerArg();
+               c.setValue(value);
+               return c;
+       }
+       
+       public void testAddModulesJ9() {
+               AjcTask task = getTask(NOFILE);
+               task.createCompilerarg().setValue("--add-modules");
+               task.createCompilerarg().setValue("java.xml.bind,java.io");
+               String[] cmd = task.makeCommand();
+               System.out.println(Arrays.toString(cmd));
+               int addModulesPos = findOptionPosition(cmd,"--add-modules");
+               assertNotSame(-1, addModulesPos);
+               assertEquals("java.xml.bind,java.io",cmd[addModulesPos+1]);
+       }
+       
+       private int findOptionPosition(String[] cmd, String optionString) {
+               for (int i=0;i<cmd.length;i++) {
+                       if (cmd[i].equals(optionString)) {
+                               return i;
+                       }
+               }
+               return -1;
+       }
+
+       // ---------------------------------------- sourcefile
+       // XXX need to figure out how to specify files directly programmatically
+       //    public void testDefaultFile() {
+       //        AjcTask task = getTask("testdata/Default.java");
+       //        runTest(task, NO_EXCEPTION, MessageHolderChecker.INFOS);
+       //    }
+
+       public void testNoFile() {
+               AjcTask task = getTask(NOFILE);
+               task.setFailonerror(false);
+               runTest(task, NO_EXCEPTION, MessageHolderChecker.ONE_ERROR_ONE_ABORT);
+       }
+
+       public void testCompileErrorFile() {
+               AjcTask task = getTask("compileError.lst");
+               task.setFailonerror(false);
+               // 1.8 compiler currently produces 3 errors for the test program, may need to revert to ONE_ERROR by 1.8 release
+               runTest(task, NO_EXCEPTION, MessageHolderChecker.THREE_ERRORS);
+       }
+
+       public void testCompileWarningFile() {
+               AjcTask task = getTask("compileWarning.lst");
+               task.setFailonerror(false);
+               runTest(task, NO_EXCEPTION, MessageHolderChecker.ONE_WARNING);
+       }
+
+       public void testNoSuchFile() {
+               AjcTask task = getTask("NoSuchFile.lst");
+               task.setFailonerror(false);
+               runTest(task, NO_EXCEPTION, MessageHolderChecker.ONE_ERROR_ONE_ABORT);
+       }
+
+    public void testDefaultFileComplete() {
+        AjcTask task = getTask("default.lst");
+        defaultSettings(task);
+        runTest(task, NO_EXCEPTION, MessageHolderChecker.INFOS);
+    }
+    private void defaultSettings(AjcTask task) {
+        task.setDebugLevel("none");
+        task.setDeprecation(true);
+        task.setFailonerror(false);
+        task.setNoExit(true); // ok to override Ant?
+        task.setNoImportError(true);
+        task.setNowarn(true);
+        task.setXTerminateAfterCompilation(true);
+        task.setPreserveAllLocals(true);
+        task.setProceedOnError(true);
+        task.setReferenceInfo(true);
+        task.setSource("1.3");
+        task.setTarget("1.1");
+        task.setTime(true);
+        task.setVerbose(true);
+        task.setXlint("info");        
+    }
+    
+    public void testLogCommand() {
+        final String DEFAULT = "default.lst";
+        AjcTask task = getTask(DEFAULT);
+        defaultSettings(task);
+        task.setVerbose(false);
+        task.setLogCommand(true);
+        LogListener listener = new LogListener(Project.MSG_INFO);
+        task.getProject().addBuildListener(listener);
+        runTest(task, NO_EXCEPTION, MessageHolderChecker.INFOS);
+        String[] results = listener.getResults();
+        boolean matched = false;
+        for (int i = 0; !matched && (i < results.length); i++) {
+            String s = results[i];
+            matched = (null != s) && (-1 != s.indexOf(DEFAULT));
+        }
+        if (!matched) {
+            fail(DEFAULT + " not found in " + Arrays.asList(results));
+        }
+    }
+
+       public void testXOptions() {
+               String[] xopts = new String[] {
+                       "serializableAspects",
+                       "lazyTjp",
+                       "reweavable",
+                       "reweavable:compress",
+                       "noInline"
+               };
+               for (int i = 0; i < xopts.length; i++) {
+                       AjcTask task = getTask(NOFILE);
+                       task.setX(xopts[i]);
+                       String[] cmd = task.makeCommand();
+                       checkContains(cmd,"-X" + xopts[i],true);
+               }
+               
+       }
+
+  public void testAptProc() {
+    AjcTask task = getTask(NOFILE);
+    task.setProc("none");
+    checkContains(task.makeCommand(), "-proc:none", true);
+    task.setProc("only");
+    checkContains(task.makeCommand(), "-proc:only", true);
+  }
+
+  public void testAptProcessor() {
+    AjcTask task = getTask(NOFILE);
+    task.setProcessor("some.SomeClass");
+    checkContains(task.makeCommand(), "-processor", true);
+    checkContains(task.makeCommand(), "some.SomeClass", true);
+  }
+
+  public void testAptProcessorpath() {
+    AjcTask task = getTask(NOFILE);
+    task.setProcessorpath("some/path");
+    checkContains(task.makeCommand(), "-processorpath", true);
+    checkContains(task.makeCommand(), "some/path", true);
+  }
+
+  public void testAptGeneratedDirectory() {
+    AjcTask task = getTask(NOFILE);
+    task.setS("some/path");
+    checkContains(task.makeCommand(), "-s", true);
+    checkContains(task.makeCommand(), "some/path", true);
+  }
+       
+       public void testOutxml () {
+        File destDir = getTempDir();
+        assertTrue(
+            "unable to create " + destDir,
+            destDir.canRead() || destDir.mkdirs());
+               AjcTask task = getTask("showweaveinfo.lst",destDir);
+               task.setOutxml(true);
+               checkRun(task,null);
+               File outxmlFile = new File(destDir,"META-INF/aop-ajc.xml");
+               assertTrue("META-INF/aop-ajc.xml missing",outxmlFile.exists());
+       }
+       
+       public void testOutxmlFile () {
+               String customName = "custom/aop.xml"; 
+        File destDir = getTempDir();
+        assertTrue(
+            "unable to create " + destDir,
+            destDir.canRead() || destDir.mkdirs());
+               AjcTask task = getTask("showweaveinfo.lst",destDir);
+               task.setOutxmlfile(customName);
+               checkRun(task,null);
+               File outxmlFile = new File(destDir,customName);
+               assertTrue(customName + " missing",outxmlFile.exists());
+       }
+
+    // End of test cases
+    // ------------------------------------------------------
+    // ------------------------------------------------------
+    // ------------------------------------------------------
+    // ------------------------------------------------------
+    // ------------------------------------------------------
+    // ------------------------------------------------------
+       protected void runTest(
+               AjcTask task,
+               Class exceptionType,
+               MessageHolderChecker checker,
+               String messageHolderClass) {
+               task.setMessageHolderClass(messageHolderClass);
+               runTest(task, exceptionType, checker, (MessageHandler) null);
+       }
+
+       protected void runTest(
+               AjcTask task,
+               Class exceptionType,
+               MessageHolderChecker checker) {
+               MessageHandler holder = new MessageHandler();
+               task.setMessageHolder(holder);
+               runTest(task, exceptionType, checker, holder);
+       }
+
+       protected void runTest(
+               AjcTask task,
+               Class exceptionType,
+               MessageHolderChecker checker,
+               MessageHandler holder) {
+               Throwable thrown = null;
+               // re-run forked iff tools.jar and expect to pass
+               boolean rerunForked =
+                       ((null != aspectjtoolsJar)
+                               && (null == exceptionType)
+                               && ((null == checker) || !checker.expectFail()));
+               String label = "same-vm ";
+               while (true) { // same vm, then perhaps forked   
+                       try {
+                               task.execute();
+                       } catch (Throwable t) {
+                               thrown = t;
+                       } finally {
+                               deleteTempDir();
+                       }
+                       if (null == exceptionType) {
+                               if (null != thrown) {
+                                       assertTrue(label + "thrown: " + render(thrown), false);
+                               }
+                       } else if (null == thrown) {
+                               assertTrue(
+                                       label + "expected " + exceptionType.getName(),
+                                       false);
+                       } else if (!(exceptionType.isAssignableFrom(thrown.getClass()))) {
+                               assertTrue(
+                                       label
+                                               + "expected "
+                                               + exceptionType.getName()
+                                               + " got "
+                                               + render(thrown),
+                                       false);
+                       }
+                       if (null != holder) {
+                               if (null == checker) {
+                                       checker = MessageHolderChecker.NONE;
+                               }
+                               checker.check(holder, label);
+                       }
+                       if (!rerunForked) {
+                               break;
+                       } else {
+                               label = "other-vm ";
+                               rerunForked = false;
+                               // can't reset without losing values...
+                               task.setFork(true);
+                               task.setFailonerror(true);
+                               task.setForkclasspath(
+                                       new Path(task.getProject(), aspectjtoolsJar));
+                       }
+               }
+       }
+
+       protected String render(Throwable thrown) {
+               return LangUtil.renderException(thrown);
+       }
+
+       static class MessageHolderChecker { // XXX export to testing-utils
+               /** use as value to ignore results */
+               static int IGNORE = Integer.MIN_VALUE;
+
+               static MessageHolderChecker NONE =
+                       new MessageHolderChecker(0, 0, 0, 0, 0);
+               /** any number (0+) of info messages */
+               static MessageHolderChecker INFOS =
+                       new MessageHolderChecker(0, 0, 0, 0, IGNORE);
+               /** one error, any number of info messages */
+               static MessageHolderChecker ONE_ERROR =
+                       new MessageHolderChecker(0, 0, 1, 0, IGNORE);
+               static MessageHolderChecker ONE_ERROR_ONE_ABORT =
+                       new MessageHolderChecker(1, 0, 1, 0, IGNORE);
+               /** one warning, any number of info messages */
+               static MessageHolderChecker ONE_WARNING =
+                       new MessageHolderChecker(0, 0, 0, 1, IGNORE);
+               static MessageHolderChecker THREE_ERRORS =
+                               new MessageHolderChecker(0, 0, 3, 0, IGNORE);
+               
+
+               int aborts, fails, errors, warnings, infos;
+               int weaveinfos;
+               public MessageHolderChecker(
+                       int aborts,
+                       int fails,
+                       int errors,
+                       int warnings,
+                       int infos) {
+                       this.aborts = aborts;
+                       this.fails = fails;
+                       this.errors = errors;
+                       this.warnings = warnings;
+                       this.infos = infos;
+                       this.weaveinfos = IGNORE;
+               }
+
+               public boolean expectFail() {
+                       return (0 < (aborts + fails + errors));
+               }
+
+               public void check(IMessageHolder holder, String label) {
+                       boolean failed = true;
+                       try {
+                               check(holder, aborts, IMessage.ABORT);
+                               check(holder, fails, IMessage.FAIL);
+                               check(holder, errors, IMessage.ERROR);
+                               check(holder, warnings, IMessage.WARNING);
+                               check(holder, infos, IMessage.INFO);
+                               check(holder, weaveinfos, IMessage.WEAVEINFO);
+                               failed = false;
+                       } finally {
+                               if (failed) {
+                                       MessageUtil.print(System.err, holder, label + "failed?");
+                               }
+                       }
+               }
+
+               private void check(
+                       IMessageHolder holder,
+                       int num,
+                       IMessage.Kind kind) {
+                       if (num != IGNORE) {
+                               int actual = holder.numMessages(kind, false);
+                               if (num != actual) {
+                                       if (actual > 0) {
+                                               MessageUtil.print(
+                                                       System.err,
+                                                       holder,
+                                                       kind + " expected " + num + " got " + actual);
+                                       }
+                                       assertEquals(kind.toString(), num, actual);
+                               }
+                       }
+               }
+       }
+    private static class LogListener implements BuildListener {
+        private final ArrayList results = new ArrayList();
+        private final int priority;
+        private LogListener(int priority) {
+            this.priority = priority;
+        }
+        @Override
+               public void buildFinished(BuildEvent event) {}
+        @Override
+               public void buildStarted(BuildEvent event) {}
+        @Override
+               public void messageLogged(BuildEvent event) {
+            if (priority == event.getPriority()) {
+                results.add(event.getMessage());
+            }
+        }
+        @Override
+               public void targetFinished(BuildEvent event) {}
+        @Override
+               public void targetStarted(BuildEvent event) {}
+        @Override
+               public void taskFinished(BuildEvent event) {}
+        @Override
+               public void taskStarted(BuildEvent event) {}
+        String[] getResults() {
+            return (String[]) results.toArray(new String[0]);
+        }
+    }
+}
+class SnoopingCommandEditor implements ICommandEditor {
+       private static final String[] NONE = new String[0];
+       String[] lastCommand;
+       @Override
+       public String[] editCommand(String[] command) {
+               lastCommand = (String[]) LangUtil.safeCopy(command, NONE);
+               return command;
+       }
+       public String[] lastCommand() {
+               return (String[]) LangUtil.safeCopy(lastCommand, NONE);
+       }
+}
+class VerboseCommandEditor implements ICommandEditor {
+       public static final String VERBOSE = "-verbose";
+       @Override
+       public String[] editCommand(String[] command) {
+               for (int i = 0; i < command.length; i++) {
+                       if (VERBOSE.equals(command[i])) {
+                               return command;
+                       }
+               }
+
+               String[] result = new String[1 + command.length];
+               result[0] = VERBOSE;
+               System.arraycopy(result, 1, command, 0, command.length);
+               return result;
+       }
+}
+
+class AppendingCommandEditor implements ICommandEditor {
+       private static String[] NONE = new String[0];
+       public static ICommandEditor VERBOSE =
+               new AppendingCommandEditor(new String[] { "-verbose" }, NONE);
+       public static ICommandEditor INVALID =
+               new AppendingCommandEditor(NONE, new String[] { "-invalidOption" });
+
+       final String[] prefix;
+       final String[] suffix;
+
+       public AppendingCommandEditor(String[] prefix, String[] suffix) {
+               this.prefix = prefix;
+               this.suffix = suffix;
+       }
+
+       @Override
+       public String[] editCommand(String[] command) {
+               int len = command.length + prefix.length + suffix.length;
+               String[] result = new String[len];
+               System.arraycopy(result, 0, prefix, 0, prefix.length);
+               System.arraycopy(result, prefix.length, command, 0, command.length);
+               System.arraycopy(
+                       result,
+                       prefix.length + command.length,
+                       suffix,
+                       0,
+                       suffix.length);
+               return result;
+       }
+}
diff --git a/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/AjdocTest.java b/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/AjdocTest.java
new file mode 100644 (file)
index 0000000..4527c6c
--- /dev/null
@@ -0,0 +1,56 @@
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation, 
+ *               2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation 
+ * ******************************************************************/
+
+package org.aspectj.tools.ant.taskdefs;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+/**
+ * 
+ */
+public class AjdocTest extends TestCase {
+
+       public AjdocTest(String name) {
+               super(name);
+       }
+
+    public void testSource14() {
+        new File("bin/AjdocTest").mkdirs();
+
+        Ajdoc task = new Ajdoc();
+        Project p = new Project();
+        task.setProject(p);
+        task.setSource("1.4");
+        Path ppath = new Path(p,"../taskdefs/testdata");
+        task.setSourcepath(ppath);
+        task.setIncludes("Ajdoc14Source.java");
+        task.setDestdir("bin/AjdocTest");
+        task.setClasspath(new Path(p, "../lib/test/aspectjrt.jar"));
+        task.execute();
+    }
+    
+    public void testHelp() {
+        Ajdoc task = new Ajdoc();
+        Project p = new Project();
+        task.setProject(p);
+        task.setSourcepath(new Path(p, "../taskdefs/testdata"));
+        task.setIncludes("none");
+        task.setDestdir("bin/AjdocTest");
+        task.execute();
+    }
+}
diff --git a/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/TaskdefsTests.java b/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/TaskdefsTests.java
new file mode 100644 (file)
index 0000000..ade396a
--- /dev/null
@@ -0,0 +1,35 @@
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation, 
+ *               2002 Palo Alto Research Center, Incorporated (PARC),
+ *               2003 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Xerox/PARC     initial implementation 
+ *     Wes Isberg     some 2003 tests
+ * ******************************************************************/
+
+
+package org.aspectj.tools.ant.taskdefs;
+
+import junit.framework.*;
+
+public class TaskdefsTests extends TestCase {
+
+    public static Test suite() { 
+        TestSuite suite = new TestSuite(TaskdefsTests.class.getName());
+        //$JUnit-BEGIN$        
+        suite.addTestSuite(Ajc11CompilerAdapterTest.class); 
+        suite.addTestSuite(AjdocTest.class); 
+        suite.addTestSuite(AjcTaskTest.class); 
+        //$JUnit-END$
+        return suite;
+    }
+
+    public TaskdefsTests(String name) { super(name); }
+
+}  
diff --git a/taskdefs/testsrc/org/aspectj/tools/ant/TaskdefsModuleTests.java b/taskdefs/testsrc/org/aspectj/tools/ant/TaskdefsModuleTests.java
deleted file mode 100644 (file)
index b47577e..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.aspectj.tools.ant;
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation, 
- *               2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Xerox/PARC     initial implementation 
- * ******************************************************************/
-
-
-// default package
-
-import junit.framework.*;
-
-public class TaskdefsModuleTests extends TestCase {
-
-    public static TestSuite suite() { 
-        TestSuite suite = new TestSuite(TaskdefsModuleTests.class.getName());
-        suite.addTest(org.aspectj.tools.ant.taskdefs.TaskdefsTests.suite()); 
-        return suite;
-    }
-
-    public TaskdefsModuleTests(String name) { super(name); }
-}  
diff --git a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java
deleted file mode 100644 (file)
index 3b95693..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2003 Contributors. 
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Wes Isberg     initial implementation 
- * ******************************************************************/
-
-package org.aspectj.tools.ant.taskdefs;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Javac;
-import org.apache.tools.ant.types.Path;
-import org.aspectj.util.FileUtil;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import junit.framework.TestCase;
-
-/**
- * 
- */
-public class Ajc11CompilerAdapterTest extends TestCase {
-    public static boolean LOGGING = false;
-    ArrayList tempFiles = new ArrayList();
-    
-    public Ajc11CompilerAdapterTest(String name) {
-        super(name);
-    }
-    
-    public void tearDown() {
-        for (Iterator iter = tempFiles.iterator(); iter.hasNext();) {
-            File file = (File) iter.next();
-            FileUtil.deleteContents(file);
-            file.delete();
-        }
-    }
-    
-//    public void testCompilerAdapterWithJavac() { // XXX requires tools.jar 
-//        Javac javac = getJavac(new Project());
-//        setupTracingJava(javac);
-//        javac.execute();
-//    }
-
-    public void testCompilerAdapterWithAjc() { // XXX unverified        
-        Project project = new Project();
-        String cname = Ajc11CompilerAdapter.class.getName();
-        project.setProperty("build.compiler", cname);
-        Javac javac = getJavac(project);
-        setupTracingJava(javac);
-        log("---- first compile...");
-        System.out.flush();
-        javac.execute();
-        log("---- second compile (none: nothing out of date?)...");
-        javac.execute(); 
-    }
-
-    public void testCompilerAdapterWithAjcRecursively() { // XXX unverified
-        Project project = new Project();
-        String cname = Ajc11CompilerAdapter.class.getName();
-        project.setProperty("build.compiler", cname);
-        project.setProperty("build.compiler.clean", "yes");
-        Javac javac = getJavac(project);
-        setupTracingJava(javac);
-        log("---- first compile...");
-        System.out.flush();
-        javac.execute();
-        log("---- second compile...");
-        System.out.flush();
-        javac.execute(); // expecting full recompile - pre-cleaned
-    }
-
-    Javac getJavac(Project project) {
-        Javac javac = new Javac();
-        javac.setProject(project);
-        File classesDir = FileUtil.getTempDir("Ajc11CompilerAdapterTest");
-        tempFiles.add(classesDir);
-        javac.setDestdir(classesDir);
-        javac.setVerbose(LOGGING);
-        String rtpath = "../lib/test/aspectjrt.jar";
-        File rt = new File(rtpath);
-        assertTrue("can read " + rtpath, rt.canRead());
-        javac.setClasspath(new Path(project, rt.getAbsolutePath()));
-        return javac;
-    }
-    
-    void setupTracingJava(Javac javac) { // XXX assumes module dir, doc loc
-        String exDir = "../docs/dist/doc/examples"; 
-        javac.setSrcdir(new Path(javac.getProject(), exDir));
-        javac.setIncludes("tracing/*.java"); // XXX assumes tracing example
-    }
-    void log(String s) {
-        if (LOGGING) {
-            System.err.println(s);
-        }
-    }
-}
diff --git a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java
deleted file mode 100644 (file)
index f7f3908..0000000
+++ /dev/null
@@ -1,1122 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation, 
- *               2002 Palo Alto Research Center, Incorporated (PARC)
- *               2003 Contributors.
- *               2005 Contributors
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Xerox/PARC     initial implementation
- *     IBM                 ongoing maintenance 
- * ******************************************************************/
-
-package org.aspectj.tools.ant.taskdefs;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-import org.apache.tools.ant.BuildEvent;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildListener;
-import org.apache.tools.ant.Location;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.selectors.FilenameSelector;
-import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.IMessageHolder;
-import org.aspectj.bridge.MessageHandler;
-import org.aspectj.bridge.MessageUtil;
-import org.aspectj.tools.ant.taskdefs.AjcTask.CompilerArg;
-import org.aspectj.util.FileUtil;
-import org.aspectj.util.LangUtil;
-
-import junit.framework.TestCase;
-
-/**
- * AjcTask test cases.
- * Please put new ones with others between ------- comments.
- * 
- * Some API tests, but mostly functional tests driving
- * the task execute using data in ../taskdefs/testdata.
- * This will re-run in forked mode for any nonfailing
- * compile if aspectjtools-dist is built into
- * ../aj-build/dist/tools/lib/aspectjtools.jar.
- */
-public class AjcTaskTest extends TestCase {
-
-       private static final Class NO_EXCEPTION = null;
-       private static final String NOFILE = "NOFILE";
-
-       private static final File tempDir;
-       private static final String aspectjtoolsJar;
-       private static final String testdataDir;
-       private static final StringBuffer MESSAGES = new StringBuffer();
-       /** accept writable .class files */
-       private static FileFilter PICK_CLASS_FILES;
-
-       static {
-               tempDir = new File("IncrementalAjcTaskTest-temp");
-               String toolsPath = "../aj-build/dist/tools/lib/aspectjtools.jar";
-               File toolsjar = new File(toolsPath);
-               if (toolsjar.canRead()) {
-                       aspectjtoolsJar = toolsjar.getAbsolutePath();
-               } else {
-                       aspectjtoolsJar = null;
-                       String s =
-                               "AjcTaskTest not forking - build aspectjtools-dist to get "
-                                       + toolsPath;
-                       System.out.println(s);
-               }
-               File dir = new File("../taskdefs/testdata");
-               if (dir.canRead() && dir.isDirectory()) {
-                       testdataDir = dir.getAbsolutePath();
-               } else {
-                       testdataDir = null;
-               }
-               PICK_CLASS_FILES = new FileFilter() {
-                       @Override
-                       public boolean accept(File file) {
-                               return (
-                                       (null != file)
-                                               && file.isFile()
-                                               && file.canWrite()
-                                               && file.getPath().endsWith(".class"));
-                       }
-
-               };
-       }
-
-       /** 
-         * Check that aspectjtools are found on the classpath,
-         * reporting any errors to System.err.
-         * 
-         * Run multiple times with different classpaths.
-         * This should find variants
-         * aspectjtools.jar,
-         * aspectj-tools.jar,
-         * aspectj-tools-1.1.jar, and
-         * aspectjtools-1.0.6.jar
-         * but not
-         * aspectjrt.jar or
-         * aspectj/tools.jar.
-         * XXX use testing aspect to stub out 
-         * <code>System.getProperty("java.class.path")</code>
-         * @param args a String[], first is expected path, if any
-         */
-       public static void main(String[] args) {
-               java.io.File toolsjar = AjcTask.findAspectjtoolsJar();
-               if ((null == args) || (0 == args.length)) {
-                       if (null != toolsjar) {
-                               System.err.println("FAIL - not expected: " + toolsjar);
-                       }
-               } else if ("-help".equals(args[0])) {
-                       System.out.println(
-                               "java "
-                                       + AjcTaskTest.class.getName()
-                                       + " <expectedPathToAspectjtoolsJar>");
-               } else if (null == toolsjar) {
-                       System.err.println("FAIL - expected: " + args[0]);
-               } else {
-                       String path = toolsjar.getAbsolutePath();
-                       if (!path.equals(args[0])) {
-                               System.err.println(
-                                       "FAIL - expected: " + args[0] + " actual: " + path);
-                       }
-               }
-       }
-
-       public static void collectMessage(String s) {
-               MESSAGES.append(s);
-       }
-
-       private static void deleteTempDir() {
-               if ((null != tempDir) && tempDir.exists()) {
-                       FileUtil.deleteContents(tempDir);
-                       tempDir.delete();
-                       // when tempDir not used...
-                       if (null != testdataDir) {
-                               File dataDir = new File(testdataDir);
-                               if (dataDir.canRead()) {
-                                       FileUtil.deleteContents(dataDir, PICK_CLASS_FILES, false);
-                               }
-                       }
-               }
-       }
-       private static final File getTempDir() {
-               return tempDir;
-       }
-
-       public AjcTaskTest(String name) {
-               super(name);
-       }
-
-       @Override
-       public void tearDown() {
-               deleteTempDir();
-               MESSAGES.setLength(0);
-       }
-    private void checkRun(AjcTask task, String exceptionString) {
-        try {
-            task.execute();
-            assertTrue(null == exceptionString);
-        } catch (BuildException e) {
-            if (null == exceptionString) {
-                assertTrue("unexpected " + e.getMessage(), false);
-            } else {
-                String m = e.getMessage();
-                if (null == m) {
-                    assertTrue("not " + exceptionString, false);
-                } else if (-1 == m.indexOf(exceptionString)) {
-                    assertEquals(exceptionString, e.getMessage());
-                }
-            }
-        }
-
-    }
-
-    private void checkContains(String[] cmd, String option, boolean contains) {
-        for (int i = 0; i < cmd.length; i++) {
-            if (option.equals(cmd[i])) {
-                if (contains) {
-                    return;
-                } else {
-                    assertTrue(
-                        "not expecting " + option + " in " + Arrays.asList(cmd),
-                        false);
-                }
-            }
-        }
-        if (contains) {
-            assertTrue(
-                "expecting " + option + " in " + Arrays.asList(cmd),
-                false);
-        }
-    }
-    protected AjcTask getTask(String input) {
-        return getTask(input, getTempDir());
-    }
-
-    protected AjcTask getTask(String input, File destDir) {
-        AjcTask task = new AjcTask();
-        Project p = new Project();
-        task.setProject(p);
-        if (null != destDir) {
-            task.setDestdir(destDir);
-        }
-        if (NOFILE.equals(input)) {
-            // add nothing
-        } else if (input.endsWith(".lst")) {
-            if (-1 != input.indexOf(",")) {
-                throw new IllegalArgumentException(
-                    "lists not supported: " + input);
-            } else if (null == testdataDir) {
-                throw new Error("testdata not found - run in ../taskdefs");
-            } else {
-                String path = testdataDir + File.separator + input;
-                task.setArgfiles(new Path(task.getProject(), path));
-            }
-        } else if ((input.endsWith(".java") || input.endsWith(".aj"))) {
-            FilenameSelector fns = new FilenameSelector();
-            fns.setName(input);
-            task.addFilename(fns);
-        } else {
-            String path = testdataDir + File.separator + input;
-            task.setSourceRoots(new Path(task.getProject(), path));
-        }
-        task.setClasspath(new Path(p, "../lib/test/aspectjrt.jar"));
-        return task;
-    }
-
-    /** used in testMessageHolderClassName */
-    public static class InfoHolder extends MessageHandler {
-        public InfoHolder() {
-        }
-        @Override
-               public boolean handleMessage(IMessage message) {
-            if (0 == IMessage.INFO.compareTo(message.getKind())) {
-                AjcTaskTest.collectMessage(message.getMessage());
-            }
-            return true;
-        }
-    }
-
-    /** used in testMessageHolderClassName */
-    public static class Holder extends MessageHandler {
-        public Holder() {
-        }
-        @Override
-               public boolean handleMessage(IMessage message) {
-            IMessage.Kind kind = message.getKind();
-            if (IMessage.ERROR.isSameOrLessThan(kind)) {
-                String m = kind.toString();
-                AjcTaskTest.collectMessage(m.substring(0, 1));
-            }
-            return true;
-        }
-    }
-
-    // ------------------------------------------------------
-    // ------------------------------------------------------
-    // ------------------------------------------------------
-    // ------------------------------------------------------
-    // ------------------------------------------------------
-    // ------------------------------------------------------
-    // Start of test cases
-    
-       public void testNullDestDir() {
-               AjcTask task = getTask(NOFILE, null);
-               String[] cmd = task.makeCommand();
-
-               for (int i = 0; i < cmd.length; i++) {
-                       assertTrue(!"-d".equals(cmd[i]));
-               }
-       }
-       
-       public void testOutputRequirement() {
-               AjcTask task = getTask("default.lst");
-               checkRun(task, null);
-
-               // copyInJars now just emits warning b/c unused
-               task = getTask("default.lst", null);
-               task.setCopyInjars(true);
-               checkRun(task, null);
-
-               // sourceRootCopyFilter requires destDir
-               task = getTask("default.lst", null);
-               task.setSourceRootCopyFilter("**/*.java");
-               checkRun(task, "sourceRoot");
-       }
-
-       public void testSourceRootCopyFilter() {
-               // sourceRootCopyFilter works..
-               File destDir = getTempDir();
-               assertTrue(
-                       "unable to create " + destDir,
-                       destDir.canRead() || destDir.mkdirs());
-               AjcTask task = getTask("sourceroot", destDir);
-               task.setSourceRootCopyFilter("doNotCopy,**/*.txt");
-               File file = new File(destDir, "Default.java").getAbsoluteFile();
-               assertTrue(file + ".canRead() prematurely", !file.canRead());
-               checkRun(task, null);
-               // got expected resources
-               assertTrue(file + ".canRead() failed", file.canRead());
-               File pack = new File(destDir, "pack");
-               file = new File(pack, "Pack.java").getAbsoluteFile();
-               assertTrue(file + ".canRead() failed", file.canRead());
-               file = new File(pack, "includeme").getAbsoluteFile();
-               assertTrue(file + ".canRead() failed", file.canRead());
-
-               // didn't get unexpected resources
-               file = new File(pack, "something.txt");
-               assertTrue(file + ".canRead() passed", !file.canRead());
-               file = new File(destDir, "doNotCopy");
-               assertTrue(file + ".canRead() passed", !file.canRead());
-               file = new File(destDir, "skipTxtFiles.txt");
-               assertTrue(file + ".canRead() passed", !file.canRead());
-       }
-
-    public void testInpathDirCopyFilter() {
-        // inpathDirCopyFilter works with output directory
-        File destDir = getTempDir();
-        assertTrue(
-            "unable to create " + destDir,
-            destDir.canRead() || destDir.mkdirs());
-        AjcTask task = getTask(NOFILE, destDir);        
-        Project p = task.getProject();
-        Path indirs = new Path(p);
-        File dir = new File(testdataDir, "inpathDirs").getAbsoluteFile();
-        indirs.addExisting(new Path(p, new File(dir, "inpathDirOne").getAbsolutePath()));
-        indirs.addExisting(new Path(p, new File(dir, "inpathDirTwo").getAbsolutePath()));
-        task.setInpath(indirs);
-        task.setInpathDirCopyFilter("doNotCopy,**/*.txt");
-        
-        File file = new File(destDir, "Default.java").getAbsoluteFile();
-        assertTrue(file + ".canRead() prematurely", !file.canRead());
-        checkRun(task, null);
-
-        // got expected resources
-        File pack = new File(destDir, "pack");
-        file = new File(pack, "includeme").getAbsoluteFile();
-        assertTrue(file + ".canRead() failed", file.canRead());
-        file = new File(pack, "Pack.class").getAbsoluteFile();
-        assertTrue(file + ".canRead() failed", file.canRead());
-        file = new File(destDir, "copyMe.htm").getAbsoluteFile();
-        assertTrue(file + ".canRead() failed", file.canRead());
-        file = new File(destDir, "Default.class").getAbsoluteFile();
-        assertTrue(file + ".canRead() failed", file.canRead());
-
-        // didn't get unexpected resources
-        file = new File(pack, "something.txt");
-        assertTrue(file + ".canRead() passed", !file.canRead());
-        file = new File(destDir, "doNotCopy");
-        assertTrue(file + ".canRead() passed", !file.canRead());
-        file = new File(destDir, "skipTxtFiles.txt");
-        assertTrue(file + ".canRead() passed", !file.canRead());
-    }
-    
-    public void testInpathDirCopyFilterWithJar() throws IOException {
-       checkInpathCopy("testInpathDirCopyFilterWithJar-out.jar");
-    }
-
-    // test resource copying for oddball jar files that don't end in .jar
-    public void testInpathDirCopyFilterWithOddjar() throws IOException {
-       checkInpathCopy("testInpathDirCopyFilterWithJar-outJarFile");
-    }
-    
-    private void checkInpathCopy(String outjarFileStr) throws IOException {
-        // inpathDirCopyFilter works with output jar
-        File destDir = getTempDir();
-        assertTrue(
-            "unable to create " + destDir,
-            destDir.canRead() || destDir.mkdirs());
-        AjcTask task = getTask(NOFILE, null);        
-        File destJar = new File(destDir, outjarFileStr);
-        task.setOutjar(destJar);
-        Project p = task.getProject();
-        Path indirs = new Path(p);
-        File dir = new File(testdataDir, "inpathDirs").getAbsoluteFile();
-        indirs.addExisting(new Path(p, new File(dir, "inpathDirOne").getAbsolutePath()));
-        indirs.addExisting(new Path(p, new File(dir, "inpathDirTwo").getAbsolutePath()));
-        task.setInpath(indirs);
-        task.setInpathDirCopyFilter("doNotCopy,**/*.txt,**/*.class");
-        
-        checkRun(task, null);
-
-        JarFile jarFile = new JarFile(destJar);
-        String[] expected = {"copyMe.htm", "pack/includeme", 
-                "pack/Pack.class", "Default.class"};
-        String[] unexpected = {"doNotCopy", "skipTxtFiles.txt", "pack/something.txt"};
-        for (int i = 0; i < expected.length; i++) {
-            JarEntry entry = jarFile.getJarEntry(expected[i]);
-            assertTrue(expected[i] + " not found", null != entry);
-        }
-        for (int i = 0; i < unexpected.length; i++) {
-            JarEntry entry = jarFile.getJarEntry(unexpected[i]);
-            assertTrue(unexpected[i] + " found", null == entry);
-        }
-    }
-
-    public void testInpathDirCopyFilterError() {
-        // inpathDirCopyFilter fails with no output directory or jar iff specified
-        AjcTask task = getTask(NOFILE, null);        
-        Project p = task.getProject();
-        Path indirs = new Path(p);
-        File dir = new File(testdataDir, "inpathDirs").getAbsoluteFile();
-        indirs.addExisting(new Path(p, new File(dir, "inpathDirOne").getAbsolutePath()));
-        indirs.addExisting(new Path(p, new File(dir, "inpathDirTwo").getAbsolutePath()));
-        task.setInpath(indirs);
-        task.setInpathDirCopyFilter("doNotCopy,**/*.txt,**/*.class");
-
-        // expecting error
-        checkRun(task, "inpathDirCopyFilter");
-    }
-
-       // this test method submitted by patch from Andrew Huff (IBM)
-       // verifies that the log attribute of AjcTask writes output to the given log file
-       public void testLoggingMode() {
-               AjcTask task = getTask("default.lst");
-               task.setFailonerror(false);
-               File logFile = new File("testLogFile1.txt");
-               String s = logFile.getAbsolutePath();
-               logFile.delete();
-               long initialLength = logFile.length();
-               task.setLog(logFile);
-               runTest(task,null,MessageHolderChecker.INFOS);
-               long newLength = logFile.length();
-               assertTrue(newLength > initialLength);
-               logFile.delete();
-       }
-
-
-       public void testCommandEditor() {
-               String className = VerboseCommandEditor.class.getName();
-               System.setProperty(AjcTask.COMMAND_EDITOR_NAME, className);
-               assertEquals(
-                       className,
-                       System.getProperty(AjcTask.COMMAND_EDITOR_NAME));
-               AjcTask task = getTask(NOFILE);
-               task.setCommandEditor(new VerboseCommandEditor());
-               String[] cmd = task.makeCommand();
-               assertEquals(VerboseCommandEditor.VERBOSE, cmd[0]);
-
-               task = getTask(NOFILE);
-               task.setCommandEditorClass(VerboseCommandEditor.class.getName());
-               cmd = task.makeCommand();
-               assertEquals(VerboseCommandEditor.VERBOSE, cmd[0]);
-       }
-       //    public void testStaticCommandEditor() {
-       //        // XXX need to test COMMAND_EDITOR, but can't require property when run
-       //    }
-
-       public void testLimitTo() {
-               int numArgs = 100;
-               String arg = "123456789";
-               String[] args = new String[numArgs];
-               for (int i = 0; i < args.length; i++) {
-                       args[i] = arg;
-               }
-               // no limit
-               int max = numArgs * (arg.length() + 1);
-               Location location = new Location("AjcTaskTest.java");
-               String[] newArgs = AjcTask.GuardedCommand.limitTo(args, max, location);
-               assertTrue("same", args == newArgs);
-
-               // limited - read file and verify arguments
-               max--;
-               newArgs = AjcTask.GuardedCommand.limitTo(args, max, location);
-               assertTrue("not same", args != newArgs);
-               assertTrue("not null", null != newArgs);
-               String label = "newArgs " + Arrays.asList(newArgs);
-               assertTrue("size 2" + label, 2 == newArgs.length);
-               assertEquals("-argfile", newArgs[0]);
-               File file = new File(newArgs[1]);
-               assertTrue("readable newArgs[1]" + label, file.canRead());
-               FileReader fin = null;
-               try {
-                       fin = new FileReader(file);
-                       BufferedReader reader = new BufferedReader(fin);
-                       String line;
-                       int i = 0;
-                       while (null != (line = reader.readLine())) {
-                               assertEquals(i + ": ", args[i++], line);
-                       }
-                       assertEquals("num entries", i, args.length);
-               } catch (IOException e) {
-                       assertTrue("IOException " + e.getMessage(), false);
-               } finally {
-                       if (null != fin) {
-                               try {
-                                       fin.close();
-                               } catch (IOException e) {
-                                       // ignore
-                               }
-                       }
-                       file.delete();
-               }
-       }
-
-       public void testFindAspectjtoolsJar() {
-               File toolsJar = AjcTask.findAspectjtoolsJar();
-               if (null != toolsJar) {
-                       assertNull("tools jar found?: " + toolsJar, toolsJar);
-               }
-               // not found when unit testing b/c not on system classpath
-               // so just checking for exceptions.
-               // XXX need aspect to stub out System.getProperty(..) 
-       }
-
-
-       public void testMessageHolderClassName() {
-               AjcTask task = getTask("compileError.lst");
-               task.setFailonerror(false);
-               MESSAGES.setLength(0);
-               runTest(
-                       task,
-                       null,
-                       MessageHolderChecker.ONE_ERROR,
-                       Holder.class.getName());
-               String result = MESSAGES.toString();
-               MESSAGES.setLength(0);
-               // The test program produces three errors with the current 1.8 compiler, this may change by 1.8 release and so
-               // this will need reverting back to "e"
-               assertEquals("messages", "eee", result);
-       }
-
-    // TODO skipped test - works locally but not on build machine?
-    public void skip_testMessageHolderClassWithDoneSignal() {
-        AjcTask task = getTask("default.lst");
-        task.setFailonerror(false);
-        String DONE = "This is a unique message, not confused with others.";
-        task.setXDoneSignal(DONE);
-        MESSAGES.setLength(0);
-        runTest(
-            task,
-            null,
-            MessageHolderChecker.INFOS,
-            InfoHolder.class.getName());
-        final String result = MESSAGES.toString();
-        String temp = new String(result);
-        MESSAGES.setLength(0);
-        if (!temp.endsWith(DONE)) {
-            if (temp.length() > 20) {
-                temp = "..." + temp.substring(temp.length()-20, temp.length());
-            }
-            assertTrue(DONE + " is not suffix of \"" + temp + "\"", false);
-        }
-        // exactly one such message
-        temp = new String(result);
-        temp = temp.substring(0, temp.length()-DONE.length());
-        if (temp.endsWith(DONE)) {
-            temp = new String(result);
-            if (temp.length() > 20) {
-                temp = "..." + temp.substring(temp.length()-20, temp.length());
-            }
-            assertTrue(DONE + " signalled twice: \"" + temp + "\"", false);
-        }
-    }
-
-       public void testDefaultListForkedNoTools() {
-               AjcTask task = getTask("default.lst");
-               task.setFork(true);
-               boolean passed = false;
-               try {
-                       runTest(task, BuildException.class, MessageHolderChecker.NONE);
-                       passed = true;
-               } finally {
-                       if (!passed) {
-                               String m =
-                                       "AjcTaskTest.testDefaultListForkedNoTools()"
-                                               + " fails if aspectjtools.jar is on the classpath";
-                               System.err.println(m);
-                       }
-               }
-       }
-
-       public void testDefaultListForkedIncremental() {
-               AjcTask task = getTask("default.lst");
-               task.setFork(true);
-               task.setIncremental(true);
-               runTest(task, BuildException.class, MessageHolderChecker.NONE);
-       }
-
-       /** failonerror should default to true, unlike other booleans */
-       public void testCompileErrorFailOnErrorDefault() {
-               AjcTask task = getTask("compileError.lst");
-        final PrintStream serr = System.err;
-        try {
-            System.setErr(new PrintStream(new java.io.ByteArrayOutputStream()));
-            // Current 1.8 compiler produces 3 errors for this test program, may need reverting to ONE_ERROR by release
-            runTest(task, BuildException.class, MessageHolderChecker.THREE_ERRORS);
-        } finally {
-            System.setErr(serr);
-        }
-       }
-    public void testCompileErrorListDefaultHolder() {
-        AjcTask task = getTask("compileError.lst");
-        final PrintStream serr = System.err;
-        try {
-            System.setErr(new PrintStream(new java.io.ByteArrayOutputStream()));
-            task.execute();
-            fail("expected BuildException from failed compile by default");
-        } catch (BuildException t) {
-            // ok
-        } finally {
-            System.setErr(serr);
-            deleteTempDir();
-        }
-    }
-
-       public void testDefaultList() {
-               AjcTask task = getTask("default.lst");
-               runTest(task, NO_EXCEPTION, MessageHolderChecker.INFOS);
-       }
-
-       public void testCompileErrorList() {
-               AjcTask task = getTask("compileError.lst");
-               task.setFailonerror(false);
-               // Prior to the 1.8 compiler there is one error here, 'syntax error on here'
-               // With 1.8 there are 3 errors about completing the method header, ending the class body, ending the method - this may
-               // change by 1.8 final... this might need reverting back to ONE_ERROR
-               runTest(task, NO_EXCEPTION, MessageHolderChecker.THREE_ERRORS);
-       }
-       
-       public void testShowWeaveInfo() {
-               AjcTask task = getTask("showweaveinfo.lst");
-               task.setShowWeaveInfo(true);
-               MessageHandler mh = new MessageHandler(false);
-               mh.dontIgnore(IMessage.WEAVEINFO);
-               MessageHolderChecker mhc = new MessageHolderChecker(0,0,0,0,MessageHolderChecker.IGNORE);
-               mhc.weaveinfos = 2; // Expect 2 weaving messages
-               runTest(task,NO_EXCEPTION,mhc);
-               mhc.weaveinfos = MessageHolderChecker.IGNORE;
-       }
-
-       public void testCompileWarningList() {
-               AjcTask task = getTask("compileWarning.lst");
-               runTest(task, NO_EXCEPTION, MessageHolderChecker.ONE_WARNING);
-       }
-
-       public void testNoSuchFileList() {
-               AjcTask task = getTask("NoSuchFile.lst");
-               task.setFailonerror(false);
-               runTest(task, NO_EXCEPTION, MessageHolderChecker.ONE_ERROR_ONE_ABORT);
-       }
-
-       public void testVersions() {
-        String[] inputs = AjcTask.TARGET_INPUTS;
-               for (int i = 0; i < inputs.length; i++) {
-                       AjcTask task = getTask(NOFILE);
-            task.setTarget(inputs[i]);
-                       String[] cmd = task.makeCommand();
-            checkContains(cmd, "-target", true);
-            checkContains(cmd, inputs[i], true);
-               }
-
-        inputs = AjcTask.SOURCE_INPUTS;
-        for (int i = 0; i < inputs.length; i++) {
-            AjcTask task = getTask(NOFILE);
-            task.setSource(inputs[i]);
-            String[] cmd = task.makeCommand();
-            checkContains(cmd, "-source", true);
-            checkContains(cmd, inputs[i], true);
-        }
-
-        inputs = AjcTask.COMPLIANCE_INPUTS;
-        for (int i = 0; i < inputs.length; i++) {
-            AjcTask task = getTask(NOFILE);
-            task.setCompliance(inputs[i]);
-            String[] cmd = task.makeCommand();
-            checkContains(cmd, inputs[i], true);
-        }
-       }
-    
-       public void testClasspath() {
-               AjcTask task = getTask(NOFILE);
-               String[] cmd = task.makeCommand();
-        checkContains(cmd, "-bootclasspath", false);
-               String classpath = null;
-               for (int i = 0; i < cmd.length; i++) {
-                       if ("-classpath".equals(cmd[i])) {
-                               classpath = cmd[i + 1];
-                break;
-                       }
-               }
-               assertTrue(
-                       "expecting aspectj in classpath",
-                       (-1 != classpath.indexOf("aspectjrt.jar")));
-       }
-       
-       CompilerArg createCompilerArg(String value) {
-               CompilerArg c = new CompilerArg();
-               c.setValue(value);
-               return c;
-       }
-       
-       public void testAddModulesJ9() {
-               AjcTask task = getTask(NOFILE);
-               task.createCompilerarg().setValue("--add-modules");
-               task.createCompilerarg().setValue("java.xml.bind,java.io");
-               String[] cmd = task.makeCommand();
-               System.out.println(Arrays.toString(cmd));
-               int addModulesPos = findOptionPosition(cmd,"--add-modules");
-               assertNotSame(-1, addModulesPos);
-               assertEquals("java.xml.bind,java.io",cmd[addModulesPos+1]);
-       }
-       
-       private int findOptionPosition(String[] cmd, String optionString) {
-               for (int i=0;i<cmd.length;i++) {
-                       if (cmd[i].equals(optionString)) {
-                               return i;
-                       }
-               }
-               return -1;
-       }
-
-       // ---------------------------------------- sourcefile
-       // XXX need to figure out how to specify files directly programmatically
-       //    public void testDefaultFile() {
-       //        AjcTask task = getTask("testdata/Default.java");
-       //        runTest(task, NO_EXCEPTION, MessageHolderChecker.INFOS);
-       //    }
-
-       public void testNoFile() {
-               AjcTask task = getTask(NOFILE);
-               task.setFailonerror(false);
-               runTest(task, NO_EXCEPTION, MessageHolderChecker.ONE_ERROR_ONE_ABORT);
-       }
-
-       public void testCompileErrorFile() {
-               AjcTask task = getTask("compileError.lst");
-               task.setFailonerror(false);
-               // 1.8 compiler currently produces 3 errors for the test program, may need to revert to ONE_ERROR by 1.8 release
-               runTest(task, NO_EXCEPTION, MessageHolderChecker.THREE_ERRORS);
-       }
-
-       public void testCompileWarningFile() {
-               AjcTask task = getTask("compileWarning.lst");
-               task.setFailonerror(false);
-               runTest(task, NO_EXCEPTION, MessageHolderChecker.ONE_WARNING);
-       }
-
-       public void testNoSuchFile() {
-               AjcTask task = getTask("NoSuchFile.lst");
-               task.setFailonerror(false);
-               runTest(task, NO_EXCEPTION, MessageHolderChecker.ONE_ERROR_ONE_ABORT);
-       }
-
-    public void testDefaultFileComplete() {
-        AjcTask task = getTask("default.lst");
-        defaultSettings(task);
-        runTest(task, NO_EXCEPTION, MessageHolderChecker.INFOS);
-    }
-    private void defaultSettings(AjcTask task) {
-        task.setDebugLevel("none");
-        task.setDeprecation(true);
-        task.setFailonerror(false);
-        task.setNoExit(true); // ok to override Ant?
-        task.setNoImportError(true);
-        task.setNowarn(true);
-        task.setXTerminateAfterCompilation(true);
-        task.setPreserveAllLocals(true);
-        task.setProceedOnError(true);
-        task.setReferenceInfo(true);
-        task.setSource("1.3");
-        task.setTarget("1.1");
-        task.setTime(true);
-        task.setVerbose(true);
-        task.setXlint("info");        
-    }
-    
-    public void testLogCommand() {
-        final String DEFAULT = "default.lst";
-        AjcTask task = getTask(DEFAULT);
-        defaultSettings(task);
-        task.setVerbose(false);
-        task.setLogCommand(true);
-        LogListener listener = new LogListener(Project.MSG_INFO);
-        task.getProject().addBuildListener(listener);
-        runTest(task, NO_EXCEPTION, MessageHolderChecker.INFOS);
-        String[] results = listener.getResults();
-        boolean matched = false;
-        for (int i = 0; !matched && (i < results.length); i++) {
-            String s = results[i];
-            matched = (null != s) && (-1 != s.indexOf(DEFAULT));
-        }
-        if (!matched) {
-            fail(DEFAULT + " not found in " + Arrays.asList(results));
-        }
-    }
-
-       public void testXOptions() {
-               String[] xopts = new String[] {
-                       "serializableAspects",
-                       "lazyTjp",
-                       "reweavable",
-                       "reweavable:compress",
-                       "noInline"
-               };
-               for (int i = 0; i < xopts.length; i++) {
-                       AjcTask task = getTask(NOFILE);
-                       task.setX(xopts[i]);
-                       String[] cmd = task.makeCommand();
-                       checkContains(cmd,"-X" + xopts[i],true);
-               }
-               
-       }
-
-  public void testAptProc() {
-    AjcTask task = getTask(NOFILE);
-    task.setProc("none");
-    checkContains(task.makeCommand(), "-proc:none", true);
-    task.setProc("only");
-    checkContains(task.makeCommand(), "-proc:only", true);
-  }
-
-  public void testAptProcessor() {
-    AjcTask task = getTask(NOFILE);
-    task.setProcessor("some.SomeClass");
-    checkContains(task.makeCommand(), "-processor", true);
-    checkContains(task.makeCommand(), "some.SomeClass", true);
-  }
-
-  public void testAptProcessorpath() {
-    AjcTask task = getTask(NOFILE);
-    task.setProcessorpath("some/path");
-    checkContains(task.makeCommand(), "-processorpath", true);
-    checkContains(task.makeCommand(), "some/path", true);
-  }
-
-  public void testAptGeneratedDirectory() {
-    AjcTask task = getTask(NOFILE);
-    task.setS("some/path");
-    checkContains(task.makeCommand(), "-s", true);
-    checkContains(task.makeCommand(), "some/path", true);
-  }
-       
-       public void testOutxml () {
-        File destDir = getTempDir();
-        assertTrue(
-            "unable to create " + destDir,
-            destDir.canRead() || destDir.mkdirs());
-               AjcTask task = getTask("showweaveinfo.lst",destDir);
-               task.setOutxml(true);
-               checkRun(task,null);
-               File outxmlFile = new File(destDir,"META-INF/aop-ajc.xml");
-               assertTrue("META-INF/aop-ajc.xml missing",outxmlFile.exists());
-       }
-       
-       public void testOutxmlFile () {
-               String customName = "custom/aop.xml"; 
-        File destDir = getTempDir();
-        assertTrue(
-            "unable to create " + destDir,
-            destDir.canRead() || destDir.mkdirs());
-               AjcTask task = getTask("showweaveinfo.lst",destDir);
-               task.setOutxmlfile(customName);
-               checkRun(task,null);
-               File outxmlFile = new File(destDir,customName);
-               assertTrue(customName + " missing",outxmlFile.exists());
-       }
-
-    // End of test cases
-    // ------------------------------------------------------
-    // ------------------------------------------------------
-    // ------------------------------------------------------
-    // ------------------------------------------------------
-    // ------------------------------------------------------
-    // ------------------------------------------------------
-       protected void runTest(
-               AjcTask task,
-               Class exceptionType,
-               MessageHolderChecker checker,
-               String messageHolderClass) {
-               task.setMessageHolderClass(messageHolderClass);
-               runTest(task, exceptionType, checker, (MessageHandler) null);
-       }
-
-       protected void runTest(
-               AjcTask task,
-               Class exceptionType,
-               MessageHolderChecker checker) {
-               MessageHandler holder = new MessageHandler();
-               task.setMessageHolder(holder);
-               runTest(task, exceptionType, checker, holder);
-       }
-
-       protected void runTest(
-               AjcTask task,
-               Class exceptionType,
-               MessageHolderChecker checker,
-               MessageHandler holder) {
-               Throwable thrown = null;
-               // re-run forked iff tools.jar and expect to pass
-               boolean rerunForked =
-                       ((null != aspectjtoolsJar)
-                               && (null == exceptionType)
-                               && ((null == checker) || !checker.expectFail()));
-               String label = "same-vm ";
-               while (true) { // same vm, then perhaps forked   
-                       try {
-                               task.execute();
-                       } catch (Throwable t) {
-                               thrown = t;
-                       } finally {
-                               deleteTempDir();
-                       }
-                       if (null == exceptionType) {
-                               if (null != thrown) {
-                                       assertTrue(label + "thrown: " + render(thrown), false);
-                               }
-                       } else if (null == thrown) {
-                               assertTrue(
-                                       label + "expected " + exceptionType.getName(),
-                                       false);
-                       } else if (!(exceptionType.isAssignableFrom(thrown.getClass()))) {
-                               assertTrue(
-                                       label
-                                               + "expected "
-                                               + exceptionType.getName()
-                                               + " got "
-                                               + render(thrown),
-                                       false);
-                       }
-                       if (null != holder) {
-                               if (null == checker) {
-                                       checker = MessageHolderChecker.NONE;
-                               }
-                               checker.check(holder, label);
-                       }
-                       if (!rerunForked) {
-                               break;
-                       } else {
-                               label = "other-vm ";
-                               rerunForked = false;
-                               // can't reset without losing values...
-                               task.setFork(true);
-                               task.setFailonerror(true);
-                               task.setForkclasspath(
-                                       new Path(task.getProject(), aspectjtoolsJar));
-                       }
-               }
-       }
-
-       protected String render(Throwable thrown) {
-               return LangUtil.renderException(thrown);
-       }
-
-       static class MessageHolderChecker { // XXX export to testing-utils
-               /** use as value to ignore results */
-               static int IGNORE = Integer.MIN_VALUE;
-
-               static MessageHolderChecker NONE =
-                       new MessageHolderChecker(0, 0, 0, 0, 0);
-               /** any number (0+) of info messages */
-               static MessageHolderChecker INFOS =
-                       new MessageHolderChecker(0, 0, 0, 0, IGNORE);
-               /** one error, any number of info messages */
-               static MessageHolderChecker ONE_ERROR =
-                       new MessageHolderChecker(0, 0, 1, 0, IGNORE);
-               static MessageHolderChecker ONE_ERROR_ONE_ABORT =
-                       new MessageHolderChecker(1, 0, 1, 0, IGNORE);
-               /** one warning, any number of info messages */
-               static MessageHolderChecker ONE_WARNING =
-                       new MessageHolderChecker(0, 0, 0, 1, IGNORE);
-               static MessageHolderChecker THREE_ERRORS =
-                               new MessageHolderChecker(0, 0, 3, 0, IGNORE);
-               
-
-               int aborts, fails, errors, warnings, infos;
-               int weaveinfos;
-               public MessageHolderChecker(
-                       int aborts,
-                       int fails,
-                       int errors,
-                       int warnings,
-                       int infos) {
-                       this.aborts = aborts;
-                       this.fails = fails;
-                       this.errors = errors;
-                       this.warnings = warnings;
-                       this.infos = infos;
-                       this.weaveinfos = IGNORE;
-               }
-
-               public boolean expectFail() {
-                       return (0 < (aborts + fails + errors));
-               }
-
-               public void check(IMessageHolder holder, String label) {
-                       boolean failed = true;
-                       try {
-                               check(holder, aborts, IMessage.ABORT);
-                               check(holder, fails, IMessage.FAIL);
-                               check(holder, errors, IMessage.ERROR);
-                               check(holder, warnings, IMessage.WARNING);
-                               check(holder, infos, IMessage.INFO);
-                               check(holder, weaveinfos, IMessage.WEAVEINFO);
-                               failed = false;
-                       } finally {
-                               if (failed) {
-                                       MessageUtil.print(System.err, holder, label + "failed?");
-                               }
-                       }
-               }
-
-               private void check(
-                       IMessageHolder holder,
-                       int num,
-                       IMessage.Kind kind) {
-                       if (num != IGNORE) {
-                               int actual = holder.numMessages(kind, false);
-                               if (num != actual) {
-                                       if (actual > 0) {
-                                               MessageUtil.print(
-                                                       System.err,
-                                                       holder,
-                                                       kind + " expected " + num + " got " + actual);
-                                       }
-                                       assertEquals(kind.toString(), num, actual);
-                               }
-                       }
-               }
-       }
-    private static class LogListener implements BuildListener {
-        private final ArrayList results = new ArrayList();
-        private final int priority;
-        private LogListener(int priority) {
-            this.priority = priority;
-        }
-        @Override
-               public void buildFinished(BuildEvent event) {}
-        @Override
-               public void buildStarted(BuildEvent event) {}
-        @Override
-               public void messageLogged(BuildEvent event) {
-            if (priority == event.getPriority()) {
-                results.add(event.getMessage());
-            }
-        }
-        @Override
-               public void targetFinished(BuildEvent event) {}
-        @Override
-               public void targetStarted(BuildEvent event) {}
-        @Override
-               public void taskFinished(BuildEvent event) {}
-        @Override
-               public void taskStarted(BuildEvent event) {}
-        String[] getResults() {
-            return (String[]) results.toArray(new String[0]);
-        }
-    }
-}
-class SnoopingCommandEditor implements ICommandEditor {
-       private static final String[] NONE = new String[0];
-       String[] lastCommand;
-       @Override
-       public String[] editCommand(String[] command) {
-               lastCommand = (String[]) LangUtil.safeCopy(command, NONE);
-               return command;
-       }
-       public String[] lastCommand() {
-               return (String[]) LangUtil.safeCopy(lastCommand, NONE);
-       }
-}
-class VerboseCommandEditor implements ICommandEditor {
-       public static final String VERBOSE = "-verbose";
-       @Override
-       public String[] editCommand(String[] command) {
-               for (int i = 0; i < command.length; i++) {
-                       if (VERBOSE.equals(command[i])) {
-                               return command;
-                       }
-               }
-
-               String[] result = new String[1 + command.length];
-               result[0] = VERBOSE;
-               System.arraycopy(result, 1, command, 0, command.length);
-               return result;
-       }
-}
-
-class AppendingCommandEditor implements ICommandEditor {
-       private static String[] NONE = new String[0];
-       public static ICommandEditor VERBOSE =
-               new AppendingCommandEditor(new String[] { "-verbose" }, NONE);
-       public static ICommandEditor INVALID =
-               new AppendingCommandEditor(NONE, new String[] { "-invalidOption" });
-
-       final String[] prefix;
-       final String[] suffix;
-
-       public AppendingCommandEditor(String[] prefix, String[] suffix) {
-               this.prefix = prefix;
-               this.suffix = suffix;
-       }
-
-       @Override
-       public String[] editCommand(String[] command) {
-               int len = command.length + prefix.length + suffix.length;
-               String[] result = new String[len];
-               System.arraycopy(result, 0, prefix, 0, prefix.length);
-               System.arraycopy(result, prefix.length, command, 0, command.length);
-               System.arraycopy(
-                       result,
-                       prefix.length + command.length,
-                       suffix,
-                       0,
-                       suffix.length);
-               return result;
-       }
-}
diff --git a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjdocTest.java b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjdocTest.java
deleted file mode 100644 (file)
index 4527c6c..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation, 
- *               2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Xerox/PARC     initial implementation 
- * ******************************************************************/
-
-package org.aspectj.tools.ant.taskdefs;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.Path;
-
-import java.io.File;
-
-import junit.framework.TestCase;
-
-/**
- * 
- */
-public class AjdocTest extends TestCase {
-
-       public AjdocTest(String name) {
-               super(name);
-       }
-
-    public void testSource14() {
-        new File("bin/AjdocTest").mkdirs();
-
-        Ajdoc task = new Ajdoc();
-        Project p = new Project();
-        task.setProject(p);
-        task.setSource("1.4");
-        Path ppath = new Path(p,"../taskdefs/testdata");
-        task.setSourcepath(ppath);
-        task.setIncludes("Ajdoc14Source.java");
-        task.setDestdir("bin/AjdocTest");
-        task.setClasspath(new Path(p, "../lib/test/aspectjrt.jar"));
-        task.execute();
-    }
-    
-    public void testHelp() {
-        Ajdoc task = new Ajdoc();
-        Project p = new Project();
-        task.setProject(p);
-        task.setSourcepath(new Path(p, "../taskdefs/testdata"));
-        task.setIncludes("none");
-        task.setDestdir("bin/AjdocTest");
-        task.execute();
-    }
-}
diff --git a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/TaskdefsTests.java b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/TaskdefsTests.java
deleted file mode 100644 (file)
index ade396a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation, 
- *               2002 Palo Alto Research Center, Incorporated (PARC),
- *               2003 Contributors.
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Xerox/PARC     initial implementation 
- *     Wes Isberg     some 2003 tests
- * ******************************************************************/
-
-
-package org.aspectj.tools.ant.taskdefs;
-
-import junit.framework.*;
-
-public class TaskdefsTests extends TestCase {
-
-    public static Test suite() { 
-        TestSuite suite = new TestSuite(TaskdefsTests.class.getName());
-        //$JUnit-BEGIN$        
-        suite.addTestSuite(Ajc11CompilerAdapterTest.class); 
-        suite.addTestSuite(AjdocTest.class); 
-        suite.addTestSuite(AjcTaskTest.class); 
-        //$JUnit-END$
-        return suite;
-    }
-
-    public TaskdefsTests(String name) { super(name); }
-
-}