git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270640 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,22 +53,22 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend; | package org.apache.tools.ant.taskdefs.optional.depend; | ||||
| import java.io.DataInputStream; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.io.DataInputStream; | |||||
| import java.util.Vector; | import java.util.Vector; | ||||
| import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ConstantPool; | |||||
| import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ClassCPInfo; | import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ClassCPInfo; | ||||
| import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ConstantPool; | |||||
| import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ConstantPoolEntry; | import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ConstantPoolEntry; | ||||
| /** | /** | ||||
| * A ClassFile object stores information about a Java class. | * A ClassFile object stores information about a Java class. | ||||
| * | |||||
| * | |||||
| * The class may be read from a DataInputStream.and written | * The class may be read from a DataInputStream.and written | ||||
| * to a DataOutputStream. These are usually streams from a Java | * to a DataOutputStream. These are usually streams from a Java | ||||
| * class file or a class file component of a Jar file. | * class file or a class file component of a Jar file. | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class ClassFile { | public class ClassFile { | ||||
| @@ -92,16 +92,16 @@ public class ClassFile { | |||||
| /** | /** | ||||
| * Read the class from a data stream. | * Read the class from a data stream. | ||||
| * | |||||
| * | |||||
| * This method takes an InputStream as input and | * This method takes an InputStream as input and | ||||
| * parses the class from the stream. | * parses the class from the stream. | ||||
| * <p> | * <p> | ||||
| * | |||||
| * | |||||
| * @param stream an InputStream from which the class will be read | * @param stream an InputStream from which the class will be read | ||||
| * | |||||
| * | |||||
| * @throws IOException if there is a problem reading from the given stream. | * @throws IOException if there is a problem reading from the given stream. | ||||
| * @throws ClassFormatError if the class cannot be parsed correctly | * @throws ClassFormatError if the class cannot be parsed correctly | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public void read(InputStream stream) throws IOException, ClassFormatError { | public void read(InputStream stream) throws IOException, ClassFormatError { | ||||
| DataInputStream classStream = new DataInputStream(stream); | DataInputStream classStream = new DataInputStream(stream); | ||||
| @@ -109,7 +109,7 @@ public class ClassFile { | |||||
| if (classStream.readInt() != CLASS_MAGIC) { | if (classStream.readInt() != CLASS_MAGIC) { | ||||
| throw new ClassFormatError("No Magic Code Found - probably not a Java class file."); | throw new ClassFormatError("No Magic Code Found - probably not a Java class file."); | ||||
| } | |||||
| } | |||||
| // right we have a good looking class file. | // right we have a good looking class file. | ||||
| int minorVersion = classStream.readUnsignedShort(); | int minorVersion = classStream.readUnsignedShort(); | ||||
| @@ -125,7 +125,7 @@ public class ClassFile { | |||||
| int thisClassIndex = classStream.readUnsignedShort(); | int thisClassIndex = classStream.readUnsignedShort(); | ||||
| int superClassIndex = classStream.readUnsignedShort(); | int superClassIndex = classStream.readUnsignedShort(); | ||||
| className = ((ClassCPInfo) constantPool.getEntry(thisClassIndex)).getClassName(); | className = ((ClassCPInfo) constantPool.getEntry(thisClassIndex)).getClassName(); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| @@ -143,20 +143,20 @@ public class ClassFile { | |||||
| if (!classEntry.getClassName().equals(className)) { | if (!classEntry.getClassName().equals(className)) { | ||||
| classRefs.addElement(ClassFileUtils.convertSlashName(classEntry.getClassName())); | classRefs.addElement(ClassFileUtils.convertSlashName(classEntry.getClassName())); | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return classRefs; | return classRefs; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the class' fully qualified name in dot format. | * Get the class' fully qualified name in dot format. | ||||
| * | |||||
| * | |||||
| * @return the class name in dot format (eg. java.lang.Object) | * @return the class name in dot format (eg. java.lang.Object) | ||||
| */ | */ | ||||
| public String getFullClassName() { | public String getFullClassName() { | ||||
| return ClassFileUtils.convertSlashName(className); | return ClassFileUtils.convertSlashName(className); | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -55,11 +55,11 @@ package org.apache.tools.ant.taskdefs.optional.depend; | |||||
| /** | /** | ||||
| * Utility class file routines. | * Utility class file routines. | ||||
| * | |||||
| * | |||||
| * This class porovides a number of static utility methods to convert between the | * 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 | * formats used in the Java class file format and those commonly used in Java | ||||
| * programming. | * programming. | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class ClassFileUtils { | public class ClassFileUtils { | ||||
| @@ -67,24 +67,24 @@ public class ClassFileUtils { | |||||
| /** | /** | ||||
| * Convert a class name from class file slash notation to java source | * Convert a class name from class file slash notation to java source | ||||
| * file dot notation. | * file dot notation. | ||||
| * | |||||
| * | |||||
| * @param slashName the class name in slash notation (eg. java/lang/Object) | * @param slashName the class name in slash notation (eg. java/lang/Object) | ||||
| * | |||||
| * | |||||
| * @return the class name in dot notation (eg. java.lang.Object). | * @return the class name in dot notation (eg. java.lang.Object). | ||||
| */ | */ | ||||
| public static String convertSlashName(String name) { | public static String convertSlashName(String name) { | ||||
| return name.replace('\\', '.').replace( '/', '.' ); | |||||
| } | |||||
| return name.replace('\\', '.').replace('/', '.'); | |||||
| } | |||||
| /** | /** | ||||
| * Convert a class name from java source file dot notation to class file slash notation.. | * 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). | * @param dotName the class name in dot notation (eg. java.lang.Object). | ||||
| * | |||||
| * | |||||
| * @return the class name in slash notation (eg. java/lang/Object). | * @return the class name in slash notation (eg. java/lang/Object). | ||||
| */ | */ | ||||
| public static String convertDotName(String dotName) { | public static String convertDotName(String dotName) { | ||||
| return dotName.replace( '.', '/'); | |||||
| } | |||||
| return dotName.replace('.', '/'); | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -54,30 +54,29 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.depend; | package org.apache.tools.ant.taskdefs.optional.depend; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.BuildException; | |||||
| import org.apache.tools.ant.DirectoryScanner; | |||||
| import org.apache.tools.ant.types.Path; | |||||
| import org.apache.tools.ant.types.Reference; | |||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | |||||
| import java.util.Hashtable; | |||||
| import java.util.Vector; | |||||
| import java.util.Enumeration; | |||||
| import java.io.File; | |||||
| import java.io.IOException; | |||||
| import java.io.BufferedReader; | import java.io.BufferedReader; | ||||
| import java.io.File; | |||||
| import java.io.FileInputStream; | |||||
| import java.io.FileReader; | import java.io.FileReader; | ||||
| import java.io.PrintWriter; | |||||
| import java.io.FileWriter; | import java.io.FileWriter; | ||||
| import java.io.FileInputStream; | |||||
| import java.io.IOException; | |||||
| import java.io.PrintWriter; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.util.Enumeration; | |||||
| import java.util.Hashtable; | |||||
| import java.util.Vector; | |||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.BuildException; | |||||
| import org.apache.tools.ant.DirectoryScanner; | |||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | |||||
| import org.apache.tools.ant.types.Path; | |||||
| import org.apache.tools.ant.types.Reference; | |||||
| /** | /** | ||||
| * Generate a dependency file for a given set of classes | |||||
| * Generate a dependency file for a given set of classes | |||||
| * | * | ||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| @@ -88,25 +87,25 @@ public class Depend extends MatchingTask { | |||||
| private static class ClassFileInfo { | private static class ClassFileInfo { | ||||
| /** The file where the class file is stored in the file system */ | /** The file where the class file is stored in the file system */ | ||||
| public File absoluteFile; | public File absoluteFile; | ||||
| /** The location of the file relative to its base directory - the root | /** The location of the file relative to its base directory - the root | ||||
| of the package namespace */ | |||||
| of the package namespace */ | |||||
| public String relativeName; | public String relativeName; | ||||
| /** The Java class name of this class */ | /** The Java class name of this class */ | ||||
| public String className; | public String className; | ||||
| } | } | ||||
| /** | /** | ||||
| * The path where source files exist | * The path where source files exist | ||||
| */ | |||||
| */ | |||||
| private Path srcPath; | private Path srcPath; | ||||
| /** | /** | ||||
| * The path where compiled class files exist. | * The path where compiled class files exist. | ||||
| */ | */ | ||||
| private Path destPath; | private Path destPath; | ||||
| /** | /** | ||||
| * The directory which contains the dependency cache. | * The directory which contains the dependency cache. | ||||
| */ | */ | ||||
| @@ -121,10 +120,10 @@ public class Depend extends MatchingTask { | |||||
| * A map which gives information about a class | * A map which gives information about a class | ||||
| */ | */ | ||||
| private Hashtable classFileInfoMap; | private Hashtable classFileInfoMap; | ||||
| /** | /** | ||||
| * A map which gives the list of jars and classes from the classpath that | * A map which gives the list of jars and classes from the classpath that | ||||
| * a class depends upon | |||||
| * a class depends upon | |||||
| */ | */ | ||||
| private Hashtable classpathDependencies; | private Hashtable classpathDependencies; | ||||
| @@ -132,14 +131,14 @@ public class Depend extends MatchingTask { | |||||
| * The list of classes which are out of date. | * The list of classes which are out of date. | ||||
| */ | */ | ||||
| private Hashtable outOfDateClasses; | private Hashtable outOfDateClasses; | ||||
| /** | /** | ||||
| * indicates that the dependency relationships should be extended | * indicates that the dependency relationships should be extended | ||||
| * beyond direct dependencies to include all classes. So if A directly | * beyond direct dependencies to include all classes. So if A directly | ||||
| * affects B abd B directly affects C, then A indirectly affects C. | * affects B abd B directly affects C, then A indirectly affects C. | ||||
| */ | */ | ||||
| private boolean closure = false; | private boolean closure = false; | ||||
| /** | /** | ||||
| * Flag which controls whether the reversed dependencies should be dumped | * Flag which controls whether the reversed dependencies should be dumped | ||||
| * to the log | * to the log | ||||
| @@ -187,13 +186,13 @@ public class Depend extends MatchingTask { | |||||
| public void setClasspathRef(Reference r) { | public void setClasspathRef(Reference r) { | ||||
| createClasspath().setRefid(r); | createClasspath().setRefid(r); | ||||
| } | } | ||||
| /** | /** | ||||
| * Read the dependencies from cache file | * Read the dependencies from cache file | ||||
| */ | */ | ||||
| private Hashtable readCachedDependencies() throws IOException{ | |||||
| private Hashtable readCachedDependencies() throws IOException { | |||||
| Hashtable dependencyMap = new Hashtable(); | Hashtable dependencyMap = new Hashtable(); | ||||
| if (cache != null) { | if (cache != null) { | ||||
| File depFile = new File(cache, CACHE_FILE_NAME); | File depFile = new File(cache, CACHE_FILE_NAME); | ||||
| BufferedReader in = null; | BufferedReader in = null; | ||||
| @@ -209,48 +208,45 @@ public class Depend extends MatchingTask { | |||||
| dependencyList = new Vector(); | dependencyList = new Vector(); | ||||
| className = line.substring(prependLength); | className = line.substring(prependLength); | ||||
| dependencyMap.put(className, dependencyList); | dependencyMap.put(className, dependencyList); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| dependencyList.addElement(line); | dependencyList.addElement(line); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| finally { | |||||
| if (in != null) { | |||||
| } finally { | |||||
| if (in != null) { | |||||
| in.close(); | in.close(); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return dependencyMap; | return dependencyMap; | ||||
| } | } | ||||
| /** | /** | ||||
| * Write the dependencies to cache file | * Write the dependencies to cache file | ||||
| */ | */ | ||||
| private void writeCachedDependencies(Hashtable dependencyMap) throws IOException{ | |||||
| private void writeCachedDependencies(Hashtable dependencyMap) throws IOException { | |||||
| if (cache != null) { | if (cache != null) { | ||||
| PrintWriter pw = null; | PrintWriter pw = null; | ||||
| try { | try { | ||||
| cache.mkdirs(); | |||||
| cache.mkdirs(); | |||||
| File depFile = new File(cache, CACHE_FILE_NAME); | File depFile = new File(cache, CACHE_FILE_NAME); | ||||
| pw = new PrintWriter(new FileWriter(depFile)); | pw = new PrintWriter(new FileWriter(depFile)); | ||||
| for (Enumeration deps = dependencyMap.keys(); deps.hasMoreElements();) { | for (Enumeration deps = dependencyMap.keys(); deps.hasMoreElements();) { | ||||
| String className = (String)deps.nextElement(); | |||||
| String className = (String) deps.nextElement(); | |||||
| pw.println(CLASSNAME_PREPEND + className); | pw.println(CLASSNAME_PREPEND + className); | ||||
| Vector dependencyList = (Vector)dependencyMap.get(className); | |||||
| Vector dependencyList = (Vector) dependencyMap.get(className); | |||||
| int size = dependencyList.size(); | int size = dependencyList.size(); | ||||
| for (int x = 0; x < size; x++) { | for (int x = 0; x < size; x++) { | ||||
| pw.println(dependencyList.elementAt(x)); | pw.println(dependencyList.elementAt(x)); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| finally { | |||||
| if (pw != null) { | |||||
| } finally { | |||||
| if (pw != null) { | |||||
| pw.close(); | pw.close(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -259,21 +255,21 @@ public class Depend extends MatchingTask { | |||||
| /** | /** | ||||
| * Determine the dependencies between classes. | |||||
| * Determine the dependencies between classes. | |||||
| * | * | ||||
| * Class dependencies are determined by examining the class references in a class file | * Class dependencies are determined by examining the class references in a class file | ||||
| * to other classes | |||||
| * to other classes | |||||
| */ | */ | ||||
| private void determineDependencies() throws IOException { | private void determineDependencies() throws IOException { | ||||
| affectedClassMap = new Hashtable(); | affectedClassMap = new Hashtable(); | ||||
| classFileInfoMap = new Hashtable(); | classFileInfoMap = new Hashtable(); | ||||
| boolean cacheDirty = false; | boolean cacheDirty = false; | ||||
| Hashtable dependencyMap = new Hashtable(); | Hashtable dependencyMap = new Hashtable(); | ||||
| File depCacheFile = null; | File depCacheFile = null; | ||||
| boolean depCacheFileExists = true; | boolean depCacheFileExists = true; | ||||
| long depCacheFileLastModified = Long.MAX_VALUE; | long depCacheFileLastModified = Long.MAX_VALUE; | ||||
| // read the dependency cache from the disk | // read the dependency cache from the disk | ||||
| if (cache != null) { | if (cache != null) { | ||||
| dependencyMap = readCachedDependencies(); | dependencyMap = readCachedDependencies(); | ||||
| @@ -281,22 +277,22 @@ public class Depend extends MatchingTask { | |||||
| depCacheFileExists = depCacheFile.exists(); | depCacheFileExists = depCacheFile.exists(); | ||||
| depCacheFileLastModified = depCacheFile.lastModified(); | depCacheFileLastModified = depCacheFile.lastModified(); | ||||
| } | } | ||||
| for (Enumeration e = getClassFiles(destPath).elements(); e.hasMoreElements(); ) { | |||||
| ClassFileInfo info = (ClassFileInfo)e.nextElement(); | |||||
| for (Enumeration e = getClassFiles(destPath).elements(); e.hasMoreElements();) { | |||||
| ClassFileInfo info = (ClassFileInfo) e.nextElement(); | |||||
| log("Adding class info for " + info.className, Project.MSG_DEBUG); | log("Adding class info for " + info.className, Project.MSG_DEBUG); | ||||
| classFileInfoMap.put(info.className, info); | classFileInfoMap.put(info.className, info); | ||||
| Vector dependencyList = null; | Vector dependencyList = null; | ||||
| if (cache != null) { | if (cache != null) { | ||||
| // try to read the dependency info from the map if it is not out of date | // try to read the dependency info from the map if it is not out of date | ||||
| if (depCacheFileExists && depCacheFileLastModified > info.absoluteFile.lastModified()) { | if (depCacheFileExists && depCacheFileLastModified > info.absoluteFile.lastModified()) { | ||||
| // depFile exists and is newer than the class file | // depFile exists and is newer than the class file | ||||
| // need to get dependency list from the map. | // need to get dependency list from the map. | ||||
| dependencyList = (Vector)dependencyMap.get(info.className); | |||||
| dependencyList = (Vector) dependencyMap.get(info.className); | |||||
| } | } | ||||
| } | } | ||||
| if (dependencyList == null) { | if (dependencyList == null) { | ||||
| // not cached - so need to read directly from the class file | // not cached - so need to read directly from the class file | ||||
| FileInputStream inFileStream = null; | FileInputStream inFileStream = null; | ||||
| @@ -304,55 +300,54 @@ public class Depend extends MatchingTask { | |||||
| inFileStream = new FileInputStream(info.absoluteFile); | inFileStream = new FileInputStream(info.absoluteFile); | ||||
| ClassFile classFile = new ClassFile(); | ClassFile classFile = new ClassFile(); | ||||
| classFile.read(inFileStream); | classFile.read(inFileStream); | ||||
| dependencyList = classFile.getClassRefs(); | dependencyList = classFile.getClassRefs(); | ||||
| if (dependencyList != null) { | if (dependencyList != null) { | ||||
| cacheDirty = true; | cacheDirty = true; | ||||
| dependencyMap.put(info.className, dependencyList); | dependencyMap.put(info.className, dependencyList); | ||||
| } | } | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| if (inFileStream != null) { | if (inFileStream != null) { | ||||
| inFileStream.close(); | inFileStream.close(); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| // This class depends on each class in the dependency list. For each | // 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); | |||||
| // 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) { | if (affectedClasses == null) { | ||||
| affectedClasses = new Hashtable(); | affectedClasses = new Hashtable(); | ||||
| affectedClassMap.put(dependentClass, affectedClasses); | affectedClassMap.put(dependentClass, affectedClasses); | ||||
| } | } | ||||
| affectedClasses.put(info.className, info); | affectedClasses.put(info.className, info); | ||||
| } | } | ||||
| } | } | ||||
| classpathDependencies = null; | classpathDependencies = null; | ||||
| if (dependClasspath != null) { | if (dependClasspath != null) { | ||||
| // now determine which jars each class depends upon | // now determine which jars each class depends upon | ||||
| classpathDependencies = new Hashtable(); | classpathDependencies = new Hashtable(); | ||||
| AntClassLoader loader = new AntClassLoader(getProject(), dependClasspath); | AntClassLoader loader = new AntClassLoader(getProject(), dependClasspath); | ||||
| Hashtable classpathFileCache = new Hashtable(); | Hashtable classpathFileCache = new Hashtable(); | ||||
| Object nullFileMarker = new Object(); | Object nullFileMarker = new Object(); | ||||
| for (Enumeration e = dependencyMap.keys(); e.hasMoreElements();) { | for (Enumeration e = dependencyMap.keys(); e.hasMoreElements();) { | ||||
| String className = (String)e.nextElement(); | |||||
| Vector dependencyList = (Vector)dependencyMap.get(className); | |||||
| String className = (String) e.nextElement(); | |||||
| Vector dependencyList = (Vector) dependencyMap.get(className); | |||||
| Hashtable dependencies = new Hashtable(); | Hashtable dependencies = new Hashtable(); | ||||
| classpathDependencies.put(className, dependencies); | classpathDependencies.put(className, dependencies); | ||||
| for (Enumeration e2 = dependencyList.elements(); e2.hasMoreElements();) { | for (Enumeration e2 = dependencyList.elements(); e2.hasMoreElements();) { | ||||
| String dependency =(String)e2.nextElement(); | |||||
| String dependency = (String) e2.nextElement(); | |||||
| Object classpathFileObject = classpathFileCache.get(dependency); | Object classpathFileObject = classpathFileCache.get(dependency); | ||||
| if (classpathFileObject == null) { | if (classpathFileObject == null) { | ||||
| classpathFileObject = nullFileMarker; | classpathFileObject = nullFileMarker; | ||||
| if (!dependency.startsWith("java.") && !dependency.startsWith("javax.")) { | if (!dependency.startsWith("java.") && !dependency.startsWith("javax.")) { | ||||
| URL classURL = loader.getResource(dependency.replace('.', '/') + ".class"); | URL classURL = loader.getResource(dependency.replace('.', '/') + ".class"); | ||||
| if (classURL != null) { | if (classURL != null) { | ||||
| @@ -363,78 +358,76 @@ public class Depend extends MatchingTask { | |||||
| jarFilePath = jarFilePath.substring(5, classMarker); | jarFilePath = jarFilePath.substring(5, classMarker); | ||||
| } | } | ||||
| classpathFileObject = new File(jarFilePath); | classpathFileObject = new File(jarFilePath); | ||||
| } | |||||
| else if (classURL.getProtocol().equals("file")) { | |||||
| } else if (classURL.getProtocol().equals("file")) { | |||||
| String classFilePath = classURL.getFile(); | String classFilePath = classURL.getFile(); | ||||
| classpathFileObject = new File(classFilePath); | classpathFileObject = new File(classFilePath); | ||||
| } | } | ||||
| log("Class " + className + | |||||
| " depends on " + classpathFileObject + | |||||
| " due to " + dependency, Project.MSG_DEBUG); | |||||
| log("Class " + className + | |||||
| " depends on " + classpathFileObject + | |||||
| " due to " + dependency, Project.MSG_DEBUG); | |||||
| } | } | ||||
| } | } | ||||
| classpathFileCache.put(dependency, classpathFileObject); | classpathFileCache.put(dependency, classpathFileObject); | ||||
| } | } | ||||
| if (classpathFileObject != null && classpathFileObject != nullFileMarker) { | if (classpathFileObject != null && classpathFileObject != nullFileMarker) { | ||||
| // we need to add this jar to the list for this class. | // we need to add this jar to the list for this class. | ||||
| File jarFile = (File)classpathFileObject; | |||||
| File jarFile = (File) classpathFileObject; | |||||
| dependencies.put(jarFile, jarFile); | dependencies.put(jarFile, jarFile); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| // write the dependency cache to the disk | // write the dependency cache to the disk | ||||
| if (cache != null && cacheDirty) { | if (cache != null && cacheDirty) { | ||||
| writeCachedDependencies(dependencyMap); | writeCachedDependencies(dependencyMap); | ||||
| } | } | ||||
| } | } | ||||
| private int deleteAllAffectedFiles() { | private int deleteAllAffectedFiles() { | ||||
| int count = 0; | int count = 0; | ||||
| for (Enumeration e = outOfDateClasses.elements(); e.hasMoreElements();) { | for (Enumeration e = outOfDateClasses.elements(); e.hasMoreElements();) { | ||||
| String className = (String)e.nextElement(); | |||||
| String className = (String) e.nextElement(); | |||||
| count += deleteAffectedFiles(className); | count += deleteAffectedFiles(className); | ||||
| ClassFileInfo classInfo = (ClassFileInfo)classFileInfoMap.get(className); | |||||
| ClassFileInfo classInfo = (ClassFileInfo) classFileInfoMap.get(className); | |||||
| if (classInfo != null && classInfo.absoluteFile.exists()) { | if (classInfo != null && classInfo.absoluteFile.exists()) { | ||||
| classInfo.absoluteFile.delete(); | classInfo.absoluteFile.delete(); | ||||
| count++; | count++; | ||||
| } | } | ||||
| } | } | ||||
| return count; | |||||
| return count; | |||||
| } | } | ||||
| private int deleteAffectedFiles(String className) { | private int deleteAffectedFiles(String className) { | ||||
| int count = 0; | int count = 0; | ||||
| Hashtable affectedClasses = (Hashtable)affectedClassMap.get(className); | |||||
| Hashtable affectedClasses = (Hashtable) affectedClassMap.get(className); | |||||
| if (affectedClasses != null) { | if (affectedClasses != null) { | ||||
| for (Enumeration e = affectedClasses.keys(); e.hasMoreElements(); ) { | |||||
| String affectedClassName = (String)e.nextElement(); | |||||
| ClassFileInfo affectedClassInfo = (ClassFileInfo)affectedClasses.get(affectedClassName); | |||||
| for (Enumeration e = affectedClasses.keys(); e.hasMoreElements();) { | |||||
| String affectedClassName = (String) e.nextElement(); | |||||
| ClassFileInfo affectedClassInfo = (ClassFileInfo) affectedClasses.get(affectedClassName); | |||||
| if (affectedClassInfo.absoluteFile.exists()) { | if (affectedClassInfo.absoluteFile.exists()) { | ||||
| log("Deleting file " + affectedClassInfo.absoluteFile.getPath() + " since " + | |||||
| className + " out of date", Project.MSG_VERBOSE); | |||||
| log("Deleting file " + affectedClassInfo.absoluteFile.getPath() + " since " + | |||||
| className + " out of date", Project.MSG_VERBOSE); | |||||
| affectedClassInfo.absoluteFile.delete(); | affectedClassInfo.absoluteFile.delete(); | ||||
| count++; | count++; | ||||
| if (closure) { | if (closure) { | ||||
| count += deleteAffectedFiles(affectedClassName); | count += deleteAffectedFiles(affectedClassName); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // without closure we may delete an inner class but not the | // without closure we may delete an inner class but not the | ||||
| // top level class which would not trigger a recompile. | // top level class which would not trigger a recompile. | ||||
| if (affectedClassName.indexOf("$") != -1) { | if (affectedClassName.indexOf("$") != -1) { | ||||
| // need to delete the main class | // need to delete the main class | ||||
| String topLevelClassName | |||||
| = affectedClassName.substring(0, affectedClassName.indexOf("$")); | |||||
| String topLevelClassName | |||||
| = affectedClassName.substring(0, affectedClassName.indexOf("$")); | |||||
| log("Top level class = " + topLevelClassName, Project.MSG_VERBOSE); | log("Top level class = " + topLevelClassName, Project.MSG_VERBOSE); | ||||
| ClassFileInfo topLevelClassInfo | |||||
| = (ClassFileInfo)classFileInfoMap.get(topLevelClassName); | |||||
| ClassFileInfo topLevelClassInfo | |||||
| = (ClassFileInfo) classFileInfoMap.get(topLevelClassName); | |||||
| if (topLevelClassInfo != null && | if (topLevelClassInfo != null && | ||||
| topLevelClassInfo.absoluteFile.exists()) { | |||||
| log("Deleting file " + topLevelClassInfo.absoluteFile.getPath() + " since " + | |||||
| "one of its inner classes was removed", Project.MSG_VERBOSE); | |||||
| topLevelClassInfo.absoluteFile.exists()) { | |||||
| log("Deleting file " + topLevelClassInfo.absoluteFile.getPath() + " since " + | |||||
| "one of its inner classes was removed", Project.MSG_VERBOSE); | |||||
| topLevelClassInfo.absoluteFile.delete(); | topLevelClassInfo.absoluteFile.delete(); | ||||
| count++; | count++; | ||||
| if (closure) { | if (closure) { | ||||
| @@ -457,59 +450,59 @@ public class Depend extends MatchingTask { | |||||
| public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
| try { | try { | ||||
| long start = System.currentTimeMillis(); | long start = System.currentTimeMillis(); | ||||
| String [] srcPathList = srcPath.list(); | |||||
| String[] srcPathList = srcPath.list(); | |||||
| if (srcPathList.length == 0) { | if (srcPathList.length == 0) { | ||||
| throw new BuildException("srcdir attribute must be set!", location); | throw new BuildException("srcdir attribute must be set!", location); | ||||
| } | } | ||||
| if (destPath == null) { | if (destPath == null) { | ||||
| destPath = srcPath; | destPath = srcPath; | ||||
| } | } | ||||
| if (cache != null && cache.exists() && !cache.isDirectory()) { | if (cache != null && cache.exists() && !cache.isDirectory()) { | ||||
| throw new BuildException("The cache, if specified, must point to a directory"); | throw new BuildException("The cache, if specified, must point to a directory"); | ||||
| } | } | ||||
| if (cache != null && !cache.exists()) { | if (cache != null && !cache.exists()) { | ||||
| cache.mkdirs(); | cache.mkdirs(); | ||||
| } | } | ||||
| determineDependencies(); | determineDependencies(); | ||||
| if (dump) { | |||||
| log("Reverse Dependency Dump for " + affectedClassMap.size() + | |||||
| " classes:", Project.MSG_DEBUG); | |||||
| for (Enumeration e = affectedClassMap.keys(); e.hasMoreElements(); ) { | |||||
| String className = (String)e.nextElement(); | |||||
| if (dump) { | |||||
| log("Reverse Dependency Dump for " + affectedClassMap.size() + | |||||
| " classes:", Project.MSG_DEBUG); | |||||
| for (Enumeration e = affectedClassMap.keys(); e.hasMoreElements();) { | |||||
| String className = (String) e.nextElement(); | |||||
| log(" Class " + className + " affects:", Project.MSG_DEBUG); | log(" Class " + className + " affects:", Project.MSG_DEBUG); | ||||
| Hashtable affectedClasses = (Hashtable)affectedClassMap.get(className); | |||||
| for (Enumeration e2 = affectedClasses.keys(); e2.hasMoreElements(); ) { | |||||
| String affectedClass = (String)e2.nextElement(); | |||||
| ClassFileInfo info = (ClassFileInfo)affectedClasses.get(affectedClass); | |||||
| Hashtable affectedClasses = (Hashtable) affectedClassMap.get(className); | |||||
| for (Enumeration e2 = affectedClasses.keys(); e2.hasMoreElements();) { | |||||
| String affectedClass = (String) e2.nextElement(); | |||||
| ClassFileInfo info = (ClassFileInfo) affectedClasses.get(affectedClass); | |||||
| log(" " + affectedClass + " in " + info.absoluteFile.getPath(), Project.MSG_DEBUG); | log(" " + affectedClass + " in " + info.absoluteFile.getPath(), Project.MSG_DEBUG); | ||||
| } | } | ||||
| } | } | ||||
| if (classpathDependencies != null) { | if (classpathDependencies != null) { | ||||
| log("Classpath file dependencies (Forward):", Project.MSG_DEBUG); | log("Classpath file dependencies (Forward):", Project.MSG_DEBUG); | ||||
| for (Enumeration e = classpathDependencies.keys(); e.hasMoreElements();) { | |||||
| String className = (String)e.nextElement(); | |||||
| for (Enumeration e = classpathDependencies.keys(); e.hasMoreElements();) { | |||||
| String className = (String) e.nextElement(); | |||||
| log(" Class " + className + " depends on:", Project.MSG_DEBUG); | log(" Class " + className + " depends on:", Project.MSG_DEBUG); | ||||
| Hashtable dependencies = (Hashtable)classpathDependencies.get(className); | |||||
| Hashtable dependencies = (Hashtable) classpathDependencies.get(className); | |||||
| for (Enumeration e2 = dependencies.elements(); e2.hasMoreElements();) { | for (Enumeration e2 = dependencies.elements(); e2.hasMoreElements();) { | ||||
| File classpathFile = (File)e2.nextElement(); | |||||
| File classpathFile = (File) e2.nextElement(); | |||||
| log(" " + classpathFile.getPath(), Project.MSG_DEBUG); | log(" " + classpathFile.getPath(), Project.MSG_DEBUG); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| // we now need to scan for out of date files. When we have the list | // 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. | // we go through and delete all class files which are affected by these files. | ||||
| outOfDateClasses = new Hashtable(); | outOfDateClasses = new Hashtable(); | ||||
| for (int i=0; i < srcPathList.length; i++) { | |||||
| File srcDir = (File)project.resolveFile(srcPathList[i]); | |||||
| for (int i = 0; i < srcPathList.length; i++) { | |||||
| File srcDir = (File) project.resolveFile(srcPathList[i]); | |||||
| if (srcDir.exists()) { | if (srcDir.exists()) { | ||||
| DirectoryScanner ds = this.getDirectoryScanner(srcDir); | DirectoryScanner ds = this.getDirectoryScanner(srcDir); | ||||
| String[] files = ds.getIncludedFiles(); | String[] files = ds.getIncludedFiles(); | ||||
| @@ -519,20 +512,20 @@ public class Depend extends MatchingTask { | |||||
| // now check classpath file dependencies | // now check classpath file dependencies | ||||
| if (classpathDependencies != null) { | if (classpathDependencies != null) { | ||||
| for (Enumeration e = classpathDependencies.keys(); e.hasMoreElements();) { | |||||
| String className = (String)e.nextElement(); | |||||
| for (Enumeration e = classpathDependencies.keys(); e.hasMoreElements();) { | |||||
| String className = (String) e.nextElement(); | |||||
| if (!outOfDateClasses.containsKey(className)) { | if (!outOfDateClasses.containsKey(className)) { | ||||
| ClassFileInfo info = (ClassFileInfo)classFileInfoMap.get(className); | |||||
| // if we have no info about the class - it may have been deleted already and we | |||||
| ClassFileInfo info = (ClassFileInfo) classFileInfoMap.get(className); | |||||
| // if we have no info about the class - it may have been deleted already and we | |||||
| // are using cached info. | // are using cached info. | ||||
| if (info != null) { | if (info != null) { | ||||
| Hashtable dependencies = (Hashtable)classpathDependencies.get(className); | |||||
| Hashtable dependencies = (Hashtable) classpathDependencies.get(className); | |||||
| for (Enumeration e2 = dependencies.elements(); e2.hasMoreElements();) { | for (Enumeration e2 = dependencies.elements(); e2.hasMoreElements();) { | ||||
| File classpathFile = (File)e2.nextElement(); | |||||
| File classpathFile = (File) e2.nextElement(); | |||||
| if (classpathFile.lastModified() > info.absoluteFile.lastModified()) { | if (classpathFile.lastModified() > info.absoluteFile.lastModified()) { | ||||
| log("Class " + className + | |||||
| " is out of date with respect to " + classpathFile, Project.MSG_DEBUG); | |||||
| log("Class " + className + | |||||
| " is out of date with respect to " + classpathFile, Project.MSG_DEBUG); | |||||
| outOfDateClasses.put(className, className); | outOfDateClasses.put(className, className); | ||||
| break; | break; | ||||
| } | } | ||||
| @@ -541,11 +534,11 @@ public class Depend extends MatchingTask { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| // we now have a complete list of classes which are out of date | // we now have a complete list of classes which are out of date | ||||
| // We scan through the affected classes, deleting any affected classes. | // We scan through the affected classes, deleting any affected classes. | ||||
| int count = deleteAllAffectedFiles(); | int count = deleteAllAffectedFiles(); | ||||
| long duration = (System.currentTimeMillis() - start) / 1000; | long duration = (System.currentTimeMillis() - start) / 1000; | ||||
| log("Deleted " + count + " out of date files in " + duration + " seconds"); | log("Deleted " + count + " out of date files in " + duration + " seconds"); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -566,14 +559,13 @@ public class Depend extends MatchingTask { | |||||
| if (files[i].endsWith(".java")) { | if (files[i].endsWith(".java")) { | ||||
| String filePath = srcFile.getPath(); | String filePath = srcFile.getPath(); | ||||
| String className = filePath.substring(srcDir.getPath().length() + 1, | String className = filePath.substring(srcDir.getPath().length() + 1, | ||||
| filePath.length() - ".java".length()); | |||||
| className = ClassFileUtils.convertSlashName(className); | |||||
| ClassFileInfo info = (ClassFileInfo)classFileInfoMap.get(className); | |||||
| filePath.length() - ".java".length()); | |||||
| className = ClassFileUtils.convertSlashName(className); | |||||
| ClassFileInfo info = (ClassFileInfo) classFileInfoMap.get(className); | |||||
| if (info == null) { | if (info == null) { | ||||
| // there was no class file. add this class to the list | // there was no class file. add this class to the list | ||||
| outOfDateClasses.put(className, className); | outOfDateClasses.put(className, className); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| if (srcFile.lastModified() > info.absoluteFile.lastModified()) { | if (srcFile.lastModified() > info.absoluteFile.lastModified()) { | ||||
| outOfDateClasses.put(className, className); | outOfDateClasses.put(className, className); | ||||
| } | } | ||||
| @@ -583,7 +575,7 @@ public class Depend extends MatchingTask { | |||||
| } | } | ||||
| /** | |||||
| /** | |||||
| * Get the list of class files we are going to analyse. | * Get the list of class files we are going to analyse. | ||||
| * | * | ||||
| * @param classLocations a path structure containing all the directories | * @param classLocations a path structure containing all the directories | ||||
| @@ -591,23 +583,23 @@ public class Depend extends MatchingTask { | |||||
| * @return a vector containing the classes to analyse. | * @return a vector containing the classes to analyse. | ||||
| */ | */ | ||||
| private Vector getClassFiles(Path classLocations) { | private Vector getClassFiles(Path classLocations) { | ||||
| // break the classLocations into its components. | |||||
| String[] classLocationsList = classLocations.list(); | |||||
| // break the classLocations into its components. | |||||
| String[] classLocationsList = classLocations.list(); | |||||
| Vector classFileList = new Vector(); | Vector classFileList = new Vector(); | ||||
| for (int i = 0; i < classLocationsList.length; ++i) { | for (int i = 0; i < classLocationsList.length; ++i) { | ||||
| File dir = new File(classLocationsList[i]); | File dir = new File(classLocationsList[i]); | ||||
| if (dir.isDirectory()) { | if (dir.isDirectory()) { | ||||
| addClassFiles(classFileList, dir, dir); | addClassFiles(classFileList, dir, dir); | ||||
| } | } | ||||
| } | } | ||||
| return classFileList; | return classFileList; | ||||
| } | } | ||||
| /** | |||||
| * Add the list of class files from the given directory to the | |||||
| /** | |||||
| * Add the list of class files from the given directory to the | |||||
| * class file vector, including any subdirectories. | * class file vector, including any subdirectories. | ||||
| * | * | ||||
| * @param classLocations a path structure containing all the directories | * @param classLocations a path structure containing all the directories | ||||
| @@ -616,7 +608,7 @@ public class Depend extends MatchingTask { | |||||
| */ | */ | ||||
| private void addClassFiles(Vector classFileList, File dir, File root) { | private void addClassFiles(Vector classFileList, File dir, File root) { | ||||
| String[] filesInDir = dir.list(); | String[] filesInDir = dir.list(); | ||||
| if (filesInDir != null) { | if (filesInDir != null) { | ||||
| int length = filesInDir.length; | int length = filesInDir.length; | ||||
| @@ -624,20 +616,19 @@ public class Depend extends MatchingTask { | |||||
| File file = new File(dir, filesInDir[i]); | File file = new File(dir, filesInDir[i]); | ||||
| if (file.isDirectory()) { | if (file.isDirectory()) { | ||||
| addClassFiles(classFileList, file, root); | addClassFiles(classFileList, file, root); | ||||
| } | |||||
| else if (file.getName().endsWith(".class")) { | |||||
| } else if (file.getName().endsWith(".class")) { | |||||
| ClassFileInfo info = new ClassFileInfo(); | ClassFileInfo info = new ClassFileInfo(); | ||||
| info.absoluteFile = file; | info.absoluteFile = file; | ||||
| info.relativeName = file.getPath().substring(root.getPath().length() + 1, | info.relativeName = file.getPath().substring(root.getPath().length() + 1, | ||||
| file.getPath().length() - 6); | |||||
| info.className = ClassFileUtils.convertSlashName(info.relativeName); | |||||
| file.getPath().length() - 6); | |||||
| info.className = ClassFileUtils.convertSlashName(info.relativeName); | |||||
| classFileList.addElement(info); | classFileList.addElement(info); | ||||
| } | } | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| * Set the source dirs to find the source Java files. | * Set the source dirs to find the source Java files. | ||||
| */ | */ | ||||
| @@ -651,11 +642,11 @@ public class Depend extends MatchingTask { | |||||
| public void setDestDir(Path destPath) { | public void setDestDir(Path destPath) { | ||||
| this.destPath = destPath; | this.destPath = destPath; | ||||
| } | } | ||||
| public void setCache(File cache) { | public void setCache(File cache) { | ||||
| this.cache = cache; | this.cache = cache; | ||||
| } | } | ||||
| public void setClosure(boolean closure) { | public void setClosure(boolean closure) { | ||||
| this.closure = closure; | this.closure = closure; | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,19 +53,19 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend; | package org.apache.tools.ant.taskdefs.optional.depend; | ||||
| import java.util.Stack; | |||||
| import java.util.Enumeration; | |||||
| import java.util.Vector; | |||||
| import java.io.IOException; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.FileInputStream; | import java.io.FileInputStream; | ||||
| import java.io.IOException; | |||||
| import java.util.Enumeration; | |||||
| import java.util.Stack; | |||||
| import java.util.Vector; | |||||
| /** | /** | ||||
| * An iterator which iterates through the contents of a java directory. | * An iterator which iterates through the contents of a java directory. | ||||
| * | |||||
| * | |||||
| * The iterator should be created with the directory at the root of the | * The iterator should be created with the directory at the root of the | ||||
| * Java namespace. | * Java namespace. | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class DirectoryIterator implements ClassFileIterator { | public class DirectoryIterator implements ClassFileIterator { | ||||
| @@ -92,15 +92,15 @@ public class DirectoryIterator implements ClassFileIterator { | |||||
| /** | /** | ||||
| * Creates a directory iterator. | * Creates a directory iterator. | ||||
| * | |||||
| * | |||||
| * The directory iterator is created to scan the root directory. If the | * 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 | * changeInto flag is given, then the entries returned will be relative to this | ||||
| * directory and not the current directory. | * directory and not the current directory. | ||||
| * | |||||
| * | |||||
| * @param rootDirectory the root if the directory namespace which is to be iterated over | * @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 | * @param changeInto if true then the returned entries will be relative to the rootDirectory | ||||
| * and not the current directory. | * and not the current directory. | ||||
| * | |||||
| * | |||||
| * @throws IOException if there is a problem reading the directory information. | * @throws IOException if there is a problem reading the directory information. | ||||
| */ | */ | ||||
| public DirectoryIterator(File rootDirectory, boolean changeInto) throws IOException { | public DirectoryIterator(File rootDirectory, boolean changeInto) throws IOException { | ||||
| @@ -112,7 +112,7 @@ public class DirectoryIterator implements ClassFileIterator { | |||||
| rootLength = rootDirectory.getPath().length() + 1; | rootLength = rootDirectory.getPath().length() + 1; | ||||
| } else { | } else { | ||||
| rootLength = 0; | rootLength = 0; | ||||
| } | |||||
| } | |||||
| Vector filesInRoot = getDirectoryEntries(rootDirectory); | Vector filesInRoot = getDirectoryEntries(rootDirectory); | ||||
| @@ -121,9 +121,9 @@ public class DirectoryIterator implements ClassFileIterator { | |||||
| /** | /** | ||||
| * Get a vector covering all the entries (files and subdirectories in a directory). | * Get a vector covering all the entries (files and subdirectories in a directory). | ||||
| * | |||||
| * | |||||
| * @param directory the directory to be scanned. | * @param directory the directory to be scanned. | ||||
| * | |||||
| * | |||||
| * @return a vector containing File objects for each entry in the directory. | * @return a vector containing File objects for each entry in the directory. | ||||
| */ | */ | ||||
| private Vector getDirectoryEntries(File directory) { | private Vector getDirectoryEntries(File directory) { | ||||
| @@ -137,15 +137,15 @@ public class DirectoryIterator implements ClassFileIterator { | |||||
| for (int i = 0; i < length; ++i) { | for (int i = 0; i < length; ++i) { | ||||
| files.addElement(new File(directory, filesInDir[i])); | files.addElement(new File(directory, filesInDir[i])); | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return files; | return files; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Template method to allow subclasses to supply elements for the iteration. | * Template method to allow subclasses to supply elements for the iteration. | ||||
| * | |||||
| * | |||||
| * The directory iterator maintains a stack of iterators covering each level | * The directory iterator maintains a stack of iterators covering each level | ||||
| * in the directory hierarchy. The current iterator covers the current directory | * 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 | * being scanned. If the next entry in that directory is a subdirectory, the current | ||||
| @@ -153,7 +153,7 @@ public class DirectoryIterator implements ClassFileIterator { | |||||
| * subdirectory. If the entry is a file, it is returned as the next element and 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, | * 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. | * the topmost iterator on the statck is popped off to become the current iterator. | ||||
| * | |||||
| * | |||||
| * @return the next ClassFile in the iteration. | * @return the next ClassFile in the iteration. | ||||
| */ | */ | ||||
| public ClassFile getNextClassFile() { | public ClassFile getNextClassFile() { | ||||
| @@ -186,23 +186,23 @@ public class DirectoryIterator implements ClassFileIterator { | |||||
| javaClass.read(inFileStream); | javaClass.read(inFileStream); | ||||
| nextElement = javaClass; | nextElement = javaClass; | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } else { | } else { | ||||
| // this iterator is exhausted. Can we pop one off the stack | // this iterator is exhausted. Can we pop one off the stack | ||||
| if (enumStack.empty()) { | if (enumStack.empty()) { | ||||
| break; | break; | ||||
| } else { | } else { | ||||
| currentEnum = (Enumeration) enumStack.pop(); | currentEnum = (Enumeration) enumStack.pop(); | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| nextElement = null; | nextElement = null; | ||||
| } | |||||
| } | |||||
| return nextElement; | return nextElement; | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,15 +53,15 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend; | package org.apache.tools.ant.taskdefs.optional.depend; | ||||
| import java.util.zip.ZipInputStream; | |||||
| import java.util.zip.ZipEntry; | |||||
| import java.io.ByteArrayOutputStream; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.io.ByteArrayOutputStream; | |||||
| import java.util.zip.ZipEntry; | |||||
| import java.util.zip.ZipInputStream; | |||||
| /** | /** | ||||
| * A class file iterator which iterates through the contents of a Java jar file. | * A class file iterator which iterates through the contents of a Java jar file. | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class JarFileIterator implements ClassFileIterator { | public class JarFileIterator implements ClassFileIterator { | ||||
| @@ -74,19 +74,19 @@ public class JarFileIterator implements ClassFileIterator { | |||||
| } | } | ||||
| private byte[] getEntryBytes(InputStream stream) throws IOException { | private byte[] getEntryBytes(InputStream stream) throws IOException { | ||||
| byte[] buffer = new byte[8192]; | |||||
| byte[] buffer = new byte[8192]; | |||||
| ByteArrayOutputStream baos = new ByteArrayOutputStream(2048); | ByteArrayOutputStream baos = new ByteArrayOutputStream(2048); | ||||
| int n; | |||||
| int n; | |||||
| while ((n = stream.read(buffer, 0, buffer.length)) != -1) { | while ((n = stream.read(buffer, 0, buffer.length)) != -1) { | ||||
| baos.write(buffer, 0, n); | baos.write(buffer, 0, n); | ||||
| } | |||||
| } | |||||
| return baos.toByteArray(); | return baos.toByteArray(); | ||||
| } | |||||
| } | |||||
| public ClassFile getNextClassFile() { | public ClassFile getNextClassFile() { | ||||
| ZipEntry jarEntry; | |||||
| ZipEntry jarEntry; | |||||
| ClassFile nextElement = null; | ClassFile nextElement = null; | ||||
| try { | try { | ||||
| @@ -98,30 +98,30 @@ public class JarFileIterator implements ClassFileIterator { | |||||
| if (!jarEntry.isDirectory() && entryName.endsWith(".class")) { | if (!jarEntry.isDirectory() && entryName.endsWith(".class")) { | ||||
| // create a data input stream from the jar input stream | |||||
| ClassFile javaClass = new ClassFile(); | |||||
| // create a data input stream from the jar input stream | |||||
| ClassFile javaClass = new ClassFile(); | |||||
| javaClass.read(jarStream); | |||||
| javaClass.read(jarStream); | |||||
| nextElement = javaClass; | |||||
| nextElement = javaClass; | |||||
| } else { | } else { | ||||
| jarEntry = jarStream.getNextEntry(); | jarEntry = jarStream.getNextEntry(); | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| String message = e.getMessage(); | String message = e.getMessage(); | ||||
| String text = e.getClass().getName(); | String text = e.getClass().getName(); | ||||
| if (message != null) { | if (message != null) { | ||||
| text += ": " + message; | text += ": " + message; | ||||
| } | |||||
| } | |||||
| throw new RuntimeException("Problem reading JAR file: " + text); | throw new RuntimeException("Problem reading JAR file: " + text); | ||||
| } | |||||
| } | |||||
| return nextElement; | return nextElement; | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,13 +53,13 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * The constant pool entry which stores class information. | * The constant pool entry which stores class information. | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class ClassCPInfo extends ConstantPoolEntry { | public class ClassCPInfo extends ConstantPoolEntry { | ||||
| @@ -75,11 +75,11 @@ public class ClassCPInfo extends ConstantPoolEntry { | |||||
| * name is changed, this entry is invalid until this entry is connected to a constant | * name is changed, this entry is invalid until this entry is connected to a constant | ||||
| * pool. | * pool. | ||||
| */ | */ | ||||
| private int index; | |||||
| private int index; | |||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * | |||||
| * | |||||
| * Sets the tag value for this entry to type Class | * Sets the tag value for this entry to type Class | ||||
| */ | */ | ||||
| public ClassCPInfo() { | public ClassCPInfo() { | ||||
| @@ -88,42 +88,42 @@ public class ClassCPInfo extends ConstantPoolEntry { | |||||
| /** | /** | ||||
| * Read the entry from a stream. | * Read the entry from a stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the stream containing the constant pool entry to be read. | * @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. | * @exception IOException thrown if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| index = cpStream.readUnsignedShort(); | index = cpStream.readUnsignedShort(); | ||||
| className = "unresolved"; | className = "unresolved"; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Generate a string readable version of this entry | * Generate a string readable version of this entry | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| return "Class Constant Pool Entry for " + className + "[" + index + "]"; | return "Class Constant Pool Entry for " + className + "[" + index + "]"; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Resolve this class info against the given constant pool. | * Resolve this class info against the given constant pool. | ||||
| * | |||||
| * | |||||
| * @param constantPool the constant pool with which to resolve the class. | * @param constantPool the constant pool with which to resolve the class. | ||||
| */ | */ | ||||
| public void resolve(ConstantPool constantPool) { | public void resolve(ConstantPool constantPool) { | ||||
| className = ((Utf8CPInfo) constantPool.getEntry(index)).getValue(); | className = ((Utf8CPInfo) constantPool.getEntry(index)).getValue(); | ||||
| super.resolve(constantPool); | super.resolve(constantPool); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the class name of this entry. | * Get the class name of this entry. | ||||
| * | |||||
| * | |||||
| * @return the class' name. | * @return the class' name. | ||||
| */ | */ | ||||
| public String getClassName() { | public String getClassName() { | ||||
| return className; | return className; | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -54,18 +54,17 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| /** | /** | ||||
| * A Constant Pool entry which represents a constant value. | * A Constant Pool entry which represents a constant value. | ||||
| * | |||||
| * | |||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| abstract public class ConstantCPInfo extends ConstantPoolEntry { | abstract public class ConstantCPInfo extends ConstantPoolEntry { | ||||
| /** | /** | ||||
| * The entry's untyped value. | * The entry's untyped value. | ||||
| * | |||||
| * | |||||
| * Each subclass interprets the constant value based on the subclass's type. | * Each subclass interprets the constant value based on the subclass's type. | ||||
| * The value here must be compatible. | * The value here must be compatible. | ||||
| */ | */ | ||||
| @@ -73,7 +72,7 @@ abstract public class ConstantCPInfo extends ConstantPoolEntry { | |||||
| /** | /** | ||||
| * Initialise the constant entry. | * Initialise the constant entry. | ||||
| * | |||||
| * | |||||
| * @param tagValue the constant pool entry type to be used. | * @param tagValue the constant pool entry type to be used. | ||||
| * @param entries the number of constant pool entry slots occupied by this entry. | * @param entries the number of constant pool entry slots occupied by this entry. | ||||
| */ | */ | ||||
| @@ -83,21 +82,21 @@ abstract public class ConstantCPInfo extends ConstantPoolEntry { | |||||
| /** | /** | ||||
| * Get the value of the constant. | * Get the value of the constant. | ||||
| * | |||||
| * | |||||
| * @return the value of the constant (untyped). | * @return the value of the constant (untyped). | ||||
| */ | */ | ||||
| public Object getValue() { | public Object getValue() { | ||||
| return value; | return value; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Set the constant value. | * Set the constant value. | ||||
| * | |||||
| * | |||||
| * @param newValue the new untyped value of this constant. | * @param newValue the new untyped value of this constant. | ||||
| */ | */ | ||||
| public void setValue(Object newValue) { | public void setValue(Object newValue) { | ||||
| value = newValue; | value = newValue; | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,20 +53,20 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.util.Vector; | |||||
| import java.util.Hashtable; | |||||
| import java.io.IOException; | |||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.Hashtable; | |||||
| import java.util.Vector; | |||||
| /** | /** | ||||
| * The constant pool of a Java class. | * The constant pool of a Java class. | ||||
| * | |||||
| * | |||||
| * The constant pool is a collection of constants used in a Java class file. It stores | * 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. | * 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> | * @see <a href="http://java.sun.com/docs/books/vmspec/">The Java Virtual Machine Specification</a> | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class ConstantPool { | public class ConstantPool { | ||||
| @@ -96,23 +96,23 @@ public class ConstantPool { | |||||
| /** | /** | ||||
| * Read the constant pool from a class input stream. | * Read the constant pool from a class input stream. | ||||
| * | |||||
| * | |||||
| * @param classStream the DataInputStream of a class file. | * @param classStream the DataInputStream of a class file. | ||||
| * | |||||
| * | |||||
| * @throws IOException if there is a problem reading the constant pool | * @throws IOException if there is a problem reading the constant pool | ||||
| * from the stream | * from the stream | ||||
| */ | */ | ||||
| public void read(DataInputStream classStream) throws IOException { | public void read(DataInputStream classStream) throws IOException { | ||||
| int numEntries = classStream.readUnsignedShort(); | int numEntries = classStream.readUnsignedShort(); | ||||
| for (int i = 1; i < numEntries; ) { | |||||
| for (int i = 1; i < numEntries;) { | |||||
| ConstantPoolEntry nextEntry = ConstantPoolEntry.readEntry(classStream); | ConstantPoolEntry nextEntry = ConstantPoolEntry.readEntry(classStream); | ||||
| i += nextEntry.getNumEntries(); | i += nextEntry.getNumEntries(); | ||||
| addEntry(nextEntry); | addEntry(nextEntry); | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the size of the constant pool. | * Get the size of the constant pool. | ||||
| @@ -120,12 +120,12 @@ public class ConstantPool { | |||||
| public int size() { | public int size() { | ||||
| return entries.size(); | return entries.size(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Add an entry to the constant pool. | * Add an entry to the constant pool. | ||||
| * | |||||
| * | |||||
| * @param entry the new entry to be added 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. | * @return the index into the constant pool at which the entry is stored. | ||||
| */ | */ | ||||
| public int addEntry(ConstantPoolEntry entry) { | public int addEntry(ConstantPoolEntry entry) { | ||||
| @@ -138,69 +138,69 @@ public class ConstantPool { | |||||
| // add null entries for any additional slots required. | // add null entries for any additional slots required. | ||||
| for (int j = 0; j < numSlots - 1; ++j) { | for (int j = 0; j < numSlots - 1; ++j) { | ||||
| entries.addElement(null); | entries.addElement(null); | ||||
| } | |||||
| } | |||||
| if (entry instanceof Utf8CPInfo) { | if (entry instanceof Utf8CPInfo) { | ||||
| Utf8CPInfo utf8Info = (Utf8CPInfo) entry; | Utf8CPInfo utf8Info = (Utf8CPInfo) entry; | ||||
| utf8Indexes.put(utf8Info.getValue(), new Integer(index)); | utf8Indexes.put(utf8Info.getValue(), new Integer(index)); | ||||
| } | |||||
| } | |||||
| return index; | return index; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Resolve the entries in the constant pool. | * Resolve the entries in the constant pool. | ||||
| * | |||||
| * | |||||
| * Resolution of the constant pool involves transforming indexes to | * Resolution of the constant pool involves transforming indexes to | ||||
| * other constant pool entries into the actual data for that entry. | * other constant pool entries into the actual data for that entry. | ||||
| */ | */ | ||||
| public void resolve() { | public void resolve() { | ||||
| for (Enumeration i = entries.elements(); i.hasMoreElements(); ) { | |||||
| for (Enumeration i = entries.elements(); i.hasMoreElements();) { | |||||
| ConstantPoolEntry poolInfo = (ConstantPoolEntry) i.nextElement(); | ConstantPoolEntry poolInfo = (ConstantPoolEntry) i.nextElement(); | ||||
| if (poolInfo != null &&!poolInfo.isResolved()) { | |||||
| if (poolInfo != null && !poolInfo.isResolved()) { | |||||
| poolInfo.resolve(this); | poolInfo.resolve(this); | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get an constant pool entry at a particular index. | * Get an constant pool entry at a particular index. | ||||
| * | |||||
| * | |||||
| * @param index the index into the constant pool. | * @param index the index into the constant pool. | ||||
| * | |||||
| * | |||||
| * @return the constant pool entry at that index. | * @return the constant pool entry at that index. | ||||
| */ | */ | ||||
| public ConstantPoolEntry getEntry(int index) { | public ConstantPoolEntry getEntry(int index) { | ||||
| return (ConstantPoolEntry) entries.elementAt(index); | return (ConstantPoolEntry) entries.elementAt(index); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the index of a given UTF8 constant pool entry. | * Get the index of a given UTF8 constant pool entry. | ||||
| * | |||||
| * | |||||
| * @param value the string value of the UTF8 entry. | * @param value the string value of the UTF8 entry. | ||||
| * | |||||
| * | |||||
| * @return the index at which the given string occurs in the | * @return the index at which the given string occurs in the | ||||
| * constant pool or -1 if the value does not occur. | * constant pool or -1 if the value does not occur. | ||||
| */ | */ | ||||
| public int getUTF8Entry(String value) { | public int getUTF8Entry(String value) { | ||||
| int index = -1; | |||||
| int index = -1; | |||||
| Integer indexInteger = (Integer) utf8Indexes.get(value); | Integer indexInteger = (Integer) utf8Indexes.get(value); | ||||
| if (indexInteger != null) { | if (indexInteger != null) { | ||||
| index = indexInteger.intValue(); | index = indexInteger.intValue(); | ||||
| } | |||||
| } | |||||
| return index; | return index; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the index of a given CONSTANT_Class entry in the constant pool. | * 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. | * @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 | * @return the index at which the given class entry occurs in the | ||||
| * constant pool or -1 if the value does not occur. | * constant pool or -1 if the value does not occur. | ||||
| */ | */ | ||||
| @@ -215,18 +215,18 @@ public class ConstantPool { | |||||
| if (classinfo.getClassName().equals(className)) { | if (classinfo.getClassName().equals(className)) { | ||||
| index = i; | index = i; | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return index; | return index; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the index of a given constant value entry in the constant pool. | * Get the index of a given constant value entry in the constant pool. | ||||
| * | |||||
| * | |||||
| * @param constantValue the constant value for which the index is required. | * @param constantValue the constant value for which the index is required. | ||||
| * | |||||
| * | |||||
| * @return the index at which the given value entry occurs in the | * @return the index at which the given value entry occurs in the | ||||
| * constant pool or -1 if the value does not occur. | * constant pool or -1 if the value does not occur. | ||||
| */ | */ | ||||
| @@ -241,21 +241,21 @@ public class ConstantPool { | |||||
| if (constantEntry.getValue().equals(constantValue)) { | if (constantEntry.getValue().equals(constantValue)) { | ||||
| index = i; | index = i; | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return index; | return index; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the index of a given CONSTANT_MethodRef entry in the constant pool. | * Get the index of a given CONSTANT_MethodRef entry in the constant pool. | ||||
| * | |||||
| * | |||||
| * @param methodClassName the name of the class which contains the method | * @param methodClassName the name of the class which contains the method | ||||
| * being referenced. | * being referenced. | ||||
| * @param methodName the name of the method being referenced. | * @param methodName the name of the method being referenced. | ||||
| * @param methodType the type descriptor of the metho dbeing referenced. | * @param methodType the type descriptor of the metho dbeing referenced. | ||||
| * | |||||
| * | |||||
| * @return the index at which the given method ref entry occurs in the | * @return the index at which the given method ref entry occurs in the | ||||
| * constant pool or -1 if the value does not occur. | * constant pool or -1 if the value does not occur. | ||||
| */ | */ | ||||
| @@ -268,24 +268,24 @@ public class ConstantPool { | |||||
| if (element instanceof MethodRefCPInfo) { | if (element instanceof MethodRefCPInfo) { | ||||
| MethodRefCPInfo methodRefEntry = (MethodRefCPInfo) element; | MethodRefCPInfo methodRefEntry = (MethodRefCPInfo) element; | ||||
| if (methodRefEntry.getMethodClassName().equals(methodClassName) | |||||
| if (methodRefEntry.getMethodClassName().equals(methodClassName) | |||||
| && methodRefEntry.getMethodName().equals(methodName) && methodRefEntry.getMethodType().equals(methodType)) { | && methodRefEntry.getMethodName().equals(methodName) && methodRefEntry.getMethodType().equals(methodType)) { | ||||
| index = i; | index = i; | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return index; | return index; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the index of a given CONSTANT_InterfaceMethodRef entry in the constant pool. | * Get the index of a given CONSTANT_InterfaceMethodRef entry in the constant pool. | ||||
| * | |||||
| * | |||||
| * @param interfaceMethodClassName the name of the interface which contains the method | * @param interfaceMethodClassName the name of the interface which contains the method | ||||
| * being referenced. | * being referenced. | ||||
| * @param interfaceMethodName the name of the method being referenced. | * @param interfaceMethodName the name of the method being referenced. | ||||
| * @param interfaceMethodType the type descriptor of the metho dbeing referenced. | * @param interfaceMethodType the type descriptor of the metho dbeing referenced. | ||||
| * | |||||
| * | |||||
| * @return the index at which the given method ref entry occurs in the | * @return the index at which the given method ref entry occurs in the | ||||
| * constant pool or -1 if the value does not occur. | * constant pool or -1 if the value does not occur. | ||||
| */ | */ | ||||
| @@ -298,25 +298,25 @@ public class ConstantPool { | |||||
| if (element instanceof InterfaceMethodRefCPInfo) { | if (element instanceof InterfaceMethodRefCPInfo) { | ||||
| InterfaceMethodRefCPInfo interfaceMethodRefEntry = (InterfaceMethodRefCPInfo) element; | InterfaceMethodRefCPInfo interfaceMethodRefEntry = (InterfaceMethodRefCPInfo) element; | ||||
| if (interfaceMethodRefEntry.getInterfaceMethodClassName().equals(interfaceMethodClassName) | |||||
| && interfaceMethodRefEntry.getInterfaceMethodName().equals(interfaceMethodName) | |||||
| if (interfaceMethodRefEntry.getInterfaceMethodClassName().equals(interfaceMethodClassName) | |||||
| && interfaceMethodRefEntry.getInterfaceMethodName().equals(interfaceMethodName) | |||||
| && interfaceMethodRefEntry.getInterfaceMethodType().equals(interfaceMethodType)) { | && interfaceMethodRefEntry.getInterfaceMethodType().equals(interfaceMethodType)) { | ||||
| index = i; | index = i; | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return index; | return index; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the index of a given CONSTANT_FieldRef entry in the constant pool. | * Get the index of a given CONSTANT_FieldRef entry in the constant pool. | ||||
| * | |||||
| * | |||||
| * @param fieldClassName the name of the class which contains the field | * @param fieldClassName the name of the class which contains the field | ||||
| * being referenced. | * being referenced. | ||||
| * @param fieldName the name of the field being referenced. | * @param fieldName the name of the field being referenced. | ||||
| * @param fieldType the type descriptor 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 | * @return the index at which the given field ref entry occurs in the | ||||
| * constant pool or -1 if the value does not occur. | * constant pool or -1 if the value does not occur. | ||||
| */ | */ | ||||
| @@ -329,22 +329,22 @@ public class ConstantPool { | |||||
| if (element instanceof FieldRefCPInfo) { | if (element instanceof FieldRefCPInfo) { | ||||
| FieldRefCPInfo fieldRefEntry = (FieldRefCPInfo) element; | FieldRefCPInfo fieldRefEntry = (FieldRefCPInfo) element; | ||||
| if (fieldRefEntry.getFieldClassName().equals(fieldClassName) && fieldRefEntry.getFieldName().equals(fieldName) | |||||
| if (fieldRefEntry.getFieldClassName().equals(fieldClassName) && fieldRefEntry.getFieldName().equals(fieldName) | |||||
| && fieldRefEntry.getFieldType().equals(fieldType)) { | && fieldRefEntry.getFieldType().equals(fieldType)) { | ||||
| index = i; | index = i; | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return index; | return index; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the index of a given CONSTANT_NameAndType entry in the constant pool. | * Get the index of a given CONSTANT_NameAndType entry in the constant pool. | ||||
| * | |||||
| * | |||||
| * @param name the name | * @param name the name | ||||
| * @param type the type | * @param type the type | ||||
| * | |||||
| * | |||||
| * @return the index at which the given NameAndType entry occurs in the | * @return the index at which the given NameAndType entry occurs in the | ||||
| * constant pool or -1 if the value does not occur. | * constant pool or -1 if the value does not occur. | ||||
| */ | */ | ||||
| @@ -359,28 +359,28 @@ public class ConstantPool { | |||||
| if (nameAndTypeEntry.getName().equals(name) && nameAndTypeEntry.getType().equals(type)) { | if (nameAndTypeEntry.getName().equals(name) && nameAndTypeEntry.getType().equals(type)) { | ||||
| index = i; | index = i; | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return index; | return index; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Dump the constant pool to a string. | * Dump the constant pool to a string. | ||||
| * | |||||
| * | |||||
| * @return the constant pool entries as strings | * @return the constant pool entries as strings | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| StringBuffer sb = new StringBuffer("\n"); | StringBuffer sb = new StringBuffer("\n"); | ||||
| int size = entries.size(); | |||||
| int size = entries.size(); | |||||
| for (int i = 0; i < size; ++i) { | for (int i = 0; i < size; ++i) { | ||||
| sb.append("[" + i + "] = " + getEntry(i) + "\n"); | sb.append("[" + i + "] = " + getEntry(i) + "\n"); | ||||
| } | |||||
| } | |||||
| return sb.toString(); | return sb.toString(); | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,16 +53,16 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * An entry in the constant pool. | * An entry in the constant pool. | ||||
| * | |||||
| * | |||||
| * This class contains a represenation of the constant pool entries. It is | * 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. | * an abstract base class for all the different forms of constant pool entry. | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| * @see ConstantPool | * @see ConstantPool | ||||
| */ | */ | ||||
| @@ -126,21 +126,21 @@ public abstract class ConstantPoolEntry { | |||||
| /** | /** | ||||
| * This entry's tag which identifies the type of this constant pool entry. | * This entry's tag which identifies the type of this constant pool entry. | ||||
| */ | */ | ||||
| private int tag; | |||||
| private int tag; | |||||
| /** | /** | ||||
| * The number of slots in the constant pool, occupied by this entry. | * The number of slots in the constant pool, occupied by this entry. | ||||
| */ | */ | ||||
| private int numEntries; | |||||
| private int numEntries; | |||||
| /** | /** | ||||
| * A flag which indiciates if this entry has been resolved or not. | * A flag which indiciates if this entry has been resolved or not. | ||||
| */ | */ | ||||
| private boolean resolved; | |||||
| private boolean resolved; | |||||
| /** | /** | ||||
| * Initialse the constant pool entry. | * Initialse the constant pool entry. | ||||
| * | |||||
| * | |||||
| * @param tagValue the tag value which identifies which type of constant pool entry this is. | * @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. | * @param entries the number of constant pool entry slots this entry occupies. | ||||
| */ | */ | ||||
| @@ -152,139 +152,139 @@ public abstract class ConstantPoolEntry { | |||||
| /** | /** | ||||
| * Read a constant pool entry from a stream. | * Read a constant pool entry from a stream. | ||||
| * | |||||
| * | |||||
| * This is a factory method which reads a constant pool entry | * This is a factory method which reads a constant pool entry | ||||
| * form a stream and returns the appropriate subclass for the | * form a stream and returns the appropriate subclass for the | ||||
| * entry. | * entry. | ||||
| * | |||||
| * | |||||
| * @param cpStream the stream from which the constant pool entry is to be read. | * @param cpStream the stream from which the constant pool entry is to be read. | ||||
| * | |||||
| * | |||||
| * @returns the appropriate ConstantPoolEntry subclass representing the | * @returns the appropriate ConstantPoolEntry subclass representing the | ||||
| * constant pool entry from the stream. | * constant pool entry from the stream. | ||||
| * | |||||
| * | |||||
| * @throws IOExcception if there is a problem reading the entry from the stream. | * @throws IOExcception if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public static ConstantPoolEntry readEntry(DataInputStream cpStream) throws IOException { | public static ConstantPoolEntry readEntry(DataInputStream cpStream) throws IOException { | ||||
| ConstantPoolEntry cpInfo = null; | ConstantPoolEntry cpInfo = null; | ||||
| int cpTag = cpStream.readUnsignedByte(); | |||||
| int cpTag = cpStream.readUnsignedByte(); | |||||
| switch (cpTag) { | switch (cpTag) { | ||||
| case CONSTANT_Utf8: | |||||
| cpInfo = new Utf8CPInfo(); | |||||
| case CONSTANT_Utf8: | |||||
| cpInfo = new Utf8CPInfo(); | |||||
| break; | |||||
| break; | |||||
| case CONSTANT_Integer: | |||||
| cpInfo = new IntegerCPInfo(); | |||||
| case CONSTANT_Integer: | |||||
| cpInfo = new IntegerCPInfo(); | |||||
| break; | |||||
| break; | |||||
| case CONSTANT_Float: | |||||
| cpInfo = new FloatCPInfo(); | |||||
| case CONSTANT_Float: | |||||
| cpInfo = new FloatCPInfo(); | |||||
| break; | |||||
| break; | |||||
| case CONSTANT_Long: | |||||
| cpInfo = new LongCPInfo(); | |||||
| case CONSTANT_Long: | |||||
| cpInfo = new LongCPInfo(); | |||||
| break; | |||||
| break; | |||||
| case CONSTANT_Double: | |||||
| cpInfo = new DoubleCPInfo(); | |||||
| case CONSTANT_Double: | |||||
| cpInfo = new DoubleCPInfo(); | |||||
| break; | |||||
| break; | |||||
| case CONSTANT_Class: | |||||
| cpInfo = new ClassCPInfo(); | |||||
| case CONSTANT_Class: | |||||
| cpInfo = new ClassCPInfo(); | |||||
| break; | |||||
| break; | |||||
| case CONSTANT_String: | |||||
| cpInfo = new StringCPInfo(); | |||||
| case CONSTANT_String: | |||||
| cpInfo = new StringCPInfo(); | |||||
| break; | |||||
| break; | |||||
| case CONSTANT_FieldRef: | |||||
| cpInfo = new FieldRefCPInfo(); | |||||
| case CONSTANT_FieldRef: | |||||
| cpInfo = new FieldRefCPInfo(); | |||||
| break; | |||||
| break; | |||||
| case CONSTANT_MethodRef: | |||||
| cpInfo = new MethodRefCPInfo(); | |||||
| case CONSTANT_MethodRef: | |||||
| cpInfo = new MethodRefCPInfo(); | |||||
| break; | |||||
| break; | |||||
| case CONSTANT_InterfaceMethodRef: | |||||
| cpInfo = new InterfaceMethodRefCPInfo(); | |||||
| case CONSTANT_InterfaceMethodRef: | |||||
| cpInfo = new InterfaceMethodRefCPInfo(); | |||||
| break; | |||||
| break; | |||||
| case CONSTANT_NameAndType: | |||||
| cpInfo = new NameAndTypeCPInfo(); | |||||
| case CONSTANT_NameAndType: | |||||
| cpInfo = new NameAndTypeCPInfo(); | |||||
| break; | |||||
| break; | |||||
| default: | |||||
| throw new ClassFormatError("Invalid Constant Pool entry Type " + cpTag); | |||||
| default: | |||||
| throw new ClassFormatError("Invalid Constant Pool entry Type " + cpTag); | |||||
| } | } | ||||
| cpInfo.read(cpStream); | cpInfo.read(cpStream); | ||||
| return cpInfo; | return cpInfo; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Indicates whether this entry has been resolved. | * Indicates whether this entry has been resolved. | ||||
| * | |||||
| * | |||||
| * In general a constant pool entry can reference another constant | * In general a constant pool entry can reference another constant | ||||
| * pool entry by its index value. Resolution involves replacing this | * pool entry by its index value. Resolution involves replacing this | ||||
| * index value with the constant pool entry at that index. | * index value with the constant pool entry at that index. | ||||
| * | |||||
| * | |||||
| * @return true if this entry has been resolved. | * @return true if this entry has been resolved. | ||||
| */ | */ | ||||
| public boolean isResolved() { | public boolean isResolved() { | ||||
| return resolved; | return resolved; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Resolve this constant pool entry with respect to its dependents in | * Resolve this constant pool entry with respect to its dependents in | ||||
| * the constant pool. | * the constant pool. | ||||
| * | |||||
| * | |||||
| * @param constantPool the constant pool of which this entry is a member | * @param constantPool the constant pool of which this entry is a member | ||||
| * and against which this entry is to be resolved. | * and against which this entry is to be resolved. | ||||
| */ | */ | ||||
| public void resolve(ConstantPool constantPool) { | public void resolve(ConstantPool constantPool) { | ||||
| resolved = true; | resolved = true; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * read a constant pool entry from a class stream. | * read a constant pool entry from a class stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the DataInputStream which contains the constant pool entry to be read. | * @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. | * @throws IOException if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public abstract void read(DataInputStream cpStream) throws IOException; | public abstract void read(DataInputStream cpStream) throws IOException; | ||||
| /** | /** | ||||
| * Get the Entry's type tag. | * Get the Entry's type tag. | ||||
| * | |||||
| * | |||||
| * @return The Tag value of this entry | * @return The Tag value of this entry | ||||
| */ | */ | ||||
| public int getTag() { | public int getTag() { | ||||
| return tag; | return tag; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the number of Constant Pool Entry slots within the constant pool occupied by this entry. | * Get the number of Constant Pool Entry slots within the constant pool occupied by this entry. | ||||
| * | |||||
| * | |||||
| * @return the number of slots used. | * @return the number of slots used. | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public final int getNumEntries() { | public final int getNumEntries() { | ||||
| return numEntries; | return numEntries; | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,13 +53,13 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * The constant pool entry subclass used to represent double constant values. | * The constant pool entry subclass used to represent double constant values. | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class DoubleCPInfo extends ConstantCPInfo { | public class DoubleCPInfo extends ConstantCPInfo { | ||||
| @@ -69,23 +69,23 @@ public class DoubleCPInfo extends ConstantCPInfo { | |||||
| /** | /** | ||||
| * read a constant pool entry from a class stream. | * read a constant pool entry from a class stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the DataInputStream which contains the constant pool entry to be read. | * @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. | * @throws IOException if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| setValue(new Double(cpStream.readDouble())); | setValue(new Double(cpStream.readDouble())); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Print a readable version of the constant pool entry. | * Print a readable version of the constant pool entry. | ||||
| * | |||||
| * | |||||
| * @return the string representation of this constant pool entry. | * @return the string representation of this constant pool entry. | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| return "Double Constant Pool Entry: " + getValue(); | return "Double Constant Pool Entry: " + getValue(); | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,25 +53,25 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * A FieldRef CP Info | * A FieldRef CP Info | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class FieldRefCPInfo extends ConstantPoolEntry { | public class FieldRefCPInfo extends ConstantPoolEntry { | ||||
| private String fieldClassName; | private String fieldClassName; | ||||
| private String fieldName; | private String fieldName; | ||||
| private String fieldType; | private String fieldType; | ||||
| private int classIndex; | |||||
| private int nameAndTypeIndex; | |||||
| private int classIndex; | |||||
| private int nameAndTypeIndex; | |||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public FieldRefCPInfo() { | public FieldRefCPInfo() { | ||||
| super(CONSTANT_FieldRef, 1); | super(CONSTANT_FieldRef, 1); | ||||
| @@ -79,20 +79,20 @@ public class FieldRefCPInfo extends ConstantPoolEntry { | |||||
| /** | /** | ||||
| * read a constant pool entry from a class stream. | * read a constant pool entry from a class stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the DataInputStream which contains the constant pool entry to be read. | * @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. | * @throws IOException if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| classIndex = cpStream.readUnsignedShort(); | classIndex = cpStream.readUnsignedShort(); | ||||
| nameAndTypeIndex = cpStream.readUnsignedShort(); | nameAndTypeIndex = cpStream.readUnsignedShort(); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Resolve this constant pool entry with respect to its dependents in | * Resolve this constant pool entry with respect to its dependents in | ||||
| * the constant pool. | * the constant pool. | ||||
| * | |||||
| * | |||||
| * @param constantPool the constant pool of which this entry is a member | * @param constantPool the constant pool of which this entry is a member | ||||
| * and against which this entry is to be resolved. | * and against which this entry is to be resolved. | ||||
| */ | */ | ||||
| @@ -111,11 +111,11 @@ public class FieldRefCPInfo extends ConstantPoolEntry { | |||||
| fieldType = nt.getType(); | fieldType = nt.getType(); | ||||
| super.resolve(constantPool); | super.resolve(constantPool); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Print a readable version of the constant pool entry. | * Print a readable version of the constant pool entry. | ||||
| * | |||||
| * | |||||
| * @return the string representation of this constant pool entry. | * @return the string representation of this constant pool entry. | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| @@ -125,22 +125,22 @@ public class FieldRefCPInfo extends ConstantPoolEntry { | |||||
| value = "Field : Class = " + fieldClassName + ", name = " + fieldName + ", type = " + fieldType; | value = "Field : Class = " + fieldClassName + ", name = " + fieldName + ", type = " + fieldType; | ||||
| } else { | } else { | ||||
| value = "Field : Class index = " + classIndex + ", name and type index = " + nameAndTypeIndex; | value = "Field : Class index = " + classIndex + ", name and type index = " + nameAndTypeIndex; | ||||
| } | |||||
| } | |||||
| return value; | return value; | ||||
| } | |||||
| } | |||||
| public String getFieldClassName() { | public String getFieldClassName() { | ||||
| return fieldClassName; | return fieldClassName; | ||||
| } | |||||
| } | |||||
| public String getFieldName() { | public String getFieldName() { | ||||
| return fieldName; | return fieldName; | ||||
| } | |||||
| } | |||||
| public String getFieldType() { | public String getFieldType() { | ||||
| return fieldType; | return fieldType; | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,19 +53,19 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * A Float CP Info | * A Float CP Info | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class FloatCPInfo extends ConstantCPInfo { | public class FloatCPInfo extends ConstantCPInfo { | ||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public FloatCPInfo() { | public FloatCPInfo() { | ||||
| super(CONSTANT_Float, 1); | super(CONSTANT_Float, 1); | ||||
| @@ -73,23 +73,23 @@ public class FloatCPInfo extends ConstantCPInfo { | |||||
| /** | /** | ||||
| * read a constant pool entry from a class stream. | * read a constant pool entry from a class stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the DataInputStream which contains the constant pool entry to be read. | * @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. | * @throws IOException if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| setValue(new Float(cpStream.readFloat())); | setValue(new Float(cpStream.readFloat())); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Print a readable version of the constant pool entry. | * Print a readable version of the constant pool entry. | ||||
| * | |||||
| * | |||||
| * @return the string representation of this constant pool entry. | * @return the string representation of this constant pool entry. | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| return "Float Constant Pool Entry: " + getValue(); | return "Float Constant Pool Entry: " + getValue(); | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,19 +53,19 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * An Integer CP Info | * An Integer CP Info | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class IntegerCPInfo extends ConstantCPInfo { | public class IntegerCPInfo extends ConstantCPInfo { | ||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public IntegerCPInfo() { | public IntegerCPInfo() { | ||||
| super(CONSTANT_Integer, 1); | super(CONSTANT_Integer, 1); | ||||
| @@ -73,23 +73,23 @@ public class IntegerCPInfo extends ConstantCPInfo { | |||||
| /** | /** | ||||
| * read a constant pool entry from a class stream. | * read a constant pool entry from a class stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the DataInputStream which contains the constant pool entry to be read. | * @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. | * @throws IOException if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| setValue(new Integer(cpStream.readInt())); | setValue(new Integer(cpStream.readInt())); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Print a readable version of the constant pool entry. | * Print a readable version of the constant pool entry. | ||||
| * | |||||
| * | |||||
| * @return the string representation of this constant pool entry. | * @return the string representation of this constant pool entry. | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| return "Integer Constant Pool Entry: " + getValue(); | return "Integer Constant Pool Entry: " + getValue(); | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,26 +53,26 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * A InterfaceMethodRef CP Info | * A InterfaceMethodRef CP Info | ||||
| * | |||||
| * | |||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class InterfaceMethodRefCPInfo extends ConstantPoolEntry { | public class InterfaceMethodRefCPInfo extends ConstantPoolEntry { | ||||
| private String interfaceMethodClassName; | private String interfaceMethodClassName; | ||||
| private String interfaceMethodName; | private String interfaceMethodName; | ||||
| private String interfaceMethodType; | private String interfaceMethodType; | ||||
| private int classIndex; | |||||
| private int nameAndTypeIndex; | |||||
| private int classIndex; | |||||
| private int nameAndTypeIndex; | |||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public InterfaceMethodRefCPInfo() { | public InterfaceMethodRefCPInfo() { | ||||
| super(CONSTANT_InterfaceMethodRef, 1); | super(CONSTANT_InterfaceMethodRef, 1); | ||||
| @@ -80,20 +80,20 @@ public class InterfaceMethodRefCPInfo extends ConstantPoolEntry { | |||||
| /** | /** | ||||
| * read a constant pool entry from a class stream. | * read a constant pool entry from a class stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the DataInputStream which contains the constant pool entry to be read. | * @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. | * @throws IOException if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| classIndex = cpStream.readUnsignedShort(); | classIndex = cpStream.readUnsignedShort(); | ||||
| nameAndTypeIndex = cpStream.readUnsignedShort(); | nameAndTypeIndex = cpStream.readUnsignedShort(); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Resolve this constant pool entry with respect to its dependents in | * Resolve this constant pool entry with respect to its dependents in | ||||
| * the constant pool. | * the constant pool. | ||||
| * | |||||
| * | |||||
| * @param constantPool the constant pool of which this entry is a member | * @param constantPool the constant pool of which this entry is a member | ||||
| * and against which this entry is to be resolved. | * and against which this entry is to be resolved. | ||||
| */ | */ | ||||
| @@ -112,37 +112,37 @@ public class InterfaceMethodRefCPInfo extends ConstantPoolEntry { | |||||
| interfaceMethodType = nt.getType(); | interfaceMethodType = nt.getType(); | ||||
| super.resolve(constantPool); | super.resolve(constantPool); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Print a readable version of the constant pool entry. | * Print a readable version of the constant pool entry. | ||||
| * | |||||
| * | |||||
| * @return the string representation of this constant pool entry. | * @return the string representation of this constant pool entry. | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| String value; | String value; | ||||
| if (isResolved()) { | if (isResolved()) { | ||||
| value = "InterfaceMethod : Class = " + interfaceMethodClassName + ", name = " + interfaceMethodName + ", type = " | |||||
| value = "InterfaceMethod : Class = " + interfaceMethodClassName + ", name = " + interfaceMethodName + ", type = " | |||||
| + interfaceMethodType; | + interfaceMethodType; | ||||
| } else { | } else { | ||||
| value = "InterfaceMethod : Class index = " + classIndex + ", name and type index = " + nameAndTypeIndex; | value = "InterfaceMethod : Class index = " + classIndex + ", name and type index = " + nameAndTypeIndex; | ||||
| } | |||||
| } | |||||
| return value; | return value; | ||||
| } | |||||
| } | |||||
| public String getInterfaceMethodClassName() { | public String getInterfaceMethodClassName() { | ||||
| return interfaceMethodClassName; | return interfaceMethodClassName; | ||||
| } | |||||
| } | |||||
| public String getInterfaceMethodName() { | public String getInterfaceMethodName() { | ||||
| return interfaceMethodName; | return interfaceMethodName; | ||||
| } | |||||
| } | |||||
| public String getInterfaceMethodType() { | public String getInterfaceMethodType() { | ||||
| return interfaceMethodType; | return interfaceMethodType; | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,19 +53,19 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * A Long CP Info | * A Long CP Info | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class LongCPInfo extends ConstantCPInfo { | public class LongCPInfo extends ConstantCPInfo { | ||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public LongCPInfo() { | public LongCPInfo() { | ||||
| super(CONSTANT_Long, 2); | super(CONSTANT_Long, 2); | ||||
| @@ -73,23 +73,23 @@ public class LongCPInfo extends ConstantCPInfo { | |||||
| /** | /** | ||||
| * read a constant pool entry from a class stream. | * read a constant pool entry from a class stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the DataInputStream which contains the constant pool entry to be read. | * @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. | * @throws IOException if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| setValue(new Long(cpStream.readLong())); | setValue(new Long(cpStream.readLong())); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Print a readable version of the constant pool entry. | * Print a readable version of the constant pool entry. | ||||
| * | |||||
| * | |||||
| * @return the string representation of this constant pool entry. | * @return the string representation of this constant pool entry. | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| return "Long Constant Pool Entry: " + getValue(); | return "Long Constant Pool Entry: " + getValue(); | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,25 +53,25 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * A MethodRef CP Info | * A MethodRef CP Info | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class MethodRefCPInfo extends ConstantPoolEntry { | public class MethodRefCPInfo extends ConstantPoolEntry { | ||||
| private String methodClassName; | private String methodClassName; | ||||
| private String methodName; | private String methodName; | ||||
| private String methodType; | private String methodType; | ||||
| private int classIndex; | |||||
| private int nameAndTypeIndex; | |||||
| private int classIndex; | |||||
| private int nameAndTypeIndex; | |||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public MethodRefCPInfo() { | public MethodRefCPInfo() { | ||||
| super(CONSTANT_MethodRef, 1); | super(CONSTANT_MethodRef, 1); | ||||
| @@ -79,19 +79,19 @@ public class MethodRefCPInfo extends ConstantPoolEntry { | |||||
| /** | /** | ||||
| * read a constant pool entry from a class stream. | * read a constant pool entry from a class stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the DataInputStream which contains the constant pool entry to be read. | * @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. | * @throws IOException if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| classIndex = cpStream.readUnsignedShort(); | classIndex = cpStream.readUnsignedShort(); | ||||
| nameAndTypeIndex = cpStream.readUnsignedShort(); | nameAndTypeIndex = cpStream.readUnsignedShort(); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Print a readable version of the constant pool entry. | * Print a readable version of the constant pool entry. | ||||
| * | |||||
| * | |||||
| * @return the string representation of this constant pool entry. | * @return the string representation of this constant pool entry. | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| @@ -101,15 +101,15 @@ public class MethodRefCPInfo extends ConstantPoolEntry { | |||||
| value = "Method : Class = " + methodClassName + ", name = " + methodName + ", type = " + methodType; | value = "Method : Class = " + methodClassName + ", name = " + methodName + ", type = " + methodType; | ||||
| } else { | } else { | ||||
| value = "Method : Class index = " + classIndex + ", name and type index = " + nameAndTypeIndex; | value = "Method : Class index = " + classIndex + ", name and type index = " + nameAndTypeIndex; | ||||
| } | |||||
| } | |||||
| return value; | return value; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Resolve this constant pool entry with respect to its dependents in | * Resolve this constant pool entry with respect to its dependents in | ||||
| * the constant pool. | * the constant pool. | ||||
| * | |||||
| * | |||||
| * @param constantPool the constant pool of which this entry is a member | * @param constantPool the constant pool of which this entry is a member | ||||
| * and against which this entry is to be resolved. | * and against which this entry is to be resolved. | ||||
| */ | */ | ||||
| @@ -128,19 +128,19 @@ public class MethodRefCPInfo extends ConstantPoolEntry { | |||||
| methodType = nt.getType(); | methodType = nt.getType(); | ||||
| super.resolve(constantPool); | super.resolve(constantPool); | ||||
| } | |||||
| } | |||||
| public String getMethodClassName() { | public String getMethodClassName() { | ||||
| return methodClassName; | return methodClassName; | ||||
| } | |||||
| } | |||||
| public String getMethodName() { | public String getMethodName() { | ||||
| return methodName; | return methodName; | ||||
| } | |||||
| } | |||||
| public String getMethodType() { | public String getMethodType() { | ||||
| return methodType; | return methodType; | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,20 +53,20 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * A NameAndType CP Info | * A NameAndType CP Info | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class NameAndTypeCPInfo extends ConstantPoolEntry { | public class NameAndTypeCPInfo extends ConstantPoolEntry { | ||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public NameAndTypeCPInfo() { | public NameAndTypeCPInfo() { | ||||
| super(CONSTANT_NameAndType, 1); | super(CONSTANT_NameAndType, 1); | ||||
| @@ -74,19 +74,19 @@ public class NameAndTypeCPInfo extends ConstantPoolEntry { | |||||
| /** | /** | ||||
| * read a constant pool entry from a class stream. | * read a constant pool entry from a class stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the DataInputStream which contains the constant pool entry to be read. | * @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. | * @throws IOException if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| nameIndex = cpStream.readUnsignedShort(); | nameIndex = cpStream.readUnsignedShort(); | ||||
| descriptorIndex = cpStream.readUnsignedShort(); | descriptorIndex = cpStream.readUnsignedShort(); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Print a readable version of the constant pool entry. | * Print a readable version of the constant pool entry. | ||||
| * | |||||
| * | |||||
| * @return the string representation of this constant pool entry. | * @return the string representation of this constant pool entry. | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| @@ -96,15 +96,15 @@ public class NameAndTypeCPInfo extends ConstantPoolEntry { | |||||
| value = "Name = " + name + ", type = " + type; | value = "Name = " + name + ", type = " + type; | ||||
| } else { | } else { | ||||
| value = "Name index = " + nameIndex + ", descriptor index = " + descriptorIndex; | value = "Name index = " + nameIndex + ", descriptor index = " + descriptorIndex; | ||||
| } | |||||
| } | |||||
| return value; | return value; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Resolve this constant pool entry with respect to its dependents in | * Resolve this constant pool entry with respect to its dependents in | ||||
| * the constant pool. | * the constant pool. | ||||
| * | |||||
| * | |||||
| * @param constantPool the constant pool of which this entry is a member | * @param constantPool the constant pool of which this entry is a member | ||||
| * and against which this entry is to be resolved. | * and against which this entry is to be resolved. | ||||
| */ | */ | ||||
| @@ -113,19 +113,19 @@ public class NameAndTypeCPInfo extends ConstantPoolEntry { | |||||
| type = ((Utf8CPInfo) constantPool.getEntry(descriptorIndex)).getValue(); | type = ((Utf8CPInfo) constantPool.getEntry(descriptorIndex)).getValue(); | ||||
| super.resolve(constantPool); | super.resolve(constantPool); | ||||
| } | |||||
| } | |||||
| public String getName() { | public String getName() { | ||||
| return name; | return name; | ||||
| } | |||||
| } | |||||
| public String getType() { | public String getType() { | ||||
| return type; | return type; | ||||
| } | |||||
| } | |||||
| private String name; | private String name; | ||||
| private String type; | private String type; | ||||
| private int nameIndex; | |||||
| private int descriptorIndex; | |||||
| private int nameIndex; | |||||
| private int descriptorIndex; | |||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,23 +53,23 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * A String Constant Pool Entry. | * A String Constant Pool Entry. | ||||
| * | |||||
| * | |||||
| * The String info contains an index into the constant pool where | * The String info contains an index into the constant pool where | ||||
| * a UTF8 string is stored. | * a UTF8 string is stored. | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class StringCPInfo extends ConstantCPInfo { | public class StringCPInfo extends ConstantCPInfo { | ||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public StringCPInfo() { | public StringCPInfo() { | ||||
| super(CONSTANT_String, 1); | super(CONSTANT_String, 1); | ||||
| @@ -77,37 +77,37 @@ public class StringCPInfo extends ConstantCPInfo { | |||||
| /** | /** | ||||
| * read a constant pool entry from a class stream. | * read a constant pool entry from a class stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the DataInputStream which contains the constant pool entry to be read. | * @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. | * @throws IOException if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| index = cpStream.readUnsignedShort(); | index = cpStream.readUnsignedShort(); | ||||
| setValue("unresolved"); | setValue("unresolved"); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Print a readable version of the constant pool entry. | * Print a readable version of the constant pool entry. | ||||
| * | |||||
| * | |||||
| * @return the string representation of this constant pool entry. | * @return the string representation of this constant pool entry. | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| return "String Constant Pool Entry for " + getValue() + "[" + index + "]"; | return "String Constant Pool Entry for " + getValue() + "[" + index + "]"; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Resolve this constant pool entry with respect to its dependents in | * Resolve this constant pool entry with respect to its dependents in | ||||
| * the constant pool. | * the constant pool. | ||||
| * | |||||
| * | |||||
| * @param constantPool the constant pool of which this entry is a member | * @param constantPool the constant pool of which this entry is a member | ||||
| * and against which this entry is to be resolved. | * and against which this entry is to be resolved. | ||||
| */ | */ | ||||
| public void resolve(ConstantPool constantPool) { | public void resolve(ConstantPool constantPool) { | ||||
| setValue(((Utf8CPInfo) constantPool.getEntry(index)).getValue()); | setValue(((Utf8CPInfo) constantPool.getEntry(index)).getValue()); | ||||
| super.resolve(constantPool); | super.resolve(constantPool); | ||||
| } | |||||
| } | |||||
| private int index; | private int index; | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -9,7 +9,7 @@ | |||||
| * are met: | * are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
| * notice, this list of conditions and the following disclaimer in | * notice, this list of conditions and the following disclaimer in | ||||
| @@ -17,15 +17,15 @@ | |||||
| * distribution. | * distribution. | ||||
| * | * | ||||
| * 3. The end-user documentation included with the redistribution, if | * 3. The end-user documentation included with the redistribution, if | ||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | * Apache Software Foundation (http://www.apache.org/)." | ||||
| * Alternately, this acknowlegement may appear in the software itself, | * Alternately, this acknowlegement may appear in the software itself, | ||||
| * if and wherever such third-party acknowlegements normally appear. | * if and wherever such third-party acknowlegements normally appear. | ||||
| * | * | ||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | * 4. The names "The Jakarta Project", "Ant", and "Apache Software | ||||
| * Foundation" must not be used to endorse or promote products derived | * Foundation" must not be used to endorse or promote products derived | ||||
| * from this software without prior written permission. For written | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | * permission, please contact apache@apache.org. | ||||
| * | * | ||||
| * 5. Products derived from this software may not be called "Apache" | * 5. Products derived from this software may not be called "Apache" | ||||
| @@ -53,13 +53,13 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | ||||
| import java.io.IOException; | |||||
| import java.io.DataInputStream; | import java.io.DataInputStream; | ||||
| import java.io.IOException; | |||||
| /** | /** | ||||
| * A UTF8 Constant Pool Entry. | * A UTF8 Constant Pool Entry. | ||||
| * | |||||
| * | |||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public class Utf8CPInfo extends ConstantPoolEntry { | public class Utf8CPInfo extends ConstantPoolEntry { | ||||
| @@ -67,7 +67,7 @@ public class Utf8CPInfo extends ConstantPoolEntry { | |||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public Utf8CPInfo() { | public Utf8CPInfo() { | ||||
| super(CONSTANT_Utf8, 1); | super(CONSTANT_Utf8, 1); | ||||
| @@ -75,27 +75,27 @@ public class Utf8CPInfo extends ConstantPoolEntry { | |||||
| /** | /** | ||||
| * read a constant pool entry from a class stream. | * read a constant pool entry from a class stream. | ||||
| * | |||||
| * | |||||
| * @param cpStream the DataInputStream which contains the constant pool entry to be read. | * @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. | * @throws IOException if there is a problem reading the entry from the stream. | ||||
| */ | */ | ||||
| public void read(DataInputStream cpStream) throws IOException { | public void read(DataInputStream cpStream) throws IOException { | ||||
| value = cpStream.readUTF(); | value = cpStream.readUTF(); | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Print a readable version of the constant pool entry. | * Print a readable version of the constant pool entry. | ||||
| * | |||||
| * | |||||
| * @return the string representation of this constant pool entry. | * @return the string representation of this constant pool entry. | ||||
| */ | */ | ||||
| public String toString() { | public String toString() { | ||||
| return "UTF8 Value = " + value; | return "UTF8 Value = " + value; | ||||
| } | |||||
| } | |||||
| public String getValue() { | public String getValue() { | ||||
| return value; | return value; | ||||
| } | |||||
| } | |||||
| } | } | ||||