ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbaill...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode ClassPathLoader.java
Date Sat, 26 Jan 2002 20:35:33 GMT
sbailliez    02/01/26 12:35:33

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode
                        ClassPathLoader.java
  Log:
  Fix audit violations and style.
  
  Revision  Changes    Path
  1.6       +14 -11    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java
  
  Index: ClassPathLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ClassPathLoader.java	8 Jan 2002 23:57:47 -0000	1.5
  +++ ClassPathLoader.java	26 Jan 2002 20:35:33 -0000	1.6
  @@ -79,7 +79,7 @@
       public final static FileLoader NULL_LOADER = new NullLoader();
   
       /** the list of files to look for */
  -    protected File[] files;
  +    private File[] files;
   
       /**
        * create a new instance with a given classpath. It must be urls
  @@ -166,8 +166,8 @@
       }
   
       /** the loader enumeration that will return loaders */
  -    protected class LoaderEnumeration implements Enumeration {
  -        protected int index = 0;
  +    private class LoaderEnumeration implements Enumeration {
  +        private int index = 0;
   
           public boolean hasMoreElements() {
               return index < files.length;
  @@ -213,7 +213,7 @@
   }
   
   /** a null loader to return when the file is not valid */
  -class NullLoader implements ClassPathLoader.FileLoader {
  +final class NullLoader implements ClassPathLoader.FileLoader {
       private File file;
   
       NullLoader() {
  @@ -238,7 +238,7 @@
    * @todo read the jar manifest in case there is a Class-Path
    * entry.
    */
  -class JarLoader implements ClassPathLoader.FileLoader {
  +final class JarLoader implements ClassPathLoader.FileLoader {
       private File file;
   
       JarLoader(File file) {
  @@ -273,8 +273,10 @@
    * @todo should discard classes which package name does not
    * match the directory ?
    */
  -class DirectoryLoader implements ClassPathLoader.FileLoader {
  +final class DirectoryLoader implements ClassPathLoader.FileLoader {
       private File directory;
  +    private final static FilenameFilter DIRECTORY_FILTER = new DirectoryFilter();
  +    private final static FilenameFilter CLASS_FILTER = new ClassFilter();
   
       DirectoryLoader(File dir) {
           directory = dir;
  @@ -285,9 +287,10 @@
       }
   
       public ClassFile[] getClasses() throws IOException {
  -        Vector v = new Vector();
  +        Vector v = new Vector(127);
           Vector files = listFiles(directory, new ClassFilter(), true);
  -        for (int i = 0; i < files.size(); i++) {
  +        final int filesCount = files.size();
  +        for (int i = 0; i < filesCount; i++) {
               File file = (File) files.elementAt(i);
               InputStream is = null;
               try {
  @@ -323,7 +326,7 @@
           if (!directory.isDirectory()) {
               throw new IllegalArgumentException(directory + " is not a directory");
           }
  -        Vector list = new Vector();
  +        Vector list = new Vector(512);
           listFilesTo(list, directory, filter, recurse);
           return list;
       }
  @@ -355,7 +358,7 @@
   }
   
   /** Convenient filter that accepts only directory <tt>File</tt> */
  -class DirectoryFilter implements FilenameFilter {
  +final class DirectoryFilter implements FilenameFilter {
       public boolean accept(File directory, String name) {
           File pathname = new File(directory, name);
           return pathname.isDirectory();
  @@ -363,7 +366,7 @@
   }
   
   /** convenient filter to accept only .class files */
  -class ClassFilter implements FilenameFilter {
  +final class ClassFilter implements FilenameFilter {
       public boolean accept(File dir, String name) {
           return name.endsWith(".class");
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message