Clover coverage report - Ant Coverage
Coverage timestamp: Tue Apr 8 2003 20:43:55 EST
file stats: LOC: 710   Methods: 48
NCLOC: 341   Classes: 2
 
 Source file Conditionals Statements Methods TOTAL
Rmic.java 0% 9.1% 12.5% 7.8%
 1   
 /*
 2   
  * The Apache Software License, Version 1.1
 3   
  *
 4   
  * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
 5   
  * reserved.
 6   
  *
 7   
  * Redistribution and use in source and binary forms, with or without
 8   
  * modification, are permitted provided that the following conditions
 9   
  * are met:
 10   
  *
 11   
  * 1. Redistributions of source code must retain the above copyright
 12   
  *    notice, this list of conditions and the following disclaimer.
 13   
  *
 14   
  * 2. Redistributions in binary form must reproduce the above copyright
 15   
  *    notice, this list of conditions and the following disclaimer in
 16   
  *    the documentation and/or other materials provided with the
 17   
  *    distribution.
 18   
  *
 19   
  * 3. The end-user documentation included with the redistribution, if
 20   
  *    any, must include the following acknowlegement:
 21   
  *       "This product includes software developed by the
 22   
  *        Apache Software Foundation (http://www.apache.org/)."
 23   
  *    Alternately, this acknowlegement may appear in the software itself,
 24   
  *    if and wherever such third-party acknowlegements normally appear.
 25   
  *
 26   
  * 4. The names "Ant" and "Apache Software
 27   
  *    Foundation" must not be used to endorse or promote products derived
 28   
  *    from this software without prior written permission. For written
 29   
  *    permission, please contact apache@apache.org.
 30   
  *
 31   
  * 5. Products derived from this software may not be called "Apache"
 32   
  *    nor may "Apache" appear in their names without prior written
 33   
  *    permission of the Apache Group.
 34   
  *
 35   
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 36   
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 37   
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 38   
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 39   
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 40   
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 41   
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 42   
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 43   
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 44   
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 45   
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 46   
  * SUCH DAMAGE.
 47   
  * ====================================================================
 48   
  *
 49   
  * This software consists of voluntary contributions made by many
 50   
  * individuals on behalf of the Apache Software Foundation.  For more
 51   
  * information on the Apache Software Foundation, please see
 52   
  * <http://www.apache.org/>.
 53   
  */
 54   
 
 55   
 package org.apache.tools.ant.taskdefs;
 56   
 
 57   
 import java.io.File;
 58   
 import java.io.IOException;
 59   
 import java.rmi.Remote;
 60   
 import java.util.Vector;
 61   
 import org.apache.tools.ant.AntClassLoader;
 62   
 import org.apache.tools.ant.BuildException;
 63   
 import org.apache.tools.ant.DirectoryScanner;
 64   
 import org.apache.tools.ant.Project;
 65   
 import org.apache.tools.ant.taskdefs.rmic.RmicAdapter;
 66   
 import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory;
 67   
 import org.apache.tools.ant.types.FilterSetCollection;
 68   
 import org.apache.tools.ant.types.Path;
 69   
 import org.apache.tools.ant.types.Reference;
 70   
 import org.apache.tools.ant.util.FileNameMapper;
 71   
 import org.apache.tools.ant.util.FileUtils;
 72   
 import org.apache.tools.ant.util.SourceFileScanner;
 73   
 import org.apache.tools.ant.util.facade.FacadeTaskHelper;
 74   
 
 75   
 /**
 76   
  * Runs the rmic compiler against classes.</p>
 77   
  * <p>Rmic can be run on a single class (as specified with the classname
 78   
  * attribute) or a number of classes at once (all classes below base that
 79   
  * are neither _Stub nor _Skel classes).  If you want to rmic a single
 80   
  * class and this class is a class nested into another class, you have to
 81   
  * specify the classname in the form <code>Outer$$Inner</code> instead of
 82   
  * <code>Outer.Inner</code>.</p>
 83   
  * <p>It is possible to refine the set of files that are being rmiced. This can be
 84   
  * done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>,
 85   
  * <i>excludesfile</i> and <i>defaultexcludes</i>
 86   
  * attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
 87   
  * have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
 88   
  * the files you want to have excluded. This is also done with patterns. And
 89   
  * finally with the <i>defaultexcludes</i> attribute, you can specify whether you
 90   
  * want to use default exclusions or not. See the section on
 91   
  * directory based tasks</a>, on how the
 92   
  * inclusion/exclusion of files works, and how to write patterns.</p>
 93   
  * <p>This task forms an implicit FileSet and
 94   
  * supports all attributes of <code>&lt;fileset&gt;</code>
 95   
  * (<code>dir</code> becomes <code>base</code>) as well as the nested
 96   
  * <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
 97   
  * <code>&lt;patternset&gt;</code> elements.</p>
 98   
  * <p>It is possible to use different compilers. This can be selected
 99   
  * with the &quot;build.rmic&quot; property or the <code>compiler</code>
 100   
  * attribute. <a name="compilervalues">There are three choices</a>:</p>
 101   
  * <ul>
 102   
  *   <li>sun (the standard compiler of the JDK)</li>
 103   
  *   <li>kaffe (the standard compiler of
 104   
  *       {@link <a href="http://www.kaffe.org">Kaffe</a>})</li>
 105   
  *   <li>weblogic</li>
 106   
  * </ul>
 107   
  *
 108   
  * <p> The <a href="http://dione.zcu.cz/~toman40/miniRMI/">miniRMI</a>
 109   
  * project contains a compiler implementation for this task as well,
 110   
  * please consult miniRMI's documentation to learn how to use it.</p>
 111   
  *
 112   
  * @author duncan@x180.com
 113   
  * @author ludovic.claude@websitewatchers.co.uk
 114   
  * @author David Maclean <a href="mailto:david@cm.co.za">david@cm.co.za</a>
 115   
  * @author Stefan Bodewig
 116   
  * @author Takashi Okamoto tokamoto@rd.nttdata.co.jp
 117   
  *
 118   
  * @since Ant 1.1
 119   
  *
 120   
  * @ant.task category="java"
 121   
  */
 122   
 
 123   
 public class Rmic extends MatchingTask {
 124   
 
 125   
     private static final String FAIL_MSG
 126   
         = "Rmic failed; see the compiler error output for details.";
 127   
 
 128   
     private File baseDir;
 129   
     private String classname;
 130   
     private File sourceBase;
 131   
     private String stubVersion;
 132   
     private Path compileClasspath;
 133   
     private Path extdirs;
 134   
     private boolean verify = false;
 135   
     private boolean filtering = false;
 136   
 
 137   
     private boolean iiop = false;
 138   
     private String  iiopopts;
 139   
     private boolean idl  = false;
 140   
     private String  idlopts;
 141   
     private boolean debug  = false;
 142   
     private boolean includeAntRuntime = true;
 143   
     private boolean includeJavaRuntime = false;
 144   
 
 145   
     private Vector compileList = new Vector();
 146   
 
 147   
     private ClassLoader loader = null;
 148   
 
 149   
     private FileUtils fileUtils = FileUtils.newFileUtils();
 150   
 
 151   
     private FacadeTaskHelper facade;
 152   
 
 153  2
     public Rmic() {
 154  2
         try {
 155  2
             Class.forName("kaffe.rmi.rmic.RMIC");
 156  0
             facade = new FacadeTaskHelper("kaffe");
 157   
         } catch (ClassNotFoundException cnfe) {
 158  2
             facade = new FacadeTaskHelper("sun");
 159   
         }
 160   
     }
 161   
 
 162   
     /**
 163   
      * Sets the location to store the compiled files; required
 164   
      */
 165  0
     public void setBase(File base) {
 166  0
         this.baseDir = base;
 167   
     }
 168   
 
 169   
     /**
 170   
      * Gets the base directory to output generated class.
 171   
      */
 172   
 
 173  0
     public File getBase() {
 174  0
         return this.baseDir;
 175   
     }
 176   
 
 177   
     /**
 178   
      * Sets the the class to run <code>rmic</code> against;
 179   
      * optional
 180   
      */
 181  0
     public void setClassname(String classname) {
 182  0
         this.classname = classname;
 183   
     }
 184   
 
 185   
     /**
 186   
      * Gets the class name to compile.
 187   
      */
 188  0
     public String getClassname() {
 189  0
         return classname;
 190   
     }
 191   
 
 192   
     /**
 193   
      * optional directory to save generated source files to.
 194   
      */
 195  0
     public void setSourceBase(File sourceBase) {
 196  0
         this.sourceBase = sourceBase;
 197   
     }
 198   
 
 199   
     /**
 200   
      * Gets the source dirs to find the source java files.
 201   
      */
 202  0
     public File getSourceBase() {
 203  0
         return sourceBase;
 204   
     }
 205   
 
 206   
     /**
 207   
      * Specify the JDK version for the generated stub code.
 208   
      * Specify &quot;1.1&quot; to pass the &quot;-v1.1&quot; option to rmic.</td>
 209   
      */
 210  0
     public void setStubVersion(String stubVersion) {
 211  0
         this.stubVersion = stubVersion;
 212   
     }
 213   
 
 214  0
     public String getStubVersion() {
 215  0
         return stubVersion;
 216   
     }
 217   
 
 218   
     /**
 219   
      * indicates whether token filtering should take place;
 220   
      * optional, default=false
 221   
      */
 222  0
     public void setFiltering(boolean filter) {
 223  0
         filtering = filter;
 224   
     }
 225   
 
 226  0
     public boolean getFiltering() {
 227  0
         return filtering;
 228   
     }
 229   
 
 230   
     /**
 231   
      * generate debug info (passes -g to rmic);
 232   
      * optional, defaults to false
 233   
      */
 234  0
     public void setDebug(boolean debug) {
 235  0
         this.debug = debug;
 236   
     }
 237   
 
 238   
     /**
 239   
      * Gets the debug flag.
 240   
      */
 241  0
     public boolean getDebug() {
 242  0
         return debug;
 243   
     }
 244   
 
 245   
     /**
 246   
      * Set the classpath to be used for this compilation.
 247   
      */
 248  0
     public void setClasspath(Path classpath) {
 249  0
         if (compileClasspath == null) {
 250  0
             compileClasspath = classpath;
 251   
         } else {
 252  0
             compileClasspath.append(classpath);
 253   
         }
 254   
     }
 255   
 
 256   
     /**
 257   
      * Creates a nested classpath element.
 258   
      */
 259  0
     public Path createClasspath() {
 260  0
         if (compileClasspath == null) {
 261  0
             compileClasspath = new Path(getProject());
 262   
         }
 263  0
         return compileClasspath.createPath();
 264   
     }
 265   
 
 266   
     /**
 267   
      * Adds to the classpath a reference to
 268   
      * a &lt;path&gt; defined elsewhere.
 269   
      */
 270  0
     public void setClasspathRef(Reference r) {
 271  0
         createClasspath().setRefid(r);
 272   
     }
 273   
 
 274   
     /**
 275   
      * Gets the classpath.
 276   
      */
 277  0
     public Path getClasspath() {
 278  0
         return compileClasspath;
 279   
     }
 280   
 
 281   
     /**
 282   
      * Flag to enable verification so that the classes
 283   
      * found by the directory match are
 284   
      * checked to see if they implement java.rmi.Remote.
 285   
      * Optional; his defaults to false if not set.
 286   
      */
 287   
 
 288  0
     public void setVerify(boolean verify) {
 289  0
         this.verify = verify;
 290   
     }
 291   
 
 292   
     /** Get verify flag. */
 293  0
     public boolean getVerify() {
 294  0
         return verify;
 295   
     }
 296   
 
 297   
     /**
 298   
      * Indicates that IIOP compatible stubs should
 299   
      * be generated; optional, defaults to false
 300   
      * if not set.
 301   
      */
 302  0
     public void setIiop(boolean iiop) {
 303  0
         this.iiop = iiop;
 304   
     }
 305   
 
 306   
     /**
 307   
      * Gets iiop flags.
 308   
      */
 309  0
     public boolean getIiop() {
 310  0
         return iiop;
 311   
     }
 312   
 
 313   
     /**
 314   
      * Set additional arguments for iiop
 315   
      */
 316  0
     public void setIiopopts(String iiopopts) {
 317  0
         this.iiopopts = iiopopts;
 318   
     }
 319   
 
 320   
     /**
 321   
      * Gets additional arguments for iiop.
 322   
      */
 323  0
     public String getIiopopts() {
 324  0
         return iiopopts;
 325   
     }
 326   
 
 327   
     /**
 328   
      * Indicates that IDL output should be
 329   
      * generated.  This defaults to false
 330   
      * if not set.
 331   
      */
 332  0
     public void setIdl(boolean idl) {
 333  0
         this.idl = idl;
 334   
     }
 335   
 
 336   
     /**
 337   
      * Gets IDL flags.
 338   
      */
 339  0
     public boolean getIdl() {
 340  0
         return idl;
 341   
     }
 342   
 
 343   
     /**
 344   
      * pass additional arguments for idl compile
 345   
      */
 346  0
     public void setIdlopts(String idlopts) {
 347  0
         this.idlopts = idlopts;
 348   
     }
 349   
 
 350   
     /**
 351   
      * Gets additional arguments for idl compile.
 352   
      */
 353  0
     public String getIdlopts() {
 354  0
         return idlopts;
 355   
     }
 356   
 
 357   
     /**
 358   
      * Gets file list to compile.
 359   
      */
 360  0
     public Vector getFileList() {
 361  0
         return compileList;
 362   
     }
 363   
 
 364   
     /**
 365   
      * Sets whether or not to include ant's own classpath in this task's
 366   
      * classpath.
 367   
      * Optional; default is <code>true</code>.
 368   
      */
 369  0
     public void setIncludeantruntime(boolean include) {
 370  0
         includeAntRuntime = include;
 371   
     }
 372   
 
 373   
     /**
 374   
      * Gets whether or not the ant classpath is to be included in the
 375   
      * task's classpath.
 376   
      */
 377  0
     public boolean getIncludeantruntime() {
 378  0
         return includeAntRuntime;
 379   
     }
 380   
 
 381   
     /**
 382   
      * task's classpath.
 383   
      * Enables or disables including the default run-time
 384   
      * libraries from the executing VM; optional,
 385   
      * defaults to false
 386   
      */
 387  0
     public void setIncludejavaruntime(boolean include) {
 388  0
         includeJavaRuntime = include;
 389   
     }
 390   
 
 391   
     /**
 392   
      * Gets whether or not the java runtime should be included in this
 393   
      * task's classpath.
 394   
      */
 395  0
     public boolean getIncludejavaruntime() {
 396  0
         return includeJavaRuntime;
 397   
     }
 398   
 
 399   
     /**
 400   
      * Sets the extension directories that will be used during the
 401   
      * compilation; optional.
 402   
      */
 403  0
     public void setExtdirs(Path extdirs) {
 404  0
         if (this.extdirs == null) {
 405  0
             this.extdirs = extdirs;
 406   
         } else {
 407  0
             this.extdirs.append(extdirs);
 408   
         }
 409   
     }
 410   
 
 411   
     /**
 412   
      * Maybe creates a nested extdirs element.
 413   
      */
 414  0
     public Path createExtdirs() {
 415  0
         if (extdirs == null) {
 416  0
             extdirs = new Path(getProject());
 417   
         }
 418  0
         return extdirs.createPath();
 419   
     }
 420   
 
 421   
     /**
 422   
      * Gets the extension directories that will be used during the
 423   
      * compilation.
 424   
      */
 425  0
     public Path getExtdirs() {
 426  0
         return extdirs;
 427   
     }
 428   
 
 429  0
     public Vector getCompileList() {
 430  0
         return compileList;
 431   
     }
 432   
 
 433   
     /**
 434   
      * Sets the compiler implementation to use; optional,
 435   
      * defaults to the value of the <code>build.rmic</code> property,
 436   
      * or failing that, default compiler for the current VM
 437   
      * @since Ant 1.5
 438   
      */
 439  1
     public void setCompiler(String compiler) {
 440  1
         facade.setImplementation(compiler);
 441   
     }
 442   
 
 443   
     /**
 444   
      * get the name of the current compiler
 445   
      * @since Ant 1.5
 446   
      */
 447  8
     public String getCompiler() {
 448  8
         facade.setMagicValue(getProject().getProperty("build.rmic"));
 449  8
         return facade.getImplementation();
 450   
     }
 451   
 
 452   
     /**
 453   
      * Adds an implementation specific command line argument.
 454   
      * @since Ant 1.5
 455   
      */
 456  1
     public ImplementationSpecificArgument createCompilerArg() {
 457  1
         ImplementationSpecificArgument arg =
 458   
             new ImplementationSpecificArgument();
 459  1
         facade.addImplementationArgument(arg);
 460  1
         return arg;
 461   
     }
 462   
 
 463   
     /**
 464   
      * Get the additional implementation specific command line arguments.
 465   
      * @return array of command line arguments, guaranteed to be non-null.
 466   
      * @since Ant 1.5
 467   
      */
 468  5
     public String[] getCurrentCompilerArgs() {
 469  5
         getCompiler();
 470  5
         return facade.getArgs();
 471   
     }
 472   
 
 473   
     /**
 474   
      * execute by creating an instance of an implementation
 475   
      * class and getting to do the work
 476   
      */
 477  0
     public void execute() throws BuildException {
 478  0
         if (baseDir == null) {
 479  0
             throw new BuildException("base attribute must be set!", getLocation());
 480   
         }
 481  0
         if (!baseDir.exists()) {
 482  0
             throw new BuildException("base does not exist!", getLocation());
 483   
         }
 484   
 
 485  0
         if (verify) {
 486  0
             log("Verify has been turned on.", Project.MSG_VERBOSE);
 487   
         }
 488   
 
 489  0
         RmicAdapter adapter = RmicAdapterFactory.getRmic(getCompiler(), this);
 490   
 
 491   
         // now we need to populate the compiler adapter
 492  0
         adapter.setRmic(this);
 493   
 
 494  0
         Path classpath = adapter.getClasspath();
 495  0
         loader = getProject().createClassLoader(classpath);
 496   
 
 497  0
         try {
 498   
             // scan base dirs to build up compile lists only if a
 499   
             // specific classname is not given
 500  0
             if (classname == null) {
 501  0
                 DirectoryScanner ds = this.getDirectoryScanner(baseDir);
 502  0
                 String[] files = ds.getIncludedFiles();
 503  0
                 scanDir(baseDir, files, adapter.getMapper());
 504   
             } else {
 505   
                 // otherwise perform a timestamp comparison - at least
 506  0
                 scanDir(baseDir,
 507   
                         new String[] {classname.replace('.',
 508   
                                                         File.separatorChar)
 509   
                                           + ".class"},
 510   
                         adapter.getMapper());
 511   
             }
 512   
 
 513  0
             int fileCount = compileList.size();
 514  0
             if (fileCount > 0) {
 515  0
                 log("RMI Compiling " + fileCount +
 516   
                     " class" + (fileCount > 1 ? "es" : "") + " to " + baseDir,
 517   
                     Project.MSG_INFO);
 518   
 
 519   
                 // finally, lets execute the compiler!!
 520  0
                 if (!adapter.execute()) {
 521  0
                     throw new BuildException(FAIL_MSG, getLocation());
 522   
                 }
 523   
             }
 524   
 
 525   
             /*
 526   
              * Move the generated source file to the base directory.  If
 527   
              * base directory and sourcebase are the same, the generated
 528   
              * sources are already in place.
 529   
              */
 530  0
             if (null != sourceBase && !baseDir.equals(sourceBase)
 531   
                 && fileCount > 0) {
 532  0
                 if (idl) {
 533  0
                     log("Cannot determine sourcefiles in idl mode, ",
 534   
                         Project.MSG_WARN);
 535  0
                     log("sourcebase attribute will be ignored.",
 536   
                         Project.MSG_WARN);
 537   
                 } else {
 538  0
                     for (int j = 0; j < fileCount; j++) {
 539  0
                         moveGeneratedFile(baseDir, sourceBase,
 540   
                                           (String) compileList.elementAt(j),
 541   
                                           adapter);
 542   
                     }
 543   
                 }
 544   
             }
 545   
         } finally {
 546  0
             compileList.removeAllElements();
 547   
         }
 548   
     }
 549   
 
 550   
     /**
 551   
      * Move the generated source file(s) to the base directory
 552   
      *
 553   
      * @throws org.apache.tools.ant.BuildException When error
 554   
      * copying/removing files.
 555   
      */
 556  0
     private void moveGeneratedFile (File baseDir, File sourceBaseFile,
 557   
                                     String classname,
 558   
                                     RmicAdapter adapter)
 559   
         throws BuildException {
 560   
 
 561  0
         String classFileName =
 562   
             classname.replace('.', File.separatorChar) + ".class";
 563  0
         String[] generatedFiles =
 564   
             adapter.getMapper().mapFileName(classFileName);
 565   
 
 566  0
         for (int i = 0; i < generatedFiles.length; i++) {
 567  0
             final String generatedFile = generatedFiles[i];
 568  0
             if (!generatedFile.endsWith(".class")) {
 569   
                 // don't know how to handle that - a IDL file doesn't
 570   
                 // have a corresponding Java source for example.
 571  0
                 continue;
 572   
             }
 573   
 
 574  0
             final int pos = generatedFile.length() - ".class".length();
 575  0
             String sourceFileName =
 576   
                 generatedFile.substring(0, pos) + ".java";
 577   
 
 578  0
             File oldFile = new File(baseDir, sourceFileName);
 579  0
             if (!oldFile.exists()) {
 580   
                 // no source file generated, nothing to move
 581  0
                 continue;
 582   
             }
 583   
 
 584  0
             File newFile = new File(sourceBaseFile, sourceFileName);
 585  0
             try {
 586  0
                 if (filtering) {
 587  0
                     fileUtils.copyFile(oldFile, newFile,
 588   
                         new FilterSetCollection(getProject()
 589   
                                                 .getGlobalFilterSet()));
 590   
                 } else {
 591  0
                     fileUtils.copyFile(oldFile, newFile);
 592   
                 }
 593  0
                 oldFile.delete();
 594   
             } catch (IOException ioe) {
 595  0
                 String msg = "Failed to copy " + oldFile + " to " +
 596   
                     newFile + " due to " + ioe.getMessage();
 597  0
                 throw new BuildException(msg, ioe, getLocation());
 598   
             }
 599   
         }
 600   
     }
 601   
 
 602   
     /**
 603   
      * Scans the directory looking for class files to be compiled.
 604   
      * The result is returned in the class variable compileList.
 605   
      */
 606  0
     protected void scanDir(File baseDir, String[] files,
 607   
                            FileNameMapper mapper) {
 608   
 
 609  0
         String[] newFiles = files;
 610  0
         if (idl) {
 611  0
             log("will leave uptodate test to rmic implementation in idl mode.",
 612   
                 Project.MSG_VERBOSE);
 613  0
         } else if (iiop
 614   
                    && iiopopts != null && iiopopts.indexOf("-always") > -1) {
 615  0
             log("no uptodate test as -always option has been specified",
 616   
                 Project.MSG_VERBOSE);
 617   
         } else {
 618  0
             SourceFileScanner sfs = new SourceFileScanner(this);
 619  0
             newFiles = sfs.restrict(files, baseDir, baseDir, mapper);
 620   
         }
 621   
 
 622  0
         for (int i = 0; i < newFiles.length; i++) {
 623  0
             String classname = newFiles[i].replace(File.separatorChar, '.');
 624  0
             classname = classname.substring(0, classname.lastIndexOf(".class"));
 625  0
             compileList.addElement(classname);
 626   
         }
 627   
     }
 628   
 
 629   
     /**
 630   
      * Load named class and test whether it can be rmic'ed
 631   
      */
 632  0
     public boolean isValidRmiRemote(String classname) {
 633  0
         try {
 634  0
             Class testClass = loader.loadClass(classname);
 635   
             // One cannot RMIC an interface for "classic" RMI (JRMP)
 636  0
             if (testClass.isInterface() && !iiop && !idl) {
 637  0
                 return false;
 638   
             }
 639  0
             return isValidRmiRemote(testClass);
 640   
         } catch (ClassNotFoundException e) {
 641  0
             log("Unable to verify class " + classname +
 642   
                 ". It could not be found.", Project.MSG_WARN);
 643   
         } catch (NoClassDefFoundError e) {
 644  0
             log("Unable to verify class " + classname +
 645   
                 ". It is not defined.", Project.MSG_WARN);
 646   
         } catch (Throwable t) {
 647  0
             log("Unable to verify class " + classname +
 648   
                 ". Loading caused Exception: " +
 649   
                 t.getMessage(), Project.MSG_WARN);
 650   
         }
 651   
         // we only get here if an exception has been thrown
 652  0
         return false;
 653   
     }
 654   
 
 655   
     /**
 656   
      * Returns the topmost interface that extends Remote for a given
 657   
      * class - if one exists.
 658   
      */
 659  0
     public Class getRemoteInterface(Class testClass) {
 660  0
         if (Remote.class.isAssignableFrom(testClass)) {
 661  0
             Class [] interfaces = testClass.getInterfaces();
 662  0
             if (interfaces != null) {
 663  0
                 for (int i = 0; i < interfaces.length; i++) {
 664  0
                     if (Remote.class.isAssignableFrom(interfaces[i])) {
 665  0
                         return interfaces[i];
 666   
                     }
 667   
                 }
 668   
             }
 669   
         }
 670  0
         return null;
 671   
     }
 672   
 
 673   
     /**
 674   
      * Check to see if the class or (super)interfaces implement
 675   
      * java.rmi.Remote.
 676   
      */
 677  0
     private boolean isValidRmiRemote (Class testClass) {
 678  0
         return getRemoteInterface(testClass) != null;
 679   
     }
 680   
 
 681   
     /**
 682   
      * Classloader for the user-specified classpath.
 683   
      */
 684  0
     public ClassLoader getLoader() {
 685  0
         return loader;
 686   
     }
 687   
 
 688   
     /**
 689   
      * Adds an "compiler" attribute to Commandline$Attribute used to
 690   
      * filter command line attributes based on the current
 691   
      * implementation.
 692   
      */
 693   
     public class ImplementationSpecificArgument extends
 694   
         org.apache.tools.ant.util.facade.ImplementationSpecificArgument {
 695   
 
 696   
         /**
 697   
          * Only pass the specified argument if the
 698   
          * chosen compiler implementation matches the
 699   
          * value of this attribute. Legal values are
 700   
          * the same as those in the above list of
 701   
          * valid compilers.)
 702   
          */
 703  1
         public void setCompiler(String impl) {
 704  1
             super.setImplementation(impl);
 705   
         }
 706   
     }
 707   
 
 708   
 }
 709   
 
 710