bodewig     00/09/06 07:05:03

  Modified:    .        build.xml
               docs     index.html junit.html
               src/main/org/apache/tools/ant/taskdefs Java.java Javac.java
                        Javadoc.java Rmic.java
               src/main/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitTask.java
  Log:
  Removed all nested <classpathref> elements in favor of <classpath
  refid="...">.
  
  Revision  Changes    Path
  1.66      +7 -5      jakarta-ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/build.xml,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- build.xml 2000/09/05 08:53:26     1.65
  +++ build.xml 2000/09/06 14:04:55     1.66
  @@ -27,7 +27,8 @@
     <property name="build.tests" value="${build.dir}/testcases"/>
     <property name="ant.dist.dir" value="../dist/ant"/>
   
  -  <property name="classpath" value=""/>
  +  <path id="classpath">
  +  </path>
     <property name="packages" value="org.apache.tools.*"/>
     <property name="manifest" value="src/etc/manifest"/>
   
  @@ -79,10 +80,11 @@
   
       <javac srcdir="${src.dir}"
              destdir="${build.classes}"
  -           classpath="${classpath}"
              debug="on"
              deprecation="off"
              optimize="on" >
  +      <classpath refid="classpath" />
  +
         <exclude name="**/Script.java" unless="bsf.present" />
         <exclude name="**/NetRexxC.java" unless="netrexx.present" />
         <exclude name="**/XslpLiaison.java" unless="xslp.present" />
  @@ -282,7 +284,7 @@
              optimize="on" >
         <classpath>
           <pathelement location="${lib.dir}/${name}.jar" />
  -        <pathelement path="${classpath}" />
  +        <path refid="classpath" />
         </classpath>
         <include name="**/*.java"/>
         <exclude name="**/AllJUnitTests.java" unless="junit.present" />
  @@ -308,7 +310,7 @@
         <classpath>
           <pathelement location="${lib.dir}/${name}.jar" />
           <pathelement location="${build.tests}" />
  -        <pathelement path="${classpath}" />
  +        <path refid="classpath" />
           <pathelement path="${java.class.path}" />
         </classpath>
   
  @@ -328,7 +330,7 @@
         <classpath>
           <pathelement location="${lib.dir}/${name}.jar" />
           <pathelement location="${build.tests}" />
  -        <pathelement path="${classpath}" />
  +        <path refid="classpath" />
           <pathelement path="${java.class.path}" />
         </classpath>
       </java>
  
  
  
  1.92      +11 -21    jakarta-ant/docs/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/index.html,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- index.html        2000/09/06 12:03:07     1.91
  +++ index.html        2000/09/06 14:04:56     1.92
  @@ -573,13 +573,13 @@
   
     &lt;target ... &gt;
       &lt;rmic ...&gt;
  -      &lt;classpathref refid=&quot;project.class.path&quot; /&gt;
  +      &lt;classpath refid=&quot;project.class.path&quot; /&gt;
       &lt;/rmic&gt;
     &lt;/target&gt;
   
     &lt;target ... &gt;
       &lt;javac ...&gt;
  -      &lt;classpathref refid=&quot;project.class.path&quot; /&gt;
  +      &lt;classpath refid=&quot;project.class.path&quot; /&gt;
       &lt;/javac&gt;
     &lt;/target&gt;
   &lt;/project&gt;
  @@ -2263,12 +2263,10 @@
   <p>Use nested <code>&lt;arg&gt;</code> and <code>&lt;jvmarg&gt;</code>
   elements to specify arguments for the or the forked VM. See <a
   href="index.html#arg">Command line arguments</a>.</p>
  -<h4>classpath and classpathref</h4>
  +<h4>classpath</h4>
   <p><code>Java</code>'s <em>classpath</em> attribute is a <a
   href="#path">PATH like structure</a> and can also be set via a nested
  -<em>classpath</em> element. PATHs defined elsewhere can be
  -<a href="#references">referred</a> to via nested <em>classpathref</em>
  -elements.</p>
  +<em>classpath</em> element.</p>
   <h5>Example</h5>
   <pre>  
          &lt;java classname=&quot;test.Main&quot; &gt;
  @@ -2429,14 +2427,12 @@
   <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code>,
   <code>&lt;patternset&gt;</code> and <code>&lt;patternsetref&gt;</code>
   elements.</p>
  -<h4>src, classpath, classpathref, bootclasspath, bootclasspathref and 
extdirs</h4>
  +<h4>src, classpath, bootclasspath and extdirs</h4>
   <p><code>Javac</code>'s <em>srcdir</em>, <em>classpath</em>,
   <em>bootclasspath</em> and <em>extdirs</em> attributes are <a
   href="#path">PATH like structure</a> and can also be set via nested
   <em>src</em>, <em>classpath</em>, <em>bootclasspath</em> and
  -<em>extdirs</em> elements respectively. PATHs defined elsewhere can be
  -<a href="#references">referred</a> to via nested <em>classpathref</em>
  -and <em>bootclasspathref</em> elements.</p>
  +<em>extdirs</em> elements respectively.</p>
   
   <h3>Examples</h3>
   <pre>  &lt;javac srcdir=&quot;${src}&quot;
  @@ -2525,8 +2521,7 @@
       <td valign="top">Specify where to find source files</td>
       <td align="center" valign="top">all</td>
       <td align="center" rowspan="2">At least one of the two or nested
  -      <code>&lt;sourcepath&gt;</code> or
  -      <code>&lt;sourcepathref&gt;</code></td>
  +      <code>&lt;sourcepath&gt;</code></td>
     </tr>
     <tr>
       <td valign="top">sourcepathref</td>
  @@ -2885,15 +2880,12 @@
     </tr>
   </table>
   
  -<h4>sourcepath, classpath, bootclasspath, sourcepathref, classpathref
  -and bootclasspathref</h4>
  +<h4>sourcepath, classpath and bootclasspath</h4>
   <p><code>Javadoc</code>'s <em>sourcepath</em>, <em>classpath</em> and
   <em>bootclasspath</em> attributes are <a href="#path">PATH like
   structure</a> and can also be set via nested <em>sourcepath</em>,
   <em>classpath</em> and <em>bootclasspath</em> elements
  -respectively. PATHs defined elsewhere can be <a
  -href="#references">referred</a> to via nested <em>sourcepathref</em>,
  -<em>classpathref</em> and <em>bootclasspathref</em> elements.</p>
  +respectively.</p>
   
   <h3>Example</h3>
   <pre>  &lt;javadoc packagenames=&quot;com.dummy.test.*&quot;
  @@ -3300,12 +3292,10 @@
     </tr>
   </table>
   <h3>Parameters specified as nested elements</h3>
  -<h4>classpath and classpathref</h4>
  +<h4>classpath</h4>
   <p><code>Rmic</code>'s <em>classpath</em> attribute is a <a
   href="#path">PATH like structure</a> and can also be set via a nested
  -<em>classpath</em> elements. PATHs defined elsewhere can be
  -<a href="#references">referred</a> to via nested <em>classpathref</em>
  -elements.</p>
  +<em>classpath</em> elements.</p>
   <h3>Examples</h3>
   <pre>  &lt;rmic classname=&quot;com.xyz.FooBar&quot; 
base=&quot;${build}/classes&quot; /&gt;</pre>
   <p>runs the rmic compiler for the class <code>com.xyz.FooBar</code>. The
  
  
  
  1.6       +2 -4      jakarta-ant/docs/junit.html
  
  Index: junit.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/junit.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- junit.html        2000/08/11 13:58:30     1.5
  +++ junit.html        2000/09/06 14:04:56     1.6
  @@ -70,10 +70,8 @@
   
   <p><code>junit</code> supports a nested <code>&lt;classpath&gt;</code>
   element, that represents a <a href="index.html#path">PATH like
  -structure</a>. PATHs defined elsewhere can be <a
  -href="index.html#references">referred</a> to via nested
  -<code>&lt;classpathref&gt;</code> elements. The value is ignored if
  -<code>fork</code> is disabled.</p>
  +structure</a>. The value is ignored if <code>fork</code> is
  +disabled.</p>
   
   <h4>jvmarg</h4>
   
  
  
  
  1.19      +4 -43     
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java
  
  Index: Java.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Java.java 2000/08/09 15:57:12     1.18
  +++ Java.java 2000/09/06 14:04:58     1.19
  @@ -80,7 +80,6 @@
       private boolean fork = false;
       private File dir = null;
       private boolean failOnError = false;
  -    private Vector classpathReferences = new Vector();
       
       /**
        * Do the execution.
  @@ -136,23 +135,14 @@
        * Creates a nested classpath element
        */
       public Path createClasspath() {
  -        return cmdl.createClasspath(project);
  +        return cmdl.createClasspath(project).createPath();
       }
   
       /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <classpathref> element.
  +     * Adds a reference to a CLASSPATH defined elsewhere.
        */
  -    public void addClasspathRef(Reference r) {
  -        classpathReferences.addElement(r);
  -    }
  -
  -    /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <classpathref> element.
  -     */
       public void setClasspathRef(Reference r) {
  -        classpathReferences.addElement(r);
  +        createClasspath().setRefid(r);
       }
   
       /**
  @@ -242,10 +232,7 @@
       private void run(CommandlineJava command) throws BuildException {
           ExecuteJava exe = new ExecuteJava();
           exe.setJavaCommand(command.getJavaCommand());
  -        Path p = new Path(project);
  -        p.append(command.getClasspath());
  -        addReferencesToPath(classpathReferences, p);
  -        exe.setClasspath(p);
  +        exe.setClasspath(command.getClasspath());
           exe.execute(project);
       }
   
  @@ -279,33 +266,7 @@
           for (int i=0; i<args.size(); i++) {
               cmdj.createArgument().setValue((String) args.elementAt(i));
           }
  -        if (cmdl.getClasspath() != null || classpathReferences.size() > 0) {
  -            Path p = cmdj.createClasspath(project);
  -            if (cmdl.getClasspath() != null) {
  -                p.append(cmdl.getClasspath());
  -            }
  -            addReferencesToPath(classpathReferences, p);
  -        }
           run(cmdj);
       }
   
  -    /**
  -     * Appends the referenced Path instances to the other path.
  -     *
  -     * @param v Vector of Reference objects referring to Path objects.
  -     * @param p Path to append to.
  -     */
  -    private void addReferencesToPath(Vector v, Path p) {
  -        for (int i=0; i<v.size(); i++) {
  -            Reference r = (Reference) v.elementAt(i);
  -            Object o = r.getReferencedObject(project);
  -            if (o instanceof Path) {
  -                p.append((Path) o);
  -            } else {
  -                String msg = r.getRefId()+" doesn\'t denote a classpath";
  -                throw new BuildException(msg, location);
  -            }
  -        }
  -    }
  -        
   }
  
  
  
  1.38      +11 -54    
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java
  
  Index: Javac.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- Javac.java        2000/09/04 14:18:51     1.37
  +++ Javac.java        2000/09/06 14:04:58     1.38
  @@ -102,13 +102,11 @@
       private File destDir;
       private Path compileClasspath;
       private String encoding;
  -    private Vector classpathReferences = new Vector();
       private boolean debug = false;
       private boolean optimize = false;
       private boolean deprecation = false;
       private String target;
       private Path bootclasspath;
  -    private Vector bootClasspathReferences = new Vector();
       private Path extdirs;
       private static String lSep = System.getProperty("line.separator");
   
  @@ -124,7 +122,7 @@
           if (src == null) {
               src = new Path(project);
           }
  -        return src;
  +        return src.createPath();
       }
   
       /**
  @@ -164,23 +162,14 @@
           if (compileClasspath == null) {
               compileClasspath = new Path(project);
           }
  -        return compileClasspath;
  +        return compileClasspath.createPath();
       }
   
       /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <classpathref> element.
  +     * Adds a reference to a CLASSPATH defined elsewhere.
        */
  -    public void addClasspathRef(Reference r) {
  -        classpathReferences.addElement(r);
  -    }
  -
  -    /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <classpathref> element.
  -     */
       public void setClasspathRef(Reference r) {
  -        classpathReferences.addElement(r);
  +        createClasspath().setRefid(r);
       }
   
       /**
  @@ -202,23 +191,14 @@
           if (bootclasspath == null) {
               bootclasspath = new Path(project);
           }
  -        return bootclasspath;
  -    }
  -
  -    /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <classpathref> element.
  -     */
  -    public void addBootClasspathRef(Reference r) {
  -        bootClasspathReferences.addElement(r);
  +        return bootclasspath.createPath();
       }
   
       /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <classpathref> element.
  +     * Adds a reference to a CLASSPATH defined elsewhere.
        */
       public void setBootClasspathRef(Reference r) {
  -        bootClasspathReferences.addElement(r);
  +        createBootclasspath().setRefid(r);
       }
   
       /**
  @@ -240,7 +220,7 @@
           if (extdirs == null) {
               extdirs = new Path(project);
           }
  -        return extdirs;
  +        return extdirs.createPath();
       }
   
       /**
  @@ -408,7 +388,6 @@
           if (compileClasspath != null) {
               classpath.addExisting(compileClasspath);
           }
  -        addReferencesToPath(classpathReferences, classpath);
   
           // add the system classpath
   
  @@ -534,8 +513,7 @@
           if (optimize) {
               cmd.createArgument().setValue("-O");
           }
  -        if (bootclasspath != null || bootClasspathReferences.size() > 0) {
  -            addReferencesToPath(bootClasspathReferences, 
createBootclasspath());
  +        if (bootclasspath != null) {
               cmd.createArgument().setValue("-bootclasspath");
               cmd.createArgument().setPath(bootclasspath);
           }
  @@ -589,8 +567,7 @@
   
           // Jikes doesn't support bootclasspath dir (-bootclasspath)
           // so we'll emulate it for compatibility and convenience.
  -        if (bootclasspath != null || bootClasspathReferences.size() > 0) {
  -            addReferencesToPath(bootClasspathReferences, 
createBootclasspath());
  +        if (bootclasspath != null) {
               classpath.append(bootclasspath);
           }
   
  @@ -776,25 +753,6 @@
           }
       }
   
  -    /**
  -     * Appends the referenced Path instances to the other path.
  -     *
  -     * @param v Vector of Reference objects referring to Path objects.
  -     * @param p Path to append to.
  -     */
  -    private void addReferencesToPath(Vector v, Path p) {
  -        for (int i=0; i<v.size(); i++) {
  -            Reference r = (Reference) v.elementAt(i);
  -            Object o = r.getReferencedObject(project);
  -            if (o instanceof Path) {
  -                p.append((Path) o);
  -            } else {
  -                String msg = r.getRefId()+" doesn\'t denote a classpath";
  -                throw new BuildException(msg, location);
  -            }
  -        }
  -    }
  -        
       private void doJvcCompile() throws BuildException {
           log("Using jvc compiler", Project.MSG_VERBOSE);
   
  @@ -802,8 +760,7 @@
   
           // jvc doesn't support bootclasspath dir (-bootclasspath)
           // so we'll emulate it for compatibility and convenience.
  -        if (bootclasspath != null || bootClasspathReferences.size() > 0) {
  -            addReferencesToPath(bootClasspathReferences, 
createBootclasspath());
  +        if (bootclasspath != null) {
               classpath.append(bootclasspath);
           }
   
  
  
  
  1.33      +14 -76    
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  
  Index: Javadoc.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Javadoc.java      2000/09/05 14:58:52     1.32
  +++ Javadoc.java      2000/09/06 14:04:58     1.33
  @@ -120,7 +120,6 @@
           private Path path;
           
           private Vector params = new Vector();
  -        private Vector pathRefs = new Vector();
   
           public void setName(String name) {
               this.name = name;
  @@ -139,7 +138,6 @@
           }
   
           public Path getPath() {
  -            addReferencesToPath(pathRefs, path);
               return path;
           }
           
  @@ -147,23 +145,14 @@
               if (path == null) {
                   path = new Path(getProject());
               }
  -            return path;
  -        }
  -
  -        /**
  -         * Adds a reference to a CLASSPATH defined elsewhere - nested
  -         * <pathref> element.
  -         */
  -        public void addPathRef(Reference r) {
  -            pathRefs.addElement(r);
  +            return path.createPath();
           }
   
           /**
  -         * Adds a reference to a CLASSPATH defined elsewhere - nested
  -         * <pathref> element.
  +         * Adds a reference to a CLASSPATH defined elsewhere.
            */
           public void setPathRef(Reference r) {
  -            pathRefs.addElement(r);
  +            createPath().setRefid(r);
           }
   
           public DocletParam createParam() {
  @@ -216,9 +205,6 @@
       private String packageList = null;
       private Vector links = new Vector(2);
       private Vector groups = new Vector(2);
  -    private Vector classpathReferences = new Vector();
  -    private Vector bootClasspathReferences = new Vector();
  -    private Vector sourcepathReferences = new Vector();
   
       public void setMaxmemory(String max){
           if(javadoc1){
  @@ -243,22 +229,14 @@
           if (sourcePath == null) {
               sourcePath = new Path(project);
           }
  -        return sourcePath;
  +        return sourcePath.createPath();
       }
  -    /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <sourcepathref> element.
  -     */
  -    public void addSourcepathRef(Reference r) {
  -        sourcepathReferences.addElement(r);
  -    }
   
       /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <sourcepathref> element.
  +     * Adds a reference to a CLASSPATH defined elsewhere.
        */
       public void setSourcepathRef(Reference r) {
  -        sourcepathReferences.addElement(r);
  +        createSourcepath().setRefid(r);
       }
   
       public void setDestdir(File dir) {
  @@ -306,7 +284,7 @@
           if (doclet == null) {
               doclet = new DocletInfo();
           }
  -        doclet.setPathRef(r);
  +        doclet.createPath().setRefid(r);
       }
   
       public DocletInfo createDoclet() {
  @@ -328,22 +306,14 @@
           if (classpath == null) {
               classpath = new Path(project);
           }
  -        return classpath;
  -    }
  -    /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <classpathref> element.
  -     */
  -    public void addClasspathRef(Reference r) {
  -        classpathReferences.addElement(r);
  +        return classpath.createPath();
       }
   
       /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <classpathref> element.
  +     * Adds a reference to a CLASSPATH defined elsewhere.
        */
       public void setClasspathRef(Reference r) {
  -        classpathReferences.addElement(r);
  +        createClasspath().setRefid(r);
       }
   
       public void setBootclasspath(Path src) {
  @@ -357,22 +327,14 @@
           if (bootclasspath == null) {
               bootclasspath = new Path(project);
           }
  -        return bootclasspath;
  +        return bootclasspath.createPath();
       }
  -    /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <bootclasspathref> element.
  -     */
  -    public void addBootClasspathRef(Reference r) {
  -        classpathReferences.addElement(r);
  -    }
   
       /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <bootclasspathref> element.
  +     * Adds a reference to a CLASSPATH defined elsewhere.
        */
       public void setBootClasspathRef(Reference r) {
  -        classpathReferences.addElement(r);
  +        createBootclasspath().setRefid(r);
       }
   
       public void setExtdirs(String src) {
  @@ -598,9 +560,6 @@
           if (classpath == null)
               classpath = Path.systemClasspath;
   
  -        addReferencesToPath(classpathReferences, classpath);
  -        addReferencesToPath(sourcepathReferences, sourcePath);
  -
           if (!javadoc1) {
               toExecute.createArgument().setValue("-classpath");
               toExecute.createArgument().setPath(classpath);
  @@ -655,9 +614,7 @@
                       }                        
                   }
               } 
  -            if (bootclasspath != null || bootClasspathReferences.size() > 0) 
{
  -                addReferencesToPath(bootClasspathReferences, 
  -                                    createBootclasspath());
  +            if (bootclasspath != null) {
                   toExecute.createArgument().setValue("-bootclasspath");
                   toExecute.createArgument().setPath(bootclasspath);
               }
  @@ -781,25 +738,6 @@
           }
       }
   
  -    /**
  -     * Appends the referenced Path instances to the other path.
  -     *
  -     * @param v Vector of Reference objects referring to Path objects.
  -     * @param p Path to append to.
  -     */
  -    private void addReferencesToPath(Vector v, Path p) {
  -        for (int i=0; i<v.size(); i++) {
  -            Reference r = (Reference) v.elementAt(i);
  -            Object o = r.getReferencedObject(project);
  -            if (o instanceof Path) {
  -                p.append((Path) o);
  -            } else {
  -                String msg = r.getRefId()+" doesn\'t denote a classpath";
  -                throw new BuildException(msg, location);
  -            }
  -        }
  -    }
  -        
       /**
        * Given a source path, a list of package patterns, fill the given list
        * with the packages found in that path subdirs matching one of the given
  
  
  
  1.14      +11 -64    
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Rmic.java
  
  Index: Rmic.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Rmic.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Rmic.java 2000/08/10 12:58:54     1.13
  +++ Rmic.java 2000/09/06 14:04:59     1.14
  @@ -97,19 +97,11 @@
       private boolean filtering = false;
   
       private Vector compileList = new Vector();
  -    private Vector classpathReferences = new Vector();
   
       public void setBase(String base) {
           this.base = base;
       }
   
  -    public void XsetClass(String classname) {
  -        log("The class attribute is deprecated. " +
  -            "Please use the classname attribute.",
  -            Project.MSG_WARN);
  -        this.classname = classname;
  -    }
  -
       public void setClassname(String classname) {
           this.classname = classname;
       }
  @@ -122,8 +114,8 @@
           this.stubVersion = stubVersion;
       }
   
  -    public void setFiltering(String filter) {
  -        filtering = Project.toBoolean(filter);
  +    public void setFiltering(boolean filter) {
  +        filtering = filter;
       }
   
       /**
  @@ -138,37 +130,28 @@
       }
   
       /**
  -     * Maybe creates a nested classpath element.
  +     * Creates a nested classpath element.
        */
       public Path createClasspath() {
           if (compileClasspath == null) {
               compileClasspath = new Path(project);
           }
  -        return compileClasspath;
  -    }
  -
  -    /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <classpathref> element.
  -     */
  -    public void addClasspathRef(Reference r) {
  -        classpathReferences.addElement(r);
  +        return compileClasspath.createPath();
       }
   
       /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <classpathref> element.
  +     * Adds a reference to a CLASSPATH defined elsewhere.
        */
       public void setClasspathRef(Reference r) {
  -        classpathReferences.addElement(r);
  +        createClasspath().setRefid(r);
       }
   
       /**
        * Indicates that the classes found by the directory match should be
        * checked to see if they implement java.rmi.Remote.
        * This defaults to false if not set.  */
  -    public void setVerify(String verify) {
  -        this.verify = Project.toBoolean(verify);
  +    public void setVerify(boolean verify) {
  +        this.verify = verify;
       }
   
       public void execute() throws BuildException {
  @@ -189,18 +172,6 @@
           }
           Path classpath = getCompileClasspath(baseDir);
   
  -        for (int i=0; i<classpathReferences.size(); i++) {
  -            Reference r = (Reference) classpathReferences.elementAt(i);
  -            Object o = r.getReferencedObject(project);
  -            if (o instanceof Path) {
  -                classpath.append((Path) o);
  -            } else {
  -                String msg = r.getRefId()+" doesn\'t denote a classpath";
  -                throw new BuildException(msg, location);
  -            }
  -        }
  -        
  -
           // scan base dirs to build up compile lists only if a
           // specific classname is not given
           if (classname == null) {
  @@ -406,45 +377,21 @@
           // add our classpath to the mix
   
           if (compileClasspath != null) {
  -            addExistingToClasspath(classpath,compileClasspath);
  +            classpath.addExisting(compileClasspath);
           }
   
           // add the system classpath
  -        addExistingToClasspath(classpath, Path.systemClasspath);
  +        classpath.addExisting(Path.systemClasspath);
   
           // in jdk 1.2, the system classes are not on the visible classpath.
           if (Project.getJavaVersion().startsWith("1.2")) {
               String bootcp = System.getProperty("sun.boot.class.path");
               if (bootcp != null) {
  -                addExistingToClasspath(classpath, new Path(project, bootcp));
  +                classpath.addExisting(new Path(project, bootcp));
               }
           }
           return classpath;
       }
   
  -     /**
  -     * Takes a classpath-like string, and adds each element of
  -     * this string to a new classpath, if the components exist.
  -     * Components that don't exist, aren't added.
  -     * We do this, because jikes issues warnings for non-existant
  -     * files/dirs in his classpath, and these warnings are pretty
  -     * annoying.
  -     * @param target - target classpath
  -     * @param source - source classpath
  -     * to get file objects.
  -     */
  -    private void addExistingToClasspath(Path target, Path source) {
  -        String[] list = source.list();
  -        for (int i=0; i<list.length; i++) {
  -            File f = project.resolveFile(list[i]);
  -
  -            if (f.exists()) {
  -                target.setLocation(f);
  -           } else {
  -               log("Dropping from classpath: "+
  -                   f.getAbsolutePath(), Project.MSG_VERBOSE);
  -           }
  -        }
  -    }
   }
   
  
  
  
  1.7       +1 -23     
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JUnitTask.java    2000/08/11 12:55:12     1.6
  +++ JUnitTask.java    2000/09/06 14:05:00     1.7
  @@ -88,7 +88,6 @@
   public class JUnitTask extends Task {
   
       private CommandlineJava commandline = new CommandlineJava();
  -    private Vector classpathReferences = new Vector();
       private Vector tests = new Vector();
       private Vector batchTests = new Vector();
       private Vector formatters = new Vector();
  @@ -134,16 +133,8 @@
        return commandline.createVmArgument();
       }
   
  -    /**
  -     * Adds a reference to a CLASSPATH defined elsewhere - nested
  -     * <classpathref> element.
  -     */
  -    public void addClasspathRef(Reference r) {
  -        classpathReferences.addElement(r);
  -    }
  -
       public Path createClasspath() {
  -        return commandline.createClasspath(project);
  +        return commandline.createClasspath(project).createPath();
       }
   
       public void addTest(JUnitTest test) {
  @@ -179,19 +170,6 @@
       public void execute() throws BuildException {
           boolean errorOccurred = false;
           boolean failureOccurred = false;
  -
  -        Path classpath = commandline.createClasspath(project);
  -        for (int i=0; i<classpathReferences.size(); i++) {
  -            Reference r = (Reference) classpathReferences.elementAt(i);
  -            Object o = r.getReferencedObject(project);
  -            if (o instanceof Path) {
  -                classpath.append((Path) o);
  -            } else {
  -                String msg = r.getRefId()+" doesn\'t denote a classpath";
  -                throw new BuildException(msg, location);
  -            }
  -        }
  -        
   
           Enumeration list = batchTests.elements();
           while (list.hasMoreElements()) {
  
  
  

Reply via email to