ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool ClassCPInfo.java ConstantCPInfo.java ConstantPool.java ConstantPoolEntry.java DoubleCPInfo.java FieldRefCPInfo.java FloatCPInfo.java IntegerCPInfo.java InterfaceMethodRefCPInfo.java LongCPInfo.java MethodRefCPInfo.java NameAndTypeCPInfo.java StringCPInfo.java Utf8CPInfo.java
Date Sat, 28 Oct 2000 05:06:11 GMT
conor       00/10/27 22:06:11

  Modified:    src/main/org/apache/tools/ant/taskdefs defaults.properties
  Added:       src/main/org/apache/tools/ant/taskdefs/optional/depend
                        ClassFile.java ClassFileIterator.java
                        ClassFileUtils.java Depend.java
                        DirectoryIterator.java JarFileIterator.java
               src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool
                        ClassCPInfo.java ConstantCPInfo.java
                        ConstantPool.java ConstantPoolEntry.java
                        DoubleCPInfo.java FieldRefCPInfo.java
                        FloatCPInfo.java IntegerCPInfo.java
                        InterfaceMethodRefCPInfo.java LongCPInfo.java
                        MethodRefCPInfo.java NameAndTypeCPInfo.java
                        StringCPInfo.java Utf8CPInfo.java
  Log:
  Depend task
  
  This task examines classes to build a dependency map. For any class file
  which is out of date with respect to its source, all class files which depend
  on that class are deleted, forcing them to be recompiled.
  
  This is a java specific approach.
  
  Revision  Changes    Path
  1.48      +1 -0      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties
  
  Index: defaults.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- defaults.properties	2000/10/25 11:59:47	1.47
  +++ defaults.properties	2000/10/28 05:06:08	1.48
  @@ -65,6 +65,7 @@
   native2ascii=org.apache.tools.ant.taskdefs.optional.Native2Ascii
   perforce=org.apache.tools.ant.taskdefs.optional.perforce.P4sync
   propertyfile=org.apache.tools.ant.taskdefs.optional.PropertyFile
  +depend=org.apache.tools.ant.taskdefs.optional.depend.Depend
   
   # deprecated ant tasks (kept for back compatibility)
   javadoc2=org.apache.tools.ant.taskdefs.Javadoc
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java
  
  Index: ClassFile.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   * 
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   * 
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   * 
   * 1. Redistributions of source code must retain the above copyright
   * notice, this list of conditions and the following disclaimer.
   * 
   * 2. Redistributions in binary form must reproduce the above copyright
   * notice, this list of conditions and the following disclaimer in
   * the documentation and/or other materials provided with the
   * distribution.
   * 
   * 3. The end-user documentation included with the redistribution, if
   * any, must include the following acknowlegement:
   * "This product includes software developed by the
   * Apache Software Foundation (http://www.apache.org/)."
   * Alternately, this acknowlegement may appear in the software itself,
   * if and wherever such third-party acknowlegements normally appear.
   * 
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   * Foundation" must not be used to endorse or promote products derived
   * from this software without prior written permission. For written
   * permission, please contact apache@apache.org.
   * 
   * 5. Products derived from this software may not be called "Apache"
   * nor may "Apache" appear in their names without prior written
   * permission of the Apache Group.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   * 
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend;
  
  import java.io.*;
  import java.lang.reflect.Modifier;
  import java.util.*;
  import org.apache.tools.ant.taskdefs.optional.depend.constantpool.*;
  
  /**
   * A ClassFile object stores information about a Java class.
   * 
   * The class may be read from a DataInputStream.and written
   * to a DataOutputStream. These are usually streams from a Java
   * class file or a class file component of a Jar file.
   * 
   * @author Conor MacNeill
   */
  public class ClassFile {
  
      /**
       * The Magic Value that marks the start of a Java class file
       */
      static private final int CLASS_MAGIC = 0xCAFEBABE;
  
  
      /**
       * This class' constant pool.
       */
      private ConstantPool constantPool;
  
  
      /**
       * The class name for this class.
       */
      private String className;
  
      /**
       * Read the class from a data stream.
       * 
       * This method takes an InputStream as input and
       * parses the class from the stream.
       * <p>
       * 
       * @param stream an InputStream from which the class will be read
       * 
       * @throws IOException if there is a problem reading from the given stream.
       * @throws ClassFormatError if the class cannot be parsed correctly
       * 
       */
      public void read(InputStream stream) throws IOException, ClassFormatError {
          DataInputStream classStream = new DataInputStream(stream);
  
  
          if (classStream.readInt() != CLASS_MAGIC) {
              throw new ClassFormatError("No Magic Code Found - probably not a Java class file.");
          } 
  
          // right we have a good looking class file.
          int minorVersion = classStream.readUnsignedShort();
          int majorVersion = classStream.readUnsignedShort();
  
          // read the constant pool in and resolve it
          constantPool = new ConstantPool();
  
          constantPool.read(classStream);
          constantPool.resolve();
  
          int accessFlags = classStream.readUnsignedShort();
          int thisClassIndex = classStream.readUnsignedShort();
          int superClassIndex = classStream.readUnsignedShort();
          className = ((ClassCPInfo) constantPool.getEntry(thisClassIndex)).getClassName();
      } 
  
  
      /**
       * Get the classes which this class references.
       */
      public Vector getClassRefs() {
  
          Vector classRefs = new Vector();
  
          for (int i = 0; i < constantPool.size(); ++i) {
              ConstantPoolEntry entry = constantPool.getEntry(i);
  
              if (entry != null && entry.getTag() == ConstantPoolEntry.CONSTANT_Class) {
                  ClassCPInfo classEntry = (ClassCPInfo) entry;
  
                  if (!classEntry.getClassName().equals(className)) {
                      classRefs.addElement(ClassFileUtils.convertSlashName(classEntry.getClassName()));
                  } 
              } 
          } 
  
          return classRefs;
      } 
  
      /**
       * Get the class' fully qualified name in dot format.
       * 
       * @return the class name in dot format (eg. java.lang.Object)
       */
      public String getFullClassName() {
          return ClassFileUtils.convertSlashName(className);
      } 
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java
  
  Index: ClassFileIterator.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend;
  
  
  public interface ClassFileIterator {
  
      public ClassFile getNextClassFile();
  }
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFileUtils.java
  
  Index: ClassFileUtils.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend;
  
  /**
   * Utility class file routines.
   * 
   * This class porovides a number of static utility methods to convert between the
   * formats used in the Java class file format and those commonly used in Java
   * programming.
   * 
   * @author Conor MacNeill
   */
  public class ClassFileUtils {
  
      /**
       * Convert a class name from class file slash notation to java source
       * file dot notation.
       * 
       * @param slashName the class name in slash notation (eg. java/lang/Object)
       * 
       * @return the class name in dot notation (eg. java.lang.Object).
       */
      static public String convertSlashName(String name) {
          String dotName = null;
          int    startIndex = 0;
          int    sepIndex = 0;
  
          String slashName = name.replace('\\', '/');
          do {
              String component = null;
  
              sepIndex = slashName.indexOf('/', startIndex);
  
              if (sepIndex == -1) {
                  component = slashName.substring(startIndex);
              } else {
                  component = slashName.substring(startIndex, sepIndex);
                  startIndex = sepIndex + 1;
              } 
  
              if (dotName == null) {
                  dotName = component;
              } else {
                  dotName += "." + component;
              } 
          } while (sepIndex != -1);
  
          return dotName;
      } 
  
      /**
       * Convert a class name from java source file dot notation to class file slash notation..
       * 
       * @param dotName the class name in dot notation (eg. java.lang.Object).
       * 
       * @return the class name in slash notation (eg. java/lang/Object).
       */
      static public String convertDotName(String dotName) {
          String slashName = null;
          int    startIndex = 0;
          int    sepIndex = 0;
  
          do {
              String component = null;
  
              sepIndex = dotName.indexOf('.', startIndex);
  
              if (sepIndex == -1) {
                  component = dotName.substring(startIndex);
              } else {
                  component = dotName.substring(startIndex, sepIndex);
                  startIndex = sepIndex + 1;
              } 
  
              if (slashName == null) {
                  slashName = component;
              } else {
                  slashName += "/" + component;
              } 
          } while (sepIndex != -1);
  
          return slashName;
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
  
  Index: Depend.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.tools.ant.taskdefs.optional.depend;
  
  import org.apache.tools.ant.*;
  import org.apache.tools.ant.types.*;
  import org.apache.tools.ant.taskdefs.MatchingTask;
  
  import java.util.*;
  import java.io.*;
  
  import org.apache.tools.ant.taskdefs.optional.depend.*;
  
  /**
   * Generate a dependency file for a given set of classes 
   *
   * @author Conor MacNeill
   */
  public class Depend extends MatchingTask {
      static private class ClassFileInfo {
          public File absoluteFile;
          public String relativeName;
          public String className;
      };
  
      /**
       * The path where source files exist
       */    
      private Path srcPath;
  
      /**
       * The path where compiled class files exist.
       */
      private Path destPath;
      
      /**
       * The directory which contains the dependency cache.
       */
      private File cache;
  
      /**
       * A map which gives for every class a list of te class which it affects.
       */
      private Hashtable affectedClassMap;
  
      /**
       * A map which gives information about a class
       */
      private Hashtable classFileInfoMap;
  
      /**
       * The list of classes which are out of date.
       */
      private Vector outOfDateClasses;
       
      /**
       * indicates that the dependency relationships should be extended
       * beyond direct dependencies to include all classes. So if A directly
       * affects B abd B directly affects C, then A indirectly affects C.
       */
      private boolean closure;
  
      private void writeDependencyList(File depFile, Vector dependencyList) throws IOException {
          // new dependencies so need to write them out to the cache
          PrintWriter pw = null;
          try {
              String parent = depFile.getParent();
              if (parent != null) {
                  new File(parent).mkdirs(); 
              }
              
              pw = new PrintWriter(new FileWriter(depFile));
              for (Enumeration deps = dependencyList.elements(); deps.hasMoreElements();) {
                  pw.println(deps.nextElement());
              }
          }
          finally {
              if (pw != null) { 
                  pw.close();
              }
          }
      }
  
      private Vector readDependencyList(File depFile) throws IOException {
          Vector dependencyList = null;
          BufferedReader in = null;
          try {
              in = new BufferedReader(new FileReader(depFile));
              String line = null;
              dependencyList = new Vector();
              while ((line = in.readLine()) != null) {
                  dependencyList.addElement(line);
              }
          }
          finally {
              if (in != null) { 
                  in.close();
              }
          }
          
          return dependencyList;
      }
  
  
      private void determineDependencies() throws IOException {
          affectedClassMap = new Hashtable();
          classFileInfoMap = new Hashtable();
          for (Enumeration e = getClassFiles(destPath).elements(); e.hasMoreElements(); ) {
              ClassFileInfo info = (ClassFileInfo)e.nextElement();
              classFileInfoMap.put(info.className, info);
              
              Vector dependencyList = null;
              
              if (cache != null) {
                  // try to read the dependency info from the cache if it is not out of date
                  File depFile = new File(cache, info.relativeName + ".dep");
                  if (depFile.exists() && depFile.lastModified() > info.absoluteFile.lastModified()) {
                      // depFile exists and is newer than the class file
                      // need to read dependency list from tyhe file.
                      dependencyList = readDependencyList(depFile);
                  }
              }
              
              if (dependencyList == null) {
                  // not cached - so need to read directly from the class file
                  FileInputStream inFileStream = null;
                  try {
                      inFileStream = new FileInputStream(info.absoluteFile);
                      ClassFile classFile = new ClassFile();
                      classFile.read(inFileStream);
                      
                      dependencyList = classFile.getClassRefs();
                      
                      if (cache != null) {
                          // new dependencies so need to write them out to the cache
                          File depFile = new File(cache, info.relativeName + ".dep");
                          writeDependencyList(depFile, dependencyList);
                      }
                  }
                  finally {
                      if (inFileStream != null) {
                          inFileStream.close();
                      }
                  }
              }
              
              // This class depends on each class in the dependency list. For each
              // one of those, add this class into their affected classes list 
              
              for (Enumeration depEnum = dependencyList.elements(); depEnum.hasMoreElements(); ) {
                  String dependentClass = (String)depEnum.nextElement();
                  
                  Hashtable affectedClasses = (Hashtable)affectedClassMap.get(dependentClass);
                  if (affectedClasses == null) {
                      affectedClasses = new Hashtable();
                      affectedClassMap.put(dependentClass, affectedClasses);
                  }
                  
                  affectedClasses.put(info.className, info);
              }
          }
      }
      
      
      private void deleteAllAffectedFiles() {
          for (Enumeration e = outOfDateClasses.elements(); e.hasMoreElements();) {
              String className = (String)e.nextElement();
              deleteAffectedFiles(className);
          }            
      }
      
      private void deleteAffectedFiles(String className) {
          Hashtable affectedClasses = (Hashtable)affectedClassMap.get(className);
          if (affectedClasses != null) {
              for (Enumeration e = affectedClasses.keys(); e.hasMoreElements(); ) {
                  String affectedClassName = (String)e.nextElement();
                  ClassFileInfo affectedClassInfo = (ClassFileInfo)affectedClasses.get(affectedClassName);
                  if (affectedClassInfo.absoluteFile.exists()) {
                      log("Deleting file " + affectedClassInfo.absoluteFile.getPath() + " since " + 
                          className + " out of date", Project.MSG_VERBOSE);
                      affectedClassInfo.absoluteFile.delete();
                      if (closure) {
                          deleteAffectedFiles(affectedClassName);
                      }
                      else {
                          // without closer we may delete an inner class but not the
                          // top level class which will not trigger a recompile.
                             
                          if (affectedClassName.indexOf("$") != -1) {
                              // need to delete the main class
                              String topLevelClassName 
                                  = affectedClassName.substring(0, affectedClassName.indexOf("$"));
                              System.out.println("Top level class = " + topLevelClassName);
                              ClassFileInfo topLevelClassInfo 
                                  = (ClassFileInfo)classFileInfoMap.get(topLevelClassName);
                              if (topLevelClassInfo.absoluteFile.exists()) {
                                  log("Deleting file " + topLevelClassInfo.absoluteFile.getPath() + " since " + 
                                      "one of its inner classes was removed", Project.MSG_VERBOSE);
                                  topLevelClassInfo.absoluteFile.delete();
                                  if (closure) {
                                      deleteAffectedFiles(topLevelClassName);
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
  
      /**
       * Does the work.
       *
       * @exception BuildException Thrown in unrecovrable error.
       */
      public void execute() throws BuildException {
          try {
              long start = System.currentTimeMillis();
              String [] srcPathList = srcPath.list();
              if (srcPathList.length == 0) {
                  throw new BuildException("srcdir attribute must be set!", location);
              }
          
              if (destPath == null) {
                  destPath = srcPath;
              }
              
              if (cache != null && cache.exists() && !cache.isDirectory()) {
                  throw new BuildException("The cache, if specified, must point to a directory");
              }
          
              if (cache != null && !cache.exists()) {
                  cache.mkdirs();
              }
          
              determineDependencies();
              
  /*            
              for (Enumeration e = affectedClassMap.keys(); e.hasMoreElements(); ) {
                  String className = (String)e.nextElement();
                  System.out.println("Class " + className + " affects:");
                  Hashtable affectedClasses = (Hashtable)affectedClassMap.get(className);
                  for (Enumeration e2 = affectedClasses.keys(); e2.hasMoreElements(); ) {
                      String affectedClass = (String)e2.nextElement();
                      ClassFileInfo info = (ClassFileInfo)affectedClasses.get(affectedClass);
                      System.out.println("   " + affectedClass + " in " + info.absoluteFile.getPath());
                  }
              }
  */
              
              // we now need to scan for out of date files. When we have the list
              // we go through and delete all class files which are affected by these files.
              outOfDateClasses = new Vector();
              for (int i=0; i<srcPathList.length; i++) {
                  File srcDir = (File)project.resolveFile(srcPathList[i]);
                  if (srcDir.exists()) {
          
                      DirectoryScanner ds = this.getDirectoryScanner(srcDir);
          
                      String[] files = ds.getIncludedFiles();
          
                      scanDir(srcDir, files);
                  }
              }
              
              // we now have a complete list of classes which are out of date
              // We scan through the affected classes, deleting any affected classes.
              deleteAllAffectedFiles();
              
              log("Duration = " + (System.currentTimeMillis() - start));
          } catch (Exception e) {
              throw new BuildException(e);
          }
      }
  
      /**
       * Scans the directory looking for source files that are newer than their class files.
       * The results are returned in the class variable compileList
       */
      protected void scanDir(File srcDir, String files[]) {
  
          long now = System.currentTimeMillis();
  
          for (int i = 0; i < files.length; i++) {
              File srcFile = new File(srcDir, files[i]);
              if (files[i].endsWith(".java")) {
                  String filePath = srcFile.getPath();
                  String className = filePath.substring(srcDir.getPath().length() + 1,
                                                        filePath.length() - ".java".length());
                  className = ClassFileUtils.convertSlashName(className);                                                      
                  ClassFileInfo info = (ClassFileInfo)classFileInfoMap.get(className);
                  if (info == null) {
                      // there was no class file. add this class to the list
                      outOfDateClasses.addElement(className);
                  }
                  else {
                      if (srcFile.lastModified() > info.absoluteFile.lastModified()) {
                          outOfDateClasses.addElement(className);
                      }
                  }
              }
          }
      }
  
  
  
      /** 
       * Get the list of class files we are ging to analyse.
       *
       * @param classLocations a path structure containing all the directories
       *                       where classes can be found.
       * @return a vector containing the classes to analyse.
       */
      private Vector getClassFiles(Path classLocations) {
          // break the classLocations into its components.        
          String[] classLocationsList = classLocations.list();            
          
          Vector classFileList = new Vector();
          
          for (int i = 0; i < classLocationsList.length; ++i) {
              File dir = new File(classLocationsList[i]);
              if (dir.isDirectory()) {
                  addClassFiles(classFileList, dir, dir);
              }
          }
          
          return classFileList;
      }
  
      /** 
       * Add the list of class files from the given directory to the 
       * class file vector, including any subdirectories.
       *
       * @param classLocations a path structure containing all the directories
       *                       where classes can be found.
       * @return a vector containing the classes to analyse.
       */
      private void addClassFiles(Vector classFileList, File dir, File root) {
          String[] filesInDir = dir.list();
          
          if (filesInDir != null) {
              int length = filesInDir.length;
  
              for (int i = 0; i < length; ++i) {
                  File file = new File(dir, filesInDir[i]);
                  if (file.isDirectory()) {
                      addClassFiles(classFileList, file, root);
                  }
                  else if (file.getName().endsWith(".class")) {
                      ClassFileInfo info = new ClassFileInfo();
                      info.absoluteFile = file;
                      info.relativeName = file.getPath().substring(root.getPath().length() + 1,
                                                                   file.getPath().length() - 6);
                      info.className = ClassFileUtils.convertSlashName(info.relativeName);                                                                 
                      classFileList.addElement(info);
                  }
              } 
          } 
      }
      
      
      /**
       * Set the source dirs to find the source Java files.
       */
      public void setSrcdir(Path srcPath) {
          this.srcPath = srcPath;
      }
  
      /**
       * Set the destination directory where the compiled java files exist.
       */
      public void setDestDir(Path destPath) {
          this.destPath = destPath;
      }
      
      public void setCache(File cache) {
          this.cache = cache;
      }
      
      public void setClosure(boolean closure) {
          this.closure = closure;
      }
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java
  
  Index: DirectoryIterator.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   * 
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   * 
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   * 
   * 1. Redistributions of source code must retain the above copyright
   * notice, this list of conditions and the following disclaimer.
   * 
   * 2. Redistributions in binary form must reproduce the above copyright
   * notice, this list of conditions and the following disclaimer in
   * the documentation and/or other materials provided with the
   * distribution.
   * 
   * 3. The end-user documentation included with the redistribution, if
   * any, must include the following acknowlegement:
   * "This product includes software developed by the
   * Apache Software Foundation (http://www.apache.org/)."
   * Alternately, this acknowlegement may appear in the software itself,
   * if and wherever such third-party acknowlegements normally appear.
   * 
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   * Foundation" must not be used to endorse or promote products derived
   * from this software without prior written permission. For written
   * permission, please contact apache@apache.org.
   * 
   * 5. Products derived from this software may not be called "Apache"
   * nor may "Apache" appear in their names without prior written
   * permission of the Apache Group.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   * 
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend;
  
  import java.util.*;
  import java.io.*;
  
  /**
   * An iterator which iterates through the contents of a java directory.
   * 
   * The iterator should be created with the directory at the root of the
   * Java namespace.
   * 
   * @author Conor MacNeill
   */
  public class DirectoryIterator implements ClassFileIterator {
  
      /**
       * This is a stack of current iterators supporting the depth first
       * traversal of the directory tree.
       */
      private Stack enumStack;
  
      /**
       * The current directory iterator. As directories encounter lower level
       * directories, the current iterator is pushed onto the iterator
       * stack and a new iterator over the sub directory becomes the current
       * directory. This implements a depth first traversal of the directory namespace.
       */
      private Enumeration currentEnum;
  
      /**
       * The length of the root directory. This is used to remove the root directory
       * from full paths.
       */
      int rootLength;
  
      /**
       * Creates a directory iterator.
       * 
       * The directory iterator is created to scan the root directory. If the
       * changeInto flag is given, then the entries returned will be relative to this
       * directory and not the current directory.
       * 
       * @param rootDirectory the root if the directory namespace which is to be iterated over
       * @param changeInto if true then the returned entries will be relative to the rootDirectory
       * and not the current directory.
       * 
       * @throws IOException if there is a problem reading the directory information.
       */
      public DirectoryIterator(File rootDirectory, boolean changeInto) throws IOException {
          super();
  
          enumStack = new Stack();
  
          if (rootDirectory.isAbsolute() || changeInto) {
              rootLength = rootDirectory.getPath().length() + 1;
          } else {
              rootLength = 0;
          } 
  
          Vector filesInRoot = getDirectoryEntries(rootDirectory);
  
          currentEnum = filesInRoot.elements();
      }
  
      /**
       * Get a vector covering all the entries (files and subdirectories in a directory).
       * 
       * @param directory the directory to be scanned.
       * 
       * @return a vector containing File objects for each entry in the directory.
       */
      private Vector getDirectoryEntries(File directory) {
          Vector files = new Vector();
  
          // File[] filesInDir = directory.listFiles();
          String[] filesInDir = directory.list();
  
          if (filesInDir != null) {
              int length = filesInDir.length;
  
              for (int i = 0; i < length; ++i) {
                  files.addElement(new File(directory, filesInDir[i]));
              } 
          } 
  
          return files;
      } 
  
      /**
       * Template method to allow subclasses to supply elements for the iteration.
       * 
       * The directory iterator maintains a stack of iterators covering each level
       * in the directory hierarchy. The current iterator covers the current directory
       * being scanned. If the next entry in that directory is a subdirectory, the current
       * iterator is pushed onto the stack and a new iterator is created for the
       * subdirectory. If the entry is a file, it is returned as the next element and the
       * iterator remains valid. If there are no more entries in the current directory,
       * the topmost iterator on the statck is popped off to become the current iterator.
       * 
       * @return the next ClassFile in the iteration.
       */
      public ClassFile getNextClassFile() {
          ClassFile nextElement = null;
  
          try {
              while (nextElement == null) {
                  if (currentEnum.hasMoreElements()) {
                      File element = (File) currentEnum.nextElement();
  
                      if (element.isDirectory()) {
  
                          // push the current iterator onto the stack and then
                          // iterate through this directory.
                          enumStack.push(currentEnum);
  
                          Vector files = getDirectoryEntries(element);
  
                          currentEnum = files.elements();
                      } else {
  
                          // we have a file. create a stream for it
                          FileInputStream inFileStream = new FileInputStream(element);
  
                          if (element.getName().endsWith(".class")) {
  
                              // create a data input stream from the jar input stream
                              ClassFile javaClass = new ClassFile();
  
                              javaClass.read(inFileStream);
  
                              nextElement = javaClass;
                          } 
                      } 
                  } else {
                      // this iterator is exhausted. Can we pop one off the stack
                      if (enumStack.empty()) {
                          break;
                      } else {
                          currentEnum = (Enumeration) enumStack.pop();
                      } 
                  } 
              } 
          } catch (IOException e) {
              nextElement = null;
          } 
  
          return nextElement;
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java
  
  Index: JarFileIterator.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend;
  
  import java.util.zip.*;
  import java.io.*;
  
  /**
   * A class file iterator which iterates through the contents of a Java jar file.
   * 
   * @author Conor MacNeill
   */
  public class JarFileIterator implements ClassFileIterator {
      private ZipInputStream jarStream;
  
      public JarFileIterator(InputStream stream) throws IOException {
          super();
  
          jarStream = new ZipInputStream(stream);
      }
  
      private byte[] getEntryBytes(InputStream stream) throws IOException {
          byte[]                buffer = new byte[8192];
          ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
          int                   n;
  
          while ((n = stream.read(buffer, 0, buffer.length)) != -1) {
              baos.write(buffer, 0, n);
          } 
  
          return baos.toByteArray();
      } 
  
      public ClassFile getNextClassFile() {
          ZipEntry         jarEntry;
          ClassFile nextElement = null;
  
          try {
              jarEntry = jarStream.getNextEntry();
  
  
              while (nextElement == null && jarEntry != null) {
                  String entryName = jarEntry.getName();
  
                  if (!jarEntry.isDirectory() && entryName.endsWith(".class")) {
  
                          // create a data input stream from the jar input stream
                          ClassFile javaClass = new ClassFile();
  
                          javaClass.read(jarStream);
  
                          nextElement = javaClass;
                  } else {
                          
                      jarEntry = jarStream.getNextEntry();
                  } 
              } 
          } catch (IOException e) {
              String message = e.getMessage();
              String text = e.getClass().getName();
  
              if (message != null) {
                  text += ": " + message;
              } 
  
              throw new RuntimeException("Problem reading JAR file: " + text);
          } 
  
          return nextElement;
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ClassCPInfo.java
  
  Index: ClassCPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  import java.util.*;
  
  /**
   * The constant pool entry which stores class information.
   * 
   * @author Conor MacNeill
   */
  public class ClassCPInfo extends ConstantPoolEntry {
  
      /**
       * The class' name. This will be only valid if the entry has been resolved
       * against the constant pool.
       */
      private String className;
  
      /**
       * The index into the constant pool where this class' name is stored. If the class
       * name is changed, this entry is invalid until this entry is connected to a constant
       * pool.
       */
      private int    index;
  
      /**
       * Constructor.
       * 
       * Sets the tag value for this entry to type Class
       */
      public ClassCPInfo() {
          super(CONSTANT_Class, 1);
      }
  
      /**
       * Read the entry from a stream.
       * 
       * @param cpStream the stream containing the constant pool entry to be read.
       * 
       * @exception IOException thrown if there is a problem reading the entry from the stream.
       */
      public void read(DataInputStream cpStream) throws IOException {
          index = cpStream.readUnsignedShort();
          className = "unresolved";
      } 
  
      /**
       * Generate a string readable version of this entry
       */
      public String toString() {
          return "Class Constant Pool Entry for " + className + "[" + index + "]";
      } 
  
      /**
       * Resolve this class info against the given constant pool.
       * 
       * @param constantPool the constant pool with which to resolve the class.
       */
      public void resolve(ConstantPool constantPool) {
          className = ((Utf8CPInfo) constantPool.getEntry(index)).getValue();
  
          super.resolve(constantPool);
      } 
  
      /**
       * Get the class name of this entry.
       * 
       * @return the class' name.
       */
      public String getClassName() {
          return className;
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantCPInfo.java
  
  Index: ConstantCPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  
  /**
   * A Constant Pool entry which represents a constant value.
   * 
   * 
   * @author Conor MacNeill
   */
  abstract public class ConstantCPInfo extends ConstantPoolEntry {
  
      /**
       * The entry's untyped value.
       * 
       * Each subclass interprets the constant value based on the subclass's type.
       * The value here must be compatible.
       */
      private Object value;
  
      /**
       * Initialise the constant entry.
       * 
       * @param tagValue the constant pool entry type to be used.
       * @param entries the number of constant pool entry slots occupied by this entry.
       */
      protected ConstantCPInfo(int tagValue, int entries) {
          super(tagValue, entries);
      }
  
      /**
       * Get the value of the constant.
       * 
       * @return the value of the constant (untyped).
       */
      public Object getValue() {
          return value;
      } 
  
      /**
       * Set the constant value.
       * 
       * @param newValue the new untyped value of this constant.
       */
      public void setValue(Object newValue) {
          value = newValue;
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java
  
  Index: ConstantPool.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  import java.util.*;
  
  /**
   * The constant pool of a Java class.
   * 
   * The constant pool is a collection of constants used in a Java class file. It stores
   * strings, constant values, class names, method names, field names etc.
   * 
   * @see <a href="http://java.sun.com/docs/books/vmspec/">The Java Virtual Machine Specification</a>
   * 
   * @author Conor MacNeill
   */
  public class ConstantPool {
  
      /**
       * The entries in the constant pool.
       */
      private Vector entries;
  
      /**
       * A Hashtable of UTF8 entries - used to get constant pool indexes of the UTF8 values quickly
       */
      private Hashtable utf8Indexes;
  
      /**
       * Initialise the constant pool.
       */
      public ConstantPool() {
          entries = new Vector();
  
          // The zero index is never present in the constant pool itself so
          // we add a null entry for it
          entries.addElement(null);
  
          utf8Indexes = new Hashtable();
      }
  
      /**
       * Read the constant pool from a class input stream.
       * 
       * @param classStream the DataInputStream of a class file.
       * 
       * @throws IOException if there is a problem reading the constant pool
       * from the stream
       */
      public void read(DataInputStream classStream) throws IOException {
          int numEntries = classStream.readUnsignedShort();
  
          for (int i = 1; i < numEntries; ) {
              ConstantPoolEntry nextEntry = ConstantPoolEntry.readEntry(classStream);
  
              i += nextEntry.getNumEntries();
  
              addEntry(nextEntry);
          } 
      } 
  
      /**
       * Get the size of the constant pool.
       */
      public int size() {
          return entries.size();
      }
      
      /**
       * Add an entry to the constant pool.
       * 
       * @param entry the new entry to be added to the constant pool.
       * 
       * @return the index into the constant pool at which the entry is stored.
       */
      public int addEntry(ConstantPoolEntry entry) {
          int index = entries.size();
  
          entries.addElement(entry);
  
          int numSlots = entry.getNumEntries();
  
          // add null entries for any additional slots required.
          for (int j = 0; j < numSlots - 1; ++j) {
              entries.addElement(null);
          } 
  
          if (entry instanceof Utf8CPInfo) {
              Utf8CPInfo utf8Info = (Utf8CPInfo) entry;
  
              utf8Indexes.put(utf8Info.getValue(), new Integer(index));
          } 
  
          return index;
      } 
  
      /**
       * Resolve the entries in the constant pool.
       * 
       * Resolution of the constant pool involves transforming indexes to
       * other constant pool entries into the actual data for that entry.
       */
      public void resolve() {
          for (Enumeration i = entries.elements(); i.hasMoreElements(); ) {
              ConstantPoolEntry poolInfo = (ConstantPoolEntry) i.nextElement();
  
              if (poolInfo != null &&!poolInfo.isResolved()) {
                  poolInfo.resolve(this);
              } 
          } 
      } 
  
  
      /**
       * Get an constant pool entry at a particular index.
       * 
       * @param index the index into the constant pool.
       * 
       * @return the constant pool entry at that index.
       */
      public ConstantPoolEntry getEntry(int index) {
          return (ConstantPoolEntry) entries.elementAt(index);
      } 
  
      /**
       * Get the index of a given UTF8 constant pool entry.
       * 
       * @param value the string value of the UTF8 entry.
       * 
       * @return the index at which the given string occurs in the
       * constant pool or -1 if the value does not occur.
       */
      public int getUTF8Entry(String value) {
          int     index = -1;
          Integer indexInteger = (Integer) utf8Indexes.get(value);
  
          if (indexInteger != null) {
              index = indexInteger.intValue();
          } 
  
          return index;
      } 
  
      /**
       * Get the index of a given CONSTANT_Class entry in the constant pool.
       * 
       * @param className the name of the class for which the class entry index is required.
       * 
       * @return the index at which the given class entry occurs in the
       * constant pool or -1 if the value does not occur.
       */
      public int getClassEntry(String className) {
          int index = -1;
  
          for (int i = 0; i < entries.size() && index == -1; ++i) {
              Object element = entries.elementAt(i);
  
              if (element instanceof ClassCPInfo) {
                  ClassCPInfo classinfo = (ClassCPInfo) element;
  
                  if (classinfo.getClassName().equals(className)) {
                      index = i;
                  } 
              } 
          } 
  
          return index;
      } 
  
      /**
       * Get the index of a given constant value entry in the constant pool.
       * 
       * @param constantValue the constant value for which the index is required.
       * 
       * @return the index at which the given value entry occurs in the
       * constant pool or -1 if the value does not occur.
       */
      public int getConstantEntry(Object constantValue) {
          int index = -1;
  
          for (int i = 0; i < entries.size() && index == -1; ++i) {
              Object element = entries.elementAt(i);
  
              if (element instanceof ConstantCPInfo) {
                  ConstantCPInfo constantEntry = (ConstantCPInfo) element;
  
                  if (constantEntry.getValue().equals(constantValue)) {
                      index = i;
                  } 
              } 
          } 
  
          return index;
      } 
  
      /**
       * Get the index of a given CONSTANT_MethodRef entry in the constant pool.
       * 
       * @param methodClassName the name of the class which contains the method
       * being referenced.
       * @param methodName the name of the method being referenced.
       * @param methodType the type descriptor of the metho dbeing referenced.
       * 
       * @return the index at which the given method ref entry occurs in the
       * constant pool or -1 if the value does not occur.
       */
      public int getMethodRefEntry(String methodClassName, String methodName, String methodType) {
          int index = -1;
  
          for (int i = 0; i < entries.size() && index == -1; ++i) {
              Object element = entries.elementAt(i);
  
              if (element instanceof MethodRefCPInfo) {
                  MethodRefCPInfo methodRefEntry = (MethodRefCPInfo) element;
  
                  if (methodRefEntry.getMethodClassName().equals(methodClassName) 
                          && methodRefEntry.getMethodName().equals(methodName) && methodRefEntry.getMethodType().equals(methodType)) {
                      index = i;
                  } 
              } 
          } 
  
          return index;
      } 
  
      /**
       * Get the index of a given CONSTANT_InterfaceMethodRef entry in the constant pool.
       * 
       * @param interfaceMethodClassName the name of the interface which contains the method
       * being referenced.
       * @param interfaceMethodName the name of the method being referenced.
       * @param interfaceMethodType the type descriptor of the metho dbeing referenced.
       * 
       * @return the index at which the given method ref entry occurs in the
       * constant pool or -1 if the value does not occur.
       */
      public int getInterfaceMethodRefEntry(String interfaceMethodClassName, String interfaceMethodName, String interfaceMethodType) {
          int index = -1;
  
          for (int i = 0; i < entries.size() && index == -1; ++i) {
              Object element = entries.elementAt(i);
  
              if (element instanceof InterfaceMethodRefCPInfo) {
                  InterfaceMethodRefCPInfo interfaceMethodRefEntry = (InterfaceMethodRefCPInfo) element;
  
                  if (interfaceMethodRefEntry.getInterfaceMethodClassName().equals(interfaceMethodClassName) 
                          && interfaceMethodRefEntry.getInterfaceMethodName().equals(interfaceMethodName) 
                          && interfaceMethodRefEntry.getInterfaceMethodType().equals(interfaceMethodType)) {
                      index = i;
                  } 
              } 
          } 
  
          return index;
      } 
  
      /**
       * Get the index of a given CONSTANT_FieldRef entry in the constant pool.
       * 
       * @param fieldClassName the name of the class which contains the field
       * being referenced.
       * @param fieldName the name of the field being referenced.
       * @param fieldType the type descriptor of the field being referenced.
       * 
       * @return the index at which the given field ref entry occurs in the
       * constant pool or -1 if the value does not occur.
       */
      public int getFieldRefEntry(String fieldClassName, String fieldName, String fieldType) {
          int index = -1;
  
          for (int i = 0; i < entries.size() && index == -1; ++i) {
              Object element = entries.elementAt(i);
  
              if (element instanceof FieldRefCPInfo) {
                  FieldRefCPInfo fieldRefEntry = (FieldRefCPInfo) element;
  
                  if (fieldRefEntry.getFieldClassName().equals(fieldClassName) && fieldRefEntry.getFieldName().equals(fieldName) 
                          && fieldRefEntry.getFieldType().equals(fieldType)) {
                      index = i;
                  } 
              } 
          } 
  
          return index;
      } 
  
      /**
       * Get the index of a given CONSTANT_NameAndType entry in the constant pool.
       * 
       * @param name the name
       * @param type the type
       * 
       * @return the index at which the given NameAndType entry occurs in the
       * constant pool or -1 if the value does not occur.
       */
      public int getNameAndTypeEntry(String name, String type) {
          int index = -1;
  
          for (int i = 0; i < entries.size() && index == -1; ++i) {
              Object element = entries.elementAt(i);
  
              if (element instanceof NameAndTypeCPInfo) {
                  NameAndTypeCPInfo nameAndTypeEntry = (NameAndTypeCPInfo) element;
  
                  if (nameAndTypeEntry.getName().equals(name) && nameAndTypeEntry.getType().equals(type)) {
                      index = i;
                  } 
              } 
          } 
  
          return index;
      } 
  
      /**
       * Dump the constant pool to a string.
       * 
       * @return the constant pool entries as strings
       */
      public String toString() {
          StringBuffer sb = new StringBuffer("\n");
          int          size = entries.size();
  
          for (int i = 0; i < size; ++i) {
              sb.append("[" + i + "] = " + getEntry(i) + "\n");
          } 
  
          return sb.toString();
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java
  
  Index: ConstantPoolEntry.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  import java.util.*;
  
  /**
   * An entry in the constant pool.
   * 
   * This class contains a represenation of the constant pool entries. It is
   * an abstract base class for all the different forms of constant pool entry.
   * 
   * @author Conor MacNeill
   * @see ConstantPool
   */
  public abstract class ConstantPoolEntry {
  
      /**
       * Tag value for UTF8 entries.
       */
      static public final int CONSTANT_Utf8 = 1;
  
      /**
       * Tag value for Integer entries.
       */
      static public final int CONSTANT_Integer = 3;
  
      /**
       * Tag value for Float entries.
       */
      static public final int CONSTANT_Float = 4;
  
      /**
       * Tag value for Long entries.
       */
      static public final int CONSTANT_Long = 5;
  
      /**
       * Tag value for Double entries.
       */
      static public final int CONSTANT_Double = 6;
  
      /**
       * Tag value for Class entries.
       */
      static public final int CONSTANT_Class = 7;
  
      /**
       * Tag value for String entries.
       */
      static public final int CONSTANT_String = 8;
  
      /**
       * Tag value for Field Reference entries.
       */
      static public final int CONSTANT_FieldRef = 9;
  
      /**
       * Tag value for Method Reference entries.
       */
      static public final int CONSTANT_MethodRef = 10;
  
      /**
       * Tag value for Interface Method Reference entries.
       */
      static public final int CONSTANT_InterfaceMethodRef = 11;
  
      /**
       * Tag value for Name and Type entries.
       */
      static public final int CONSTANT_NameAndType = 12;
  
      /**
       * This entry's tag which identifies the type of this constant pool entry.
       */
      private int             tag;
  
      /**
       * The number of slots in the constant pool, occupied by this entry.
       */
      private int             numEntries;
  
      /**
       * A flag which indiciates if this entry has been resolved or not.
       */
      private boolean         resolved;
  
      /**
       * Initialse the constant pool entry.
       * 
       * @param tagValue the tag value which identifies which type of constant pool entry this is.
       * @param entries the number of constant pool entry slots this entry occupies.
       */
      public ConstantPoolEntry(int tagValue, int entries) {
          tag = tagValue;
          numEntries = entries;
          resolved = false;
      }
  
      /**
       * Read a constant pool entry from a stream.
       * 
       * This is a factory method which reads a constant pool entry
       * form a stream and returns the appropriate subclass for the
       * entry.
       * 
       * @param cpStream the stream from which the constant pool entry is to be read.
       * 
       * @returns the appropriate ConstantPoolEntry subclass representing the
       * constant pool entry from the stream.
       * 
       * @throws IOExcception if there is a problem reading the entry from the stream.
       */
      static public ConstantPoolEntry readEntry(DataInputStream cpStream) throws IOException {
          ConstantPoolEntry cpInfo = null;
          int               cpTag = cpStream.readUnsignedByte();
  
          switch (cpTag) {
  
          case CONSTANT_Utf8:
              cpInfo = new Utf8CPInfo();
  
              break;
  
          case CONSTANT_Integer:
              cpInfo = new IntegerCPInfo();
  
              break;
  
          case CONSTANT_Float:
              cpInfo = new FloatCPInfo();
  
              break;
  
          case CONSTANT_Long:
              cpInfo = new LongCPInfo();
  
              break;
  
          case CONSTANT_Double:
              cpInfo = new DoubleCPInfo();
  
              break;
  
          case CONSTANT_Class:
              cpInfo = new ClassCPInfo();
  
              break;
  
          case CONSTANT_String:
              cpInfo = new StringCPInfo();
  
              break;
  
          case CONSTANT_FieldRef:
              cpInfo = new FieldRefCPInfo();
  
              break;
  
          case CONSTANT_MethodRef:
              cpInfo = new MethodRefCPInfo();
  
              break;
  
          case CONSTANT_InterfaceMethodRef:
              cpInfo = new InterfaceMethodRefCPInfo();
  
              break;
  
          case CONSTANT_NameAndType:
              cpInfo = new NameAndTypeCPInfo();
  
              break;
  
          default:
              throw new ClassFormatError("Invalid Constant Pool entry Type " + cpTag);
          }
  
          cpInfo.read(cpStream);
  
          return cpInfo;
      } 
  
      /**
       * Indicates whether this entry has been resolved.
       * 
       * In general a constant pool entry can reference another constant
       * pool entry by its index value. Resolution involves replacing this
       * index value with the constant pool entry at that index.
       * 
       * @return true if this entry has been resolved.
       */
      public boolean isResolved() {
          return resolved;
      } 
  
      /**
       * Resolve this constant pool entry with respect to its dependents in
       * the constant pool.
       * 
       * @param constantPool the constant pool of which this entry is a member
       * and against which this entry is to be resolved.
       */
      public void resolve(ConstantPool constantPool) {
          resolved = true;
      } 
  
      /**
       * read a constant pool entry from a class stream.
       * 
       * @param cpStream the DataInputStream which contains the constant pool entry to be read.
       * 
       * @throws IOException if there is a problem reading the entry from the stream.
       */
      public abstract void read(DataInputStream cpStream) throws IOException;
  
      /**
       * Get the Entry's type tag.
       * 
       * @return The Tag value of this entry
       */
      public int getTag() {
          return tag;
      } 
  
      /**
       * Get the number of Constant Pool Entry slots within the constant pool occupied by this entry.
       * 
       * @return the number of slots used.
       * 
       */
      public final int getNumEntries() {
          return numEntries;
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java
  
  Index: DoubleCPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.IOException;
  import java.io.DataInputStream;
  import java.io.DataOutputStream;
  
  /**
   * The constant pool entry subclass used to represent double constant values.
   * 
   * @author Conor MacNeill
   */
  public class DoubleCPInfo extends ConstantCPInfo {
      public DoubleCPInfo() {
          super(CONSTANT_Double, 2);
      }
  
      /**
       * read a constant pool entry from a class stream.
       * 
       * @param cpStream the DataInputStream which contains the constant pool entry to be read.
       * 
       * @throws IOException if there is a problem reading the entry from the stream.
       */
      public void read(DataInputStream cpStream) throws IOException {
          setValue(new Double(cpStream.readDouble()));
      } 
  
      /**
       * Print a readable version of the constant pool entry.
       * 
       * @return the string representation of this constant pool entry.
       */
      public String toString() {
          return "Double Constant Pool Entry: " + getValue();
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FieldRefCPInfo.java
  
  Index: FieldRefCPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  import java.util.*;
  
  /**
   * A FieldRef CP Info
   * 
   * @author Conor MacNeill
   */
  public class FieldRefCPInfo extends ConstantPoolEntry {
      private String fieldClassName;
      private String fieldName;
      private String fieldType;
      private int    classIndex;
      private int    nameAndTypeIndex;
  
      /**
       * Constructor.
       * 
       */
      public FieldRefCPInfo() {
          super(CONSTANT_FieldRef, 1);
      }
  
      /**
       * read a constant pool entry from a class stream.
       * 
       * @param cpStream the DataInputStream which contains the constant pool entry to be read.
       * 
       * @throws IOException if there is a problem reading the entry from the stream.
       */
      public void read(DataInputStream cpStream) throws IOException {
          classIndex = cpStream.readUnsignedShort();
          nameAndTypeIndex = cpStream.readUnsignedShort();
      } 
  
      /**
       * Resolve this constant pool entry with respect to its dependents in
       * the constant pool.
       * 
       * @param constantPool the constant pool of which this entry is a member
       * and against which this entry is to be resolved.
       */
      public void resolve(ConstantPool constantPool) {
          ClassCPInfo fieldClass = (ClassCPInfo) constantPool.getEntry(classIndex);
  
          fieldClass.resolve(constantPool);
  
          fieldClassName = fieldClass.getClassName();
  
          NameAndTypeCPInfo nt = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex);
  
          nt.resolve(constantPool);
  
          fieldName = nt.getName();
          fieldType = nt.getType();
  
          super.resolve(constantPool);
      } 
  
      /**
       * Print a readable version of the constant pool entry.
       * 
       * @return the string representation of this constant pool entry.
       */
      public String toString() {
          String value;
  
          if (isResolved()) {
              value = "Field : Class = " + fieldClassName + ", name = " + fieldName + ", type = " + fieldType;
          } else {
              value = "Field : Class index = " + classIndex + ", name and type index = " + nameAndTypeIndex;
          } 
  
          return value;
      } 
  
      public String getFieldClassName() {
          return fieldClassName;
      } 
  
      public String getFieldName() {
          return fieldName;
      } 
  
      public String getFieldType() {
          return fieldType;
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FloatCPInfo.java
  
  Index: FloatCPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  
  /**
   * A Float CP Info
   * 
   * @author Conor MacNeill
   */
  public class FloatCPInfo extends ConstantCPInfo {
  
      /**
       * Constructor.
       * 
       */
      public FloatCPInfo() {
          super(CONSTANT_Float, 1);
      }
  
      /**
       * read a constant pool entry from a class stream.
       * 
       * @param cpStream the DataInputStream which contains the constant pool entry to be read.
       * 
       * @throws IOException if there is a problem reading the entry from the stream.
       */
      public void read(DataInputStream cpStream) throws IOException {
          setValue(new Float(cpStream.readFloat()));
      } 
  
      /**
       * Print a readable version of the constant pool entry.
       * 
       * @return the string representation of this constant pool entry.
       */
      public String toString() {
          return "Float Constant Pool Entry: " + getValue();
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/IntegerCPInfo.java
  
  Index: IntegerCPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  
  /**
   * An Integer CP Info
   * 
   * @author Conor MacNeill
   */
  public class IntegerCPInfo extends ConstantCPInfo {
  
      /**
       * Constructor.
       * 
       */
      public IntegerCPInfo() {
          super(CONSTANT_Integer, 1);
      }
  
      /**
       * read a constant pool entry from a class stream.
       * 
       * @param cpStream the DataInputStream which contains the constant pool entry to be read.
       * 
       * @throws IOException if there is a problem reading the entry from the stream.
       */
      public void read(DataInputStream cpStream) throws IOException {
          setValue(new Integer(cpStream.readInt()));
      } 
  
      /**
       * Print a readable version of the constant pool entry.
       * 
       * @return the string representation of this constant pool entry.
       */
      public String toString() {
          return "Integer Constant Pool Entry: " + getValue();
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InterfaceMethodRefCPInfo.java
  
  Index: InterfaceMethodRefCPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  import java.util.*;
  
  /**
   * A InterfaceMethodRef CP Info
   * 
   * 
   * @author Conor MacNeill
   */
  public class InterfaceMethodRefCPInfo extends ConstantPoolEntry {
      private String interfaceMethodClassName;
      private String interfaceMethodName;
      private String interfaceMethodType;
      private int    classIndex;
      private int    nameAndTypeIndex;
  
      /**
       * Constructor.
       * 
       */
      public InterfaceMethodRefCPInfo() {
          super(CONSTANT_InterfaceMethodRef, 1);
      }
  
      /**
       * read a constant pool entry from a class stream.
       * 
       * @param cpStream the DataInputStream which contains the constant pool entry to be read.
       * 
       * @throws IOException if there is a problem reading the entry from the stream.
       */
      public void read(DataInputStream cpStream) throws IOException {
          classIndex = cpStream.readUnsignedShort();
          nameAndTypeIndex = cpStream.readUnsignedShort();
      } 
  
      /**
       * Resolve this constant pool entry with respect to its dependents in
       * the constant pool.
       * 
       * @param constantPool the constant pool of which this entry is a member
       * and against which this entry is to be resolved.
       */
      public void resolve(ConstantPool constantPool) {
          ClassCPInfo interfaceMethodClass = (ClassCPInfo) constantPool.getEntry(classIndex);
  
          interfaceMethodClass.resolve(constantPool);
  
          interfaceMethodClassName = interfaceMethodClass.getClassName();
  
          NameAndTypeCPInfo nt = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex);
  
          nt.resolve(constantPool);
  
          interfaceMethodName = nt.getName();
          interfaceMethodType = nt.getType();
  
          super.resolve(constantPool);
      } 
  
      /**
       * Print a readable version of the constant pool entry.
       * 
       * @return the string representation of this constant pool entry.
       */
      public String toString() {
          String value;
  
          if (isResolved()) {
              value = "InterfaceMethod : Class = " + interfaceMethodClassName + ", name = " + interfaceMethodName + ", type = " 
                      + interfaceMethodType;
          } else {
              value = "InterfaceMethod : Class index = " + classIndex + ", name and type index = " + nameAndTypeIndex;
          } 
  
          return value;
      } 
  
      public String getInterfaceMethodClassName() {
          return interfaceMethodClassName;
      } 
  
      public String getInterfaceMethodName() {
          return interfaceMethodName;
      } 
  
      public String getInterfaceMethodType() {
          return interfaceMethodType;
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/LongCPInfo.java
  
  Index: LongCPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  
  /**
   * A Long CP Info
   * 
   * @author Conor MacNeill
   */
  public class LongCPInfo extends ConstantCPInfo {
  
      /**
       * Constructor.
       * 
       */
      public LongCPInfo() {
          super(CONSTANT_Long, 2);
      }
  
      /**
       * read a constant pool entry from a class stream.
       * 
       * @param cpStream the DataInputStream which contains the constant pool entry to be read.
       * 
       * @throws IOException if there is a problem reading the entry from the stream.
       */
      public void read(DataInputStream cpStream) throws IOException {
          setValue(new Long(cpStream.readLong()));
      } 
  
      /**
       * Print a readable version of the constant pool entry.
       * 
       * @return the string representation of this constant pool entry.
       */
      public String toString() {
          return "Long Constant Pool Entry: " + getValue();
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodRefCPInfo.java
  
  Index: MethodRefCPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  import java.util.*;
  
  /**
   * A MethodRef CP Info
   * 
   * @author Conor MacNeill
   */
  public class MethodRefCPInfo extends ConstantPoolEntry {
      private String methodClassName;
      private String methodName;
      private String methodType;
      private int    classIndex;
      private int    nameAndTypeIndex;
  
      /**
       * Constructor.
       * 
       */
      public MethodRefCPInfo() {
          super(CONSTANT_MethodRef, 1);
      }
  
      /**
       * read a constant pool entry from a class stream.
       * 
       * @param cpStream the DataInputStream which contains the constant pool entry to be read.
       * 
       * @throws IOException if there is a problem reading the entry from the stream.
       */
      public void read(DataInputStream cpStream) throws IOException {
          classIndex = cpStream.readUnsignedShort();
          nameAndTypeIndex = cpStream.readUnsignedShort();
      } 
  
      /**
       * Print a readable version of the constant pool entry.
       * 
       * @return the string representation of this constant pool entry.
       */
      public String toString() {
          String value;
  
          if (isResolved()) {
              value = "Method : Class = " + methodClassName + ", name = " + methodName + ", type = " + methodType;
          } else {
              value = "Method : Class index = " + classIndex + ", name and type index = " + nameAndTypeIndex;
          } 
  
          return value;
      } 
  
      /**
       * Resolve this constant pool entry with respect to its dependents in
       * the constant pool.
       * 
       * @param constantPool the constant pool of which this entry is a member
       * and against which this entry is to be resolved.
       */
      public void resolve(ConstantPool constantPool) {
          ClassCPInfo methodClass = (ClassCPInfo) constantPool.getEntry(classIndex);
  
          methodClass.resolve(constantPool);
  
          methodClassName = methodClass.getClassName();
  
          NameAndTypeCPInfo nt = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex);
  
          nt.resolve(constantPool);
  
          methodName = nt.getName();
          methodType = nt.getType();
  
          super.resolve(constantPool);
      } 
  
      public String getMethodClassName() {
          return methodClassName;
      } 
  
      public String getMethodName() {
          return methodName;
      } 
  
      public String getMethodType() {
          return methodType;
      } 
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/NameAndTypeCPInfo.java
  
  Index: NameAndTypeCPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  import java.util.*;
  
  /**
   * A NameAndType CP Info
   * 
   * @author Conor MacNeill
   */
  public class NameAndTypeCPInfo extends ConstantPoolEntry {
  
      /**
       * Constructor.
       * 
       */
      public NameAndTypeCPInfo() {
          super(CONSTANT_NameAndType, 1);
      }
  
      /**
       * read a constant pool entry from a class stream.
       * 
       * @param cpStream the DataInputStream which contains the constant pool entry to be read.
       * 
       * @throws IOException if there is a problem reading the entry from the stream.
       */
      public void read(DataInputStream cpStream) throws IOException {
          nameIndex = cpStream.readUnsignedShort();
          descriptorIndex = cpStream.readUnsignedShort();
      } 
  
      /**
       * Print a readable version of the constant pool entry.
       * 
       * @return the string representation of this constant pool entry.
       */
      public String toString() {
          String value;
  
          if (isResolved()) {
              value = "Name = " + name + ", type = " + type;
          } else {
              value = "Name index = " + nameIndex + ", descriptor index = " + descriptorIndex;
          } 
  
          return value;
      } 
  
      /**
       * Resolve this constant pool entry with respect to its dependents in
       * the constant pool.
       * 
       * @param constantPool the constant pool of which this entry is a member
       * and against which this entry is to be resolved.
       */
      public void resolve(ConstantPool constantPool) {
          name = ((Utf8CPInfo) constantPool.getEntry(nameIndex)).getValue();
          type = ((Utf8CPInfo) constantPool.getEntry(descriptorIndex)).getValue();
  
          super.resolve(constantPool);
      } 
  
      public String getName() {
          return name;
      } 
  
      public String getType() {
          return type;
      } 
  
      private String name;
      private String type;
      private int    nameIndex;
      private int    descriptorIndex;
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java
  
  Index: StringCPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  import java.util.*;
  
  /**
   * A String Constant Pool Entry.
   * 
   * The String info contains an index into the constant pool where
   * a UTF8 string is stored.
   * 
   * @author Conor MacNeill
   */
  public class StringCPInfo extends ConstantCPInfo {
  
      /**
       * Constructor.
       * 
       */
      public StringCPInfo() {
          super(CONSTANT_String, 1);
      }
  
      /**
       * read a constant pool entry from a class stream.
       * 
       * @param cpStream the DataInputStream which contains the constant pool entry to be read.
       * 
       * @throws IOException if there is a problem reading the entry from the stream.
       */
      public void read(DataInputStream cpStream) throws IOException {
          index = cpStream.readUnsignedShort();
  
          setValue("unresolved");
      } 
  
      /**
       * Print a readable version of the constant pool entry.
       * 
       * @return the string representation of this constant pool entry.
       */
      public String toString() {
          return "String Constant Pool Entry for " + getValue() + "[" + index + "]";
      } 
  
      /**
       * Resolve this constant pool entry with respect to its dependents in
       * the constant pool.
       * 
       * @param constantPool the constant pool of which this entry is a member
       * and against which this entry is to be resolved.
       */
      public void resolve(ConstantPool constantPool) {
          setValue(((Utf8CPInfo) constantPool.getEntry(index)).getValue());
          super.resolve(constantPool);
      } 
  
      private int index;
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/Utf8CPInfo.java
  
  Index: Utf8CPInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
  
  import java.io.*;
  import java.util.*;
  
  /**
   * A UTF8 Constant Pool Entry.
   * 
   * @author Conor MacNeill
   */
  public class Utf8CPInfo extends ConstantPoolEntry {
      private String value;
  
      /**
       * Constructor.
       * 
       */
      public Utf8CPInfo() {
          super(CONSTANT_Utf8, 1);
      }
  
      /**
       * read a constant pool entry from a class stream.
       * 
       * @param cpStream the DataInputStream which contains the constant pool entry to be read.
       * 
       * @throws IOException if there is a problem reading the entry from the stream.
       */
      public void read(DataInputStream cpStream) throws IOException {
          value = cpStream.readUTF();
      } 
  
      /**
       * Print a readable version of the constant pool entry.
       * 
       * @return the string representation of this constant pool entry.
       */
      public String toString() {
          return "UTF8 Value = " + value;
      } 
  
      public String getValue() {
          return value;
      } 
  
  }
  
  
  
  

Mime
View raw message