ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/attributes AttributeInfo.java
Date Wed, 25 May 2005 14:23:31 GMT
peterreilly    2005/05/25 07:23:31

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/sitraka
                        CovBase.java CovMerge.java CovReport.java
                        Coverage.java Filters.java ReportFilters.java
                        Socket.java Triggers.java XMLReport.java
               src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode
                        ClassFile.java ClassPathLoader.java MethodInfo.java
                        Utils.java
               src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/attributes
                        AttributeInfo.java
  Log:
  checkstyle - mostly javadoc
  
  Revision  Changes    Path
  1.11      +26 -0     ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovBase.java
  
  Index: CovBase.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovBase.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- CovBase.java	6 Jan 2005 12:05:08 -0000	1.10
  +++ CovBase.java	25 May 2005 14:23:31 -0000	1.11
  @@ -36,15 +36,24 @@
   
       /**
        * The directory where JProbe is installed.
  +     * @param value the JProbe directory
        */
       public void setHome(File value) {
           this.home = value;
       }
   
  +    /**
  +     * Get the JProbe directory.
  +     * @return the JProbe directory
  +     */
       protected File getHome() {
           return home;
       }
   
  +    /**
  +     * Get the location of the JProbe coverage jar file.
  +     * @return the location of the JProbe coverage jar file
  +     */
       protected File findCoverageJar() {
           File loc = null;
           if (isJProbe4) {
  @@ -63,6 +72,11 @@
           return loc;
       }
   
  +    /**
  +     * Find the JProbe executable.
  +     * @param relativePath the name of the executuable without the trailing .exe on dos
  +     * @return the absolute path to the executable
  +     */
       protected String findExecutable(String relativePath) {
           if (isDos) {
               relativePath += ".exe";
  @@ -84,16 +98,28 @@
           return loc.getAbsolutePath();
       }
   
  +    /**
  +     * Create a temporary file.
  +     * @param prefix a prefix to use in the filename
  +     * @return a File reference to the temporary file
  +     */
       protected File createTempFile(String prefix) {
           return FILE_UTILS.createTempFile(prefix, ".tmp", null);
       }
   
  +    /**
  +     * Get the param file arguement.
  +     * This checks the version of jprobe to return the correct name of
  +     * the parameter.
  +     * @return the name of the argument
  +     */
       protected String getParamFileArgument() {
           return "-" + (!isJProbe4 ? "jp_" : "") + "paramfile=";
       }
   
       /**
        * Are we running on a version of JProbe 4.x or higher?
  +     * @return true if we are running JProbe 4 or higher
        */
       protected boolean isJProbe4Plus() {
           return isJProbe4;
  
  
  
  1.28      +21 -5     ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
  
  Index: CovMerge.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- CovMerge.java	9 Mar 2004 16:48:35 -0000	1.27
  +++ CovMerge.java	25 May 2005 14:23:31 -0000	1.28
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2004 The Apache Software Foundation
  + * Copyright  2001-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -47,6 +47,7 @@
   
       /**
        * Set the output snapshot file.
  +     * @param value the snapshot file
        */
       public void setTofile(File value) {
           this.tofile = value;
  @@ -55,6 +56,7 @@
       /**
        * If true, perform the merge in verbose mode giving details
        * about the snapshot processing.
  +     * @param flag if true perform the merge in verbose mode
        */
       public void setVerbose(boolean flag) {
           this.verbose = flag;
  @@ -62,6 +64,7 @@
   
       /**
        * add a fileset containing the snapshots to include.
  +     * @param fs nested fileset element
        */
       public void addFileset(FileSet fs) {
           filesets.addElement(fs);
  @@ -69,10 +72,14 @@
   
       //---------------- the tedious job begins here
   
  +    /** Constructor for CovMerge. */
       public CovMerge() {
       }
   
  -    /** execute the jpcovmerge by providing a parameter file */
  +    /**
  +     * Execute the jpcovmerge by providing a parameter file.
  +     * @throws BuildException on error
  +     */
       public void execute() throws BuildException {
           checkOptions();
   
  @@ -112,7 +119,10 @@
           }
       }
   
  -    /** check for mandatory options */
  +    /**
  +     * Check for mandatory options.
  +     * @throws BuildException on error
  +     */
       protected void checkOptions() throws BuildException {
           if (tofile == null) {
               throw new BuildException("'tofile' attribute must be set.");
  @@ -128,7 +138,10 @@
           }
       }
   
  -    /** get the snapshots from the filesets */
  +    /**
  +     * Get the snapshots from the filesets.
  +     * @return an array of snapshot files
  +     */
       protected File[] getSnapshots() {
           Vector v = new Vector();
           final int size = filesets.size();
  @@ -152,8 +165,10 @@
   
   
       /**
  -     * create the parameters file that contains all file to merge
  +     * Create the parameters file that contains all file to merge
        * and the output filename.
  +     * @return the parameters file
  +     * @throws BuildException on error
        */
       protected File createParamFile() throws BuildException {
           File[] snapshots = getSnapshots();
  @@ -179,6 +194,7 @@
                   try {
                       fw.close();
                   } catch (IOException ignored) {
  +                    // Ignore Exception
                   }
               }
           }
  
  
  
  1.24      +45 -3     ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
  
  Index: CovReport.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- CovReport.java	9 Mar 2004 16:48:35 -0000	1.23
  +++ CovReport.java	25 May 2005 14:23:31 -0000	1.24
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2004 The Apache Software Foundation
  + * Copyright  2001-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -121,7 +121,9 @@
       private Reference reference = null;
   
   
  +    /** Enumerated type for format attribute. */
       public static class ReportFormat extends EnumeratedAttribute {
  +        /** @see EnumeratedAttribute@getValues() */
           public String[] getValues() {
               return new String[]{"html", "text", "xml"};
           }
  @@ -129,12 +131,15 @@
   
       /**
        * set the format of the report: "html", "text", or "xml"
  +     * @param value an enumerated <code>ReportFormat</code> value
        */
       public void setFormat(ReportFormat value) {
           this.format = value.getValue();
       }
   
  +    /** Enumerated type for type attribute. */
       public static class ReportType extends EnumeratedAttribute {
  +        /** @see EnumeratedAttribute@getValues() */
           public String[] getValues() {
               return new String[]{"executive", "summary", "detailed", "verydetailed"};
           }
  @@ -143,6 +148,7 @@
       /**
        * The type of report to be generated: "executive", "summary",
        * "detailed" or "verydetailed".
  +     * @param value an enumerated <code>ReportType</code> value
        */
       public void setType(ReportType value) {
           this.type = value.getValue();
  @@ -151,6 +157,7 @@
       /**
        * If true, include text of the source code lines.
        * Only applies to format="xml" and type="verydetailed"
  +     * @param value a <code>boolean</code> value
        */
       public void setIncludesource(boolean value) {
           this.includeSource = value;
  @@ -159,6 +166,7 @@
       /**
        * A numeric value for the threshold for printing methods.
        * Must be between 0 and 100.
  +     * @param value an <code>Integer</code> value
        */
       public void setPercent(Integer value) {
           this.percent = value;
  @@ -166,6 +174,7 @@
   
       /**
        * set the filters
  +     * @param values a <code>String</code> value
        * @ant.attribute ignore="true"
        */
       public void setFilters(String values) {
  @@ -174,6 +183,7 @@
   
       /**
        * Adds a path to source files.
  +     * @return a path to be configured
        */
       public Path createSourcepath() {
           if (sourcePath == null) {
  @@ -184,6 +194,7 @@
   
       /**
        * The name of the snapshot file that is the source to the report.
  +     * @param value the snapshot file
        */
       public void setSnapshot(File value) {
           this.snapshot = value;
  @@ -191,12 +202,14 @@
   
       /**
        * The name of the generated output file.
  +     * @param value the output file
        */
       public void setTofile(File value) {
           this.tofile = value;
       }
   
       /**
  +     * @return a path to be configured
        * @todo needs to be removed
        * @ant.element ignore="true"
        */
  @@ -210,6 +223,7 @@
       /**
        * Adds a set of classes whose coverage information will be
        * checked against.
  +     * @return a <code>CovReport.Reference</code> object to be configured
        */
       public Reference createReference() {
           if (reference == null) {
  @@ -219,10 +233,14 @@
       }
   
   
  +    /** Constructor for CovReport. */
       public CovReport() {
       }
   
  -    /** check for mandatory options */
  +    /**
  +     * Check for mandatory options.
  +     * @throws BuildException on error
  +     */
       protected void checkOptions() throws BuildException {
           if (tofile == null) {
               throw new BuildException("'tofile' attribute must be set.");
  @@ -244,6 +262,10 @@
   
       }
   
  +    /**
  +     * Execute the task.
  +     * @throws BuildException on error
  +     */
       public void execute() throws BuildException {
           checkOptions();
           try {
  @@ -278,6 +300,10 @@
       }
   
   
  +    /**
  +     * Get the parameters for the executable.
  +     * @return an array of parameters
  +     */
       protected String[] getParameters() {
           Vector v = new Vector();
           if (format != null) {
  @@ -311,10 +337,17 @@
       }
   
   
  +    /**
  +     * An inner class for the reference element.
  +     */
       public class Reference {
           protected Path classPath;
           protected ReportFilters filters;
   
  +        /**
  +         * Create a path for the reference.
  +         * @return a path to be configured
  +         */
           public Path createClasspath() {
               if (classPath == null) {
                   classPath = new Path(CovReport.this.getProject());
  @@ -322,6 +355,10 @@
               return classPath.createPath();
           }
   
  +        /**
  +         * An nested element to include/exclude classes/methods.
  +         * @return ReportFilters to be configured
  +         */
           public ReportFilters createFilters() {
               if (filters == null) {
                   filters = new ReportFilters();
  @@ -329,6 +366,10 @@
               return filters;
           }
   
  +        /**
  +         * Create the xml report.
  +         * @throws BuildException on error
  +         */
           protected void createEnhancedXMLReport() throws BuildException {
               // we need a classpath element
               if (classPath == null) {
  @@ -337,7 +378,8 @@
               // and a valid one...
               String[] paths = classPath.list();
               if (paths.length == 0) {
  -                throw new BuildException("Coverage path is invalid. It does not contain any existing path.");
  +                throw new BuildException(
  +                    "Coverage path is invalid. It does not contain any existing path.");
               }
               // and we need at least one filter include/exclude.
               if (filters == null || filters.size() == 0) {
  
  
  
  1.26      +62 -4     ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
  
  Index: Coverage.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Coverage.java	30 Mar 2005 08:35:43 -0000	1.25
  +++ Coverage.java	25 May 2005 14:23:31 -0000	1.26
  @@ -90,12 +90,17 @@
   
       //--------- setters used via reflection --
   
  -    /** seed name for snapshot file. Can be null, default to snap */
  +    /**
  +     * Set the seed name for snapshot file. Can be null, default to snap.
  +     * @param value a <code>String</code> value
  +     */
       public void setSeedname(String value) {
           seedName = value;
       }
   
       /**
  +     * Set the input file.
  +     * @param value a <code>File</code> value
        * @ant.attribute ignore="true"
        */
       public void setInputfile(File value) {
  @@ -104,12 +109,20 @@
   
       /**
        * Path to the java executable.
  +     * @param value the path to the java executable
        */
       public void setJavaexe(File value) {
           javaExe = value;
       }
   
  +    /**
  +     * Enumerated type corresponding to the javavms known by the task.
  +     */
       public static class Javavm extends EnumeratedAttribute {
  +        /**
  +         * Get the valid javavms names.
  +         * @return an array of strings = "java2", "jdk118", and "jdk117"
  +         */
           public String[] getValues() {
               return new String[]{"java2", "jdk118", "jdk117"};
           }
  @@ -117,13 +130,16 @@
   
       /**
        * Indicates which virtual machine to run: "jdk117", "jdk118" or "java2".
  -     * Can be null, default to "java2". */
  +     * Can be null, default to "java2".
  +     * @param value an enumerated value
  +     */
       public void setVm(Javavm value) {
           vm = value.getValue();
       }
   
       /**
        * If true, run an applet.
  +     * @param value a <code>boolean</code> value
        */
       public void setApplet(boolean value) {
           applet = value;
  @@ -131,6 +147,7 @@
   
       /**
        * Toggles display of the console prompt: always, error, never
  +     * @param value when to display the prompt - "always", "error" or "never"
        */
       public void setExitprompt(String value) {
           exitPrompt = value;
  @@ -139,6 +156,7 @@
       /**
        * Defines class/method filters based on pattern matching.
        * The syntax is filters is similar to a fileset.
  +     * @return the filters to be configured
        */
       public Filters createFilters() {
           return filters;
  @@ -151,6 +169,7 @@
        * For example you may run a whole application but only decide
        * to collect data once it reaches a certain method and once it
        * exits another one.
  +     * @return the triggers to be configured
        */
       public Triggers createTriggers() {
           if (triggers == null) {
  @@ -162,6 +181,7 @@
       /**
        * Define a host and port to connect to if you want to do
        * remote viewing.
  +     * @return the socket to be configured
        */
       public Socket createSocket() {
           if (socket == null) {
  @@ -170,7 +190,14 @@
           return socket;
       }
   
  +    /**
  +     * Enumerated type for finalsnapshot attribute.
  +     */
       public static class Finalsnapshot extends EnumeratedAttribute {
  +        /**
  +         * Get the valid strings for the attribute.
  +         * @return an array of strings - "coverage", "none" and "all"
  +         */
           public String[] getValues() {
               return new String[]{"coverage", "none", "all"};
           }
  @@ -179,19 +206,29 @@
       /**
        * Type of snapshot to send at program termination: none, coverage, all.
        * Can be null, default to none
  +     * @param value a <code>String</code> value
        */
       public void setFinalsnapshot(String value) {
           finalSnapshot = value;
       }
   
  +    /**
  +     * Enumerated type for recordfromstart attribute.
  +     */
       public static class Recordfromstart extends EnumeratedAttribute {
  +        /**
  +         * Get the valid strings for the attribute.
  +         * @return an array of strings - "coverage", "none" and "all"
  +         */
           public String[] getValues() {
               return new String[]{"coverage", "none", "all"};
           }
       }
   
       /**
  +     * Set the recordfromstart attribute, valid values are
        * "all", "coverage",  or "none".
  +     * @param value an enumerated type having the correct values.
        */
       public void setRecordfromstart(Recordfromstart value) {
           recordFromStart = value.getValue();
  @@ -199,6 +236,7 @@
   
       /**
        * Set warning level (0-3, where 0 is the least amount of warnings).
  +     * @param value an <code>Integer</code> value
        */
       public void setWarnlevel(Integer value) {
           warnLevel = value.intValue();
  @@ -209,6 +247,7 @@
        * Choose a directory that is reachable by both the remote
        * and local computers, and enter the same path on the command-line
        * and in the viewer.
  +     * @param value the snapshot directory
        */
       public void setSnapshotdir(File value) {
           snapshotDir = value;
  @@ -216,6 +255,7 @@
   
       /**
        * The physical path to the working directory for the VM.
  +     * @param value the working directory
        */
       public void setWorkingdir(File value) {
           workingDir = value;
  @@ -223,6 +263,7 @@
   
       /**
        * If true, track native methods.
  +     * @param value a <code>boolean</code> value
        */
       public void setTracknatives(boolean value) {
           trackNatives = value;
  @@ -232,6 +273,7 @@
   
       /**
        * Adds a JVM argument.
  +     * @return a command line argument to configure
        */
       public Commandline.Argument createJvmarg() {
           return cmdlJava.createVmArgument();
  @@ -239,6 +281,7 @@
   
       /**
        * Adds a command argument.
  +     * @return a command line argument to configure
        */
       public Commandline.Argument createArg() {
           return cmdlJava.createArgument();
  @@ -246,6 +289,7 @@
   
       /**
        * classpath to run the files.
  +     * @return a Path to configure
        */
       public Path createClasspath() {
           return cmdlJava.createClasspath(getProject()).createPath();
  @@ -253,6 +297,7 @@
   
       /**
        * classname to run as standalone or runner for filesets.
  +     * @param value a <code>String</code> value for the classname
        */
       public void setClassname(String value) {
           cmdlJava.setClassname(value);
  @@ -260,6 +305,7 @@
   
       /**
        * the classnames to execute.
  +     * @param fs a nested fileset element
        */
       public void addFileset(FileSet fs) {
           filesets.addElement(fs);
  @@ -268,10 +314,16 @@
   
       //---------------- the tedious job begins here
   
  +    /**
  +     * Constructor for Coverage.
  +     */
       public Coverage() {
       }
   
  -    /** execute the jplauncher by providing a parameter file */
  +    /**
  +     * Execute the jplauncher by providing a parameter file.
  +     * @throws BuildException on error
  +     */
       public void execute() throws BuildException {
           File paramfile = null;
           // if an input file is used, all other options are ignored...
  @@ -305,7 +357,10 @@
           }
       }
   
  -    /** wheck what is necessary to check, Coverage will do the job for us */
  +    /**
  +     * Check what is necessary to check, Coverage will do the job for us.
  +     * @throws BuildException on error
  +     */
       protected void checkOptions() throws BuildException {
           // check coverage home
           if (getHome() == null || !getHome().isDirectory()) {
  @@ -343,6 +398,7 @@
        * return the command line parameters. Parameters can either be passed
        * to the command line and stored to a file (then use the -jp_input=&lt;filename&gt;)
        * if they are too numerous.
  +     * @return the command line parameters
        */
       protected String[] getParameters() {
           Vector params = new Vector();
  @@ -435,6 +491,7 @@
                   try {
                       fw.close();
                   } catch (IOException ignored) {
  +                    // Ignore Exception
                   }
               }
           }
  @@ -457,6 +514,7 @@
               try {
                   os.close();
               } catch (IOException ignored) {
  +                // Ignore exception
               }
           }
       }
  
  
  
  1.15      +33 -1     ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java
  
  Index: Filters.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Filters.java	9 Mar 2004 16:48:35 -0000	1.14
  +++ Filters.java	25 May 2005 14:23:31 -0000	1.15
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2002,2004 The Apache Software Foundation
  + * Copyright  2001-2002,2004-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -34,12 +34,14 @@
       /** user defined filters */
       protected Vector filters = new Vector();
   
  +    /** Constructor for Filters. */
       public Filters() {
       }
   
       /**
        * Automatically exclude all classes and methods
        * unless included in nested elements; optional, default true.
  +     * @param value a <code>boolean</code> value
        */
       public void setDefaultExclude(boolean value) {
           defaultExclude = value;
  @@ -47,6 +49,7 @@
   
       /**
        * include classes and methods in the analysis
  +     * @param incl an nested Include object
        */
       public void addInclude(Include incl) {
           filters.addElement(incl);
  @@ -54,11 +57,16 @@
   
       /**
        * exclude classes and methods from the analysis
  +     * @param excl an nested Exclude object
        */
       public void addExclude(Exclude excl) {
           filters.addElement(excl);
       }
   
  +    /**
  +     * Get a comma separated list of filters.
  +     * @return a comma separated list of filters
  +     */
       public String toString() {
           StringBuffer buf = new StringBuffer();
           final int size = filters.size();
  @@ -87,6 +95,7 @@
   
           /**
            * this one is deprecated.
  +         * @param value a <code>String</code> value
            * @ant.task ignore="true"
            */
   
  @@ -97,6 +106,7 @@
           /**
            * The classname mask as a simple regular expression;
            * optional, defaults to "*"
  +         * @param value a <code>String</code> value
            */
           public void setClass(String value) {
               clazz = value;
  @@ -105,6 +115,7 @@
           /**
            * The method mask as a simple regular expression;
            * optional, defaults to "*"
  +         * @param value a <code>String</code> value
            */
           public void setMethod(String value) {
               method = value;
  @@ -112,24 +123,45 @@
   
           /**
            * enable or disable the filter; optional, default true
  +         * @param value a <code>boolean</code> value
            */
   
           public void setEnabled(boolean value) {
               enabled = value;
           }
   
  +        /**
  +         * The classname and the method.
  +         * @return the classname and the method - "class.method()"
  +         */
           public String toString() {
               return clazz + "." + method + "()";
           }
       }
   
  +    /**
  +     * A class for the nested include element.
  +     */
       public static class Include extends FilterElement {
  +        /**
  +         * The classname and method postfixed with ":I" and (#) if not
  +         * enabled.
  +         * @return a string version of this filter that can be used on the commandline
  +         */
           public String toString() {
               return super.toString() + ":I" + (enabled ? "" : "#");
           }
       }
   
  +    /**
  +     * A class for the nested exclude element.
  +     */
       public static class Exclude extends FilterElement {
  +        /**
  +         * The classname and method postfixed with ":E" and (#) if not
  +         * enabled.
  +         * @return a string version of this filter that can be used on the commandline
  +         */
           public String toString() {
               return super.toString() + ":E" + (enabled ? "" : "#");
           }
  
  
  
  1.14      +34 -1     ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java
  
  Index: ReportFilters.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ReportFilters.java	9 Mar 2004 16:48:35 -0000	1.13
  +++ ReportFilters.java	25 May 2005 14:23:31 -0000	1.14
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2002,2004 The Apache Software Foundation
  + * Copyright  2001-2002,2004-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -33,17 +33,30 @@
       /** cached matcher for each filter */
       protected Vector matchers = null;
   
  +    /** Constructor for ReportFilters. */
       public ReportFilters() {
       }
   
  +    /**
  +     * Add an include nested element.
  +     * @param incl an include filter element
  +     */
       public void addInclude(Include incl) {
           filters.addElement(incl);
       }
   
  +    /**
  +     * Add an exclude nested element.
  +     * @param excl an exclude filter element
  +     */
       public void addExclude(Exclude excl) {
           filters.addElement(excl);
       }
   
  +    /**
  +     * Get the number of nested filters.
  +     * @return the number
  +     */
       public int size() {
           return filters.size();
       }
  @@ -52,6 +65,7 @@
        * Check whether a given &lt;classname&gt;&lt;method&gt;() is accepted by the list
        * of filters or not.
        * @param methodname the full method name in the format &lt;classname&gt;&lt;method&gt;()
  +     * @return true if the methodname passes the list of filters
        */
       public boolean accept(String methodname) {
           // I'm deferring matcher instantiations at runtime to avoid computing
  @@ -98,14 +112,28 @@
           protected String clazz = "*"; // default is all classes
           protected String method = "*"; // default is all methods
   
  +        /**
  +         * Set the class name to match
  +         * Default is match all classes
  +         * @param value the classname to match
  +         */
           public void setClass(String value) {
               clazz = value;
           }
   
  +        /**
  +         * Set the method name to match.
  +         * Default is "*", match all methods
  +         * @param value the method name to match
  +         */
           public void setMethod(String value) {
               method = value;
           }
   
  +        /**
  +         * Get a regular expression matching this filter.
  +         * @return a regular expression pattern matching this filer.
  +         */
           public String getAsPattern() {
               StringBuffer buf = new StringBuffer(toString());
               StringUtil.replace(buf, ".", "\\.");
  @@ -115,6 +143,11 @@
               return buf.toString();
           }
   
  +        /**
  +         * Get this object as a string.
  +         * The form is ClassName.method().
  +         * @return this filter as a string.
  +         */
           public String toString() {
               return clazz + "." + method + "()";
           }
  
  
  
  1.10      +7 -2      ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Socket.java
  
  Index: Socket.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Socket.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Socket.java	9 Feb 2004 21:05:34 -0000	1.9
  +++ Socket.java	25 May 2005 14:23:31 -0000	1.10
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2002,2004 The Apache Software Foundation
  + * Copyright  2001-2002,2004-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -36,6 +36,7 @@
       /**
        * the host name/ip of the machine on which the Viewer is running;
        * defaults to localhost.
  +     * @param value the home name/ip
        */
       public void setHost(String value) {
           host = value;
  @@ -43,12 +44,16 @@
   
       /**
        * Optional port number for the viewer; default is 4444
  +     * @param value the port number
        */
       public void setPort(Integer value) {
           port = value.intValue();
       }
   
  -    /** if no host is set, returning ':&lt;port&gt;', will take localhost */
  +    /**
  +     * if no host is set, returning ':&lt;port&gt;', will take localhost
  +     * @return "host:port"
  +     */
       public String toString() {
           return host + ":" + port;
       }
  
  
  
  1.15      +33 -19    ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java
  
  Index: Triggers.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Triggers.java	9 Mar 2004 16:48:35 -0000	1.14
  +++ Triggers.java	25 May 2005 14:23:31 -0000	1.15
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2002,2004 The Apache Software Foundation
  + * Copyright  2001-2002,2004-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -30,18 +30,24 @@
   
       protected Vector triggers = new Vector();
   
  +    /** Constructor of Triggers. */
       public Triggers() {
       }
   
   
       /**
        * add a method trigger
  +     * @param method a method to trigger on
        */
       public void addMethod(Method method) {
           triggers.addElement(method);
       }
   
  -    // -jp_trigger=ClassName.*():E:S,ClassName.MethodName():X:X
  +    /**
  +     * Get the command line option of the form
  +     * -jp_trigger=ClassName.*():E:S,ClassName.MethodName():X:X
  +     * @return a trigger option
  +     */
       public String toString() {
           StringBuffer buf = new StringBuffer();
           final int size = triggers.size();
  @@ -68,6 +74,7 @@
            * The name of the method(s) as a regular expression. The name
            * is the fully qualified name on the form <tt>package.classname.method</tt>
            *  required.
  +         * @param value the fully qualified name
            */
           public void setName(String value) {
               name = value;
  @@ -77,10 +84,11 @@
            * the event on the method that will trigger the action. Must be
            * &quot;enter&quot; or &quot;exit&quot;
            *  required.
  +         * @param value the event - either "enter" or "exit"
            */
           public void setEvent(String value) {
  -            if (eventMap.get(value) == null) {
  -                throw new BuildException("Invalid event, must be one of " + eventMap);
  +            if (EVENT_MAP.get(value) == null) {
  +                throw new BuildException("Invalid event, must be one of " + EVENT_MAP);
               }
               event = value;
           }
  @@ -90,27 +98,33 @@
            * &quot;pause&quot;, &quot;resume&quot;, &quot;snapshot&quot;, &quot;suspend&quot;,
            * or &quot;exit&quot;. They respectively clear recording, pause recording,
            * resume recording, take a snapshot, suspend the recording and exit the program.
  +         * @param value the action - "clear", "pause", "resume", "snapshot", "suspend"
  +         *              or "exit"
  +         * @throws BuildException on error
            */
           public void setAction(String value) throws BuildException {
  -            if (actionMap.get(value) == null) {
  -                throw new BuildException("Invalid action, must be one of " + actionMap);
  +            if (ACTION_MAP.get(value) == null) {
  +                throw new BuildException("Invalid action, must be one of " + ACTION_MAP);
               }
               action = value;
           }
   
           /**
            * A alphanumeric custom name for the snapshot; optional.
  +         * @param value the custom name for the snapshot
            */
           public void setParam(String value) {
               param = value;
           }
   
  -        // return <name>:<event>:<action>[:param]
  +        /**
  +         * @return <name>:<event>:<action>[:param]
  +         */
           public String toString() {
               StringBuffer buf = new StringBuffer();
               buf.append(name).append(":"); //@todo name must not be null, check for it
  -            buf.append(eventMap.get(event)).append(":");
  -            buf.append(actionMap.get(action));
  +            buf.append(EVENT_MAP.get(event)).append(":");
  +            buf.append(ACTION_MAP.get(action));
               if (param != null) {
                   buf.append(":").append(param);
               }
  @@ -119,21 +133,21 @@
       }
   
       /** mapping of actions to cryptic command line mnemonics */
  -    private static final Hashtable actionMap = new Hashtable(3);
  +    private static final Hashtable ACTION_MAP = new Hashtable(3);
   
       /** mapping of events to cryptic command line mnemonics */
  -    private static final Hashtable eventMap = new Hashtable(3);
  +    private static final Hashtable EVENT_MAP = new Hashtable(3);
   
       static {
  -        actionMap.put("enter", "E");
  -        actionMap.put("exit", "X");
  +        ACTION_MAP.put("enter", "E");
  +        ACTION_MAP.put("exit", "X");
           // clear|pause|resume|snapshot|suspend|exit
  -        eventMap.put("clear", "C");
  -        eventMap.put("pause", "P");
  -        eventMap.put("resume", "R");
  -        eventMap.put("snapshot", "S");
  -        eventMap.put("suspend", "A");
  -        eventMap.put("exit", "X");
  +        EVENT_MAP.put("clear", "C");
  +        EVENT_MAP.put("pause", "P");
  +        EVENT_MAP.put("resume", "R");
  +        EVENT_MAP.put("snapshot", "S");
  +        EVENT_MAP.put("suspend", "A");
  +        EVENT_MAP.put("exit", "X");
       }
   
   }
  
  
  
  1.21      +82 -10    ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java
  
  Index: XMLReport.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- XMLReport.java	9 Mar 2004 16:48:35 -0000	1.20
  +++ XMLReport.java	25 May 2005 14:23:31 -0000	1.21
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2004 The Apache Software Foundation
  + * Copyright  2001-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -71,23 +71,36 @@
       /** method filters */
       private ReportFilters filters;
   
  -    /** create a new XML report, logging will be on stdout */
  +    /**
  +     * Create a new XML report, logging will be on stdout.
  +     * @param file the file to place the report in
  +     */
       public XMLReport(File file) {
           this(null, file);
       }
   
  -    /** create a new XML report, logging done on the task */
  +    /**
  +     * Create a new XML report, logging done on the task.
  +     * @param task the task to use for logging
  +     * @param file the file to place the report in
  +     */
       public XMLReport(Task task, File file) {
           this.file = file;
           this.task = task;
       }
   
  -    /** set the JProbe home path. Used to get the DTD */
  +    /**
  +     * Set the JProbe home path. Used to get the DTD.
  +     * @param home the JProbe directory
  +     */
       public void setJProbehome(File home) {
           jprobeHome = home;
       }
   
  -    /** set the  */
  +    /**
  +     * set the  filters attribute.
  +     * @param filters a filtersreport value
  +     */
       public void setReportFilters(ReportFilters filters) {
           this.filters = filters;
       }
  @@ -154,7 +167,12 @@
           log("Indexed " + classMap.size() + " classes in " + pkgMap.size() + " packages");
       }
   
  -    /** create the whole new document */
  +    /**
  +     * Create the whole new document.
  +     * @param classPath the classpath
  +     * @return a dom document
  +     * @throws Exception on error
  +     */
       public Document createDocument(String[] classPath) throws Exception {
   
           // Iterate over the classpath to identify reference classes
  @@ -199,6 +217,9 @@
        * JProbe does not put the java.lang prefix for classes
        * in this package, so used this nice method so that
        * I have the same signature for methods
  +     * @param method info on a method
  +     * @return a method signature with the "java.lang" prefixes removed from
  +     *         the method arguments
        */
       protected String getMethodSignature(MethodInfo method) {
           StringBuffer buf = new StringBuffer(method.getName());
  @@ -224,6 +245,9 @@
   
       /**
        * Convert to a CovReport-like signature - &lt;classname&gt;&#046;&lt;method&gt;().
  +     * @param clazz the class to use
  +     * @param method the method to use
  +     * @return the CovReport-like signature
        */
       protected String getMethodSignature(ClassFile clazz, MethodInfo method) {
           StringBuffer buf = new StringBuffer(clazz.getFullName());
  @@ -236,6 +260,8 @@
       /**
        * Do additional work on an element to remove abstract methods that
        * are reported by JProbe 3.0
  +     * @param classFile the class to use
  +     * @param classNode information on the class
        */
       protected void removeAbstractMethods(ClassFile classFile, Element classNode) {
           MethodInfo[] methods = classFile.getMethods();
  @@ -254,7 +280,11 @@
           }
       }
   
  -    /** create an empty method element with its cov.data values */
  +    /**
  +     * Create an empty method element with its cov.data values.
  +     * @param method jprobe info on a method
  +     * @return the method element
  +     */
       protected Element createMethodElement(MethodInfo method) {
           String methodsig = getMethodSignature(method);
           Element methodElem = report.createElement("method");
  @@ -268,7 +298,11 @@
           return methodElem;
       }
   
  -    /** create an empty package element with its default cov.data (0) */
  +    /**
  +     * Create an empty package element with its default cov.data (0).
  +     * @param pkgname the packet name
  +     * @return the package element
  +     */
       protected Element createPackageElement(String pkgname) {
           Element pkgElem = report.createElement("package");
           pkgElem.setAttribute("name", pkgname);
  @@ -284,7 +318,11 @@
           return pkgElem;
       }
   
  -    /** create an empty class element with its default cov.data (0) */
  +    /**
  +     * Create an empty class element with its default cov.data (0).
  +     * @param classFile jprobe class info
  +     * @return an class element
  +     */
       protected Element createClassElement(ClassFile classFile) {
           // create the class element
           Element classElem = report.createElement("class");
  @@ -305,7 +343,10 @@
           return classElem;
       }
   
  -    /** serialize a classfile into XML */
  +    /**
  +     * serialize a classfile into XML.
  +     * @param classFile the class file to serialize
  +     */
       protected void serializeClass(ClassFile classFile) {
           // the class already is reported so ignore it
           String fullclassname = classFile.getFullName();
  @@ -368,6 +409,11 @@
           classMap.put(fullclassname, classElem);
       }
   
  +    /**
  +     * Get the methods from a classFile that pass the filters.
  +     * @param classFile the class file to get the methods from
  +     * @return the list of methods
  +     */
       protected Vector getFilteredMethods(ClassFile classFile) {
           MethodInfo[] methodlist = classFile.getMethods();
           Vector methods = new Vector(methodlist.length);
  @@ -449,6 +495,13 @@
           covdata.setAttribute("total_lines", String.valueOf(total_lines));
       }
   
  +    /**
  +     * Search for an element with the tag "cov.data" in the children
  +     * of the parent element and return it.
  +     * @param parent the parent element to search in
  +     * @return the "cov.data" element
  +     * @throws NoSuchElementException if unable to find a cov.data element
  +     */
       protected Element getCovDataChild(Element parent) {
           NodeList children = parent.getChildNodes();
           int len = children.getLength();
  @@ -465,6 +518,11 @@
               + "element in parent '" + parent.getNodeName() + "'");
       }
   
  +    /**
  +     * Get the method elements of an class element.
  +     * @param clazz the element to search it
  +     * @return a name to element map of methods
  +     */
       protected Hashtable getMethods(Element clazz) {
           Hashtable map = new Hashtable();
           NodeList children = clazz.getChildNodes();
  @@ -482,6 +540,11 @@
           return map;
       }
   
  +    /**
  +     * Get the class elements of an package element.
  +     * @param pkg the element to search it
  +     * @return an array of class elements
  +     */
       protected Element[] getClasses(Element pkg) {
           Vector v = new Vector();
           NodeList children = pkg.getChildNodes();
  @@ -501,6 +564,11 @@
   
       }
   
  +    /**
  +     * Get the package elements of an snapshot element.
  +     * @param snapshot the element to search it
  +     * @return an array of package elements
  +     */
       protected Element[] getPackages(Element snapshot) {
           Vector v = new Vector();
           NodeList children = snapshot.getChildNodes();
  @@ -530,6 +598,10 @@
           }
       }
   
  +    /**
  +     * Log a message to the associated task.
  +     * @param message a <code>String</code> attribute
  +     */
       public void log(String message) {
           if (task == null) {
               //System.out.println(message);
  
  
  
  1.13      +45 -20    ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java
  
  Index: ClassFile.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ClassFile.java	9 Mar 2004 16:48:36 -0000	1.12
  +++ ClassFile.java	25 May 2005 14:23:31 -0000	1.13
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2002,2004 The Apache Software Foundation
  + * Copyright  2001-2002,2004-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -44,6 +44,11 @@
   
       private int access_flags;
   
  +    /**
  +     * Constructor for ClassFile.
  +     * @param is the input stream containing the class.
  +     * @throws IOException on error
  +     */
       public ClassFile(InputStream is) throws IOException {
           DataInputStream dis = new DataInputStream(is);
           ConstantPool constantPool = new ConstantPool();
  @@ -57,8 +62,9 @@
   
           // class information
           access_flags = dis.readShort();
  -        int this_class = dis.readShort();
  -        fullname = ((ClassCPInfo) constantPool.getEntry(this_class)).getClassName().replace('/', '.');
  +        int thisClass = dis.readShort();
  +        fullname = ((ClassCPInfo) constantPool.getEntry(
  +                        thisClass)).getClassName().replace('/', '.');
           /* int super_class = */ dis.readShort();
   
           // skip interfaces...
  @@ -71,8 +77,8 @@
               // 3 short: access flags, name index, descriptor index
               dis.skip(2 * 3);
               // attribute list...
  -            int attributes_count = dis.readUnsignedShort();
  -            for (int j = 0; j < attributes_count; j++) {
  +            int attributesCount = dis.readUnsignedShort();
  +            for (int j = 0; j < attributesCount; j++) {
                   dis.skipBytes(2); // skip attr_id (short)
                   int len = dis.readInt();
                   dis.skipBytes(len);
  @@ -80,44 +86,64 @@
           }
   
           // read methods
  -        int method_count = dis.readShort();
  -        methods = new MethodInfo[method_count];
  -        for (int i = 0; i < method_count; i++) {
  +        int methodCount = dis.readShort();
  +        methods = new MethodInfo[methodCount];
  +        for (int i = 0; i < methodCount; i++) {
               methods[i] = new MethodInfo();
               methods[i].read(constantPool, dis);
           }
   
           // get interesting attributes.
  -        int attributes_count = dis.readUnsignedShort();
  -        for (int j = 0; j < attributes_count; j++) {
  -            int attr_id = dis.readShort();
  +        int attributesCount = dis.readUnsignedShort();
  +        for (int j = 0; j < attributesCount; j++) {
  +            int attrId = dis.readShort();
               int len = dis.readInt();
  -            String attr_name = Utils.getUTF8Value(constantPool, attr_id);
  -            if (AttributeInfo.SOURCE_FILE.equals(attr_name)) {
  -                int name_index = dis.readShort();
  -                sourceFile = ((Utf8CPInfo) constantPool.getEntry(name_index)).getValue();
  +            String attrName = Utils.getUTF8Value(constantPool, attrId);
  +            if (AttributeInfo.SOURCE_FILE.equals(attrName)) {
  +                int nameIndex = dis.readShort();
  +                sourceFile = ((Utf8CPInfo) constantPool.getEntry(nameIndex)).getValue();
               } else {
                   dis.skipBytes(len);
               }
           }
       }
   
  +    /**
  +     * Get the access flags of the class.
  +     * @return the flags
  +     */
       public int getAccess() {
           return access_flags;
       }
   
  +    /**
  +     * Get the source filename
  +     * @return the source filename
  +     */
       public String getSourceFile() {
           return sourceFile;
       }
   
  +    /**
  +     * Get the methods of the class.
  +     * @return the methods
  +     */
       public MethodInfo[] getMethods() {
           return methods;
       }
   
  +    /**
  +     * Get the full name of the class.
  +     * @return the full name
  +     */
       public String getFullName() {
           return fullname;
       }
   
  +    /**
  +     * Get the name of the class (minus package name)
  +     * @return the name
  +     */
       public String getName() {
           String name = getFullName();
           int pos = name.lastIndexOf('.');
  @@ -127,6 +153,10 @@
           return name.substring(pos + 1);
       }
   
  +    /**
  +     * Get the package name of the class.
  +     * @return the package name
  +     */
       public String getPackage() {
           String name = getFullName();
           int pos = name.lastIndexOf('.');
  @@ -137,8 +167,3 @@
       }
   
   }
  -
  -
  -
  -
  -
  
  
  
  1.21      +16 -3     ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java
  
  Index: ClassPathLoader.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ClassPathLoader.java	9 Mar 2004 16:48:36 -0000	1.20
  +++ ClassPathLoader.java	25 May 2005 14:23:31 -0000	1.21
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2004 The Apache Software Foundation
  + * Copyright  2001-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -38,6 +38,7 @@
    */
   public class ClassPathLoader {
   
  +    /** A null loader */
       public static final FileLoader NULL_LOADER = new NullLoader();
   
       /** the list of files to look for */
  @@ -80,10 +81,17 @@
   
       /** the interface to implement to look up for specific resources */
       public interface FileLoader {
  -        /** the file url that is looked for .class files */
  +        /**
  +         * the file url that is looked for .class files.
  +         * @return the file
  +         */
           File getFile();
   
  -        /** return the set of classes found in the file */
  +        /**
  +         * Return the set of classes found in the file.
  +         * @return the list of classes
  +         * @throws IOException on error
  +         */
           ClassFile[] getClasses() throws IOException;
       }
   
  @@ -104,6 +112,7 @@
        * @return the hashtable containing ALL classes that are found in the given
        * classpath. Note that the first entry of a given classname will shadow
        * classes with the same name (as a classloader does)
  +     * @throws IOException on error
        */
       public Hashtable getClasses() throws IOException {
           Hashtable map = new Hashtable();
  @@ -159,6 +168,9 @@
        * useful methods to read the whole input stream in memory so that
        * it can be accessed faster. Processing rt.jar and tools.jar from JDK 1.3.1
        * brings time from 50s to 7s.
  +     * @param is the inout stream to cache
  +     * @return the cached input stream
  +     * @throws IOException on error
        */
       public static InputStream getCachedStream(InputStream is) throws IOException {
           final InputStream bis = new BufferedInputStream(is);
  @@ -266,6 +278,7 @@
                       try {
                           is.close();
                       } catch (IOException ignored) {
  +                        // Ignore Exception
                       }
                   }
               }
  
  
  
  1.14      +60 -7     ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java
  
  Index: MethodInfo.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- MethodInfo.java	9 Mar 2004 16:48:36 -0000	1.13
  +++ MethodInfo.java	25 May 2005 14:23:31 -0000	1.14
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2002,2004 The Apache Software Foundation
  + * Copyright  2001-2002,2004-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -27,16 +27,23 @@
    *
    */
   public final class MethodInfo {
  -    private int access_flags;
  +    private int accessFlags;
       private int loc = -1;
       private String name;
       private String descriptor;
   
  +    /** Constructor for MethodInfo. */
       public MethodInfo() {
       }
   
  +    /**
  +     * Read the method info from a data input stream.
  +     * @param constantPool a constant pool
  +     * @param dis          the data input stream
  +     * @throws IOException on error
  +     */
       public void read(ConstantPool constantPool, DataInputStream dis) throws IOException {
  -        access_flags = dis.readShort();
  +        accessFlags = dis.readShort();
   
           int name_index = dis.readShort();
           name = Utils.getUTF8Value(constantPool, name_index);
  @@ -58,6 +65,12 @@
   
       }
   
  +    /**
  +     * Read a code from a data input stream.
  +     * @param constantPool a constant pool
  +     * @param dis          the data input stream
  +     * @throws IOException on error
  +     */
       protected void readCode(ConstantPool constantPool, DataInputStream dis) throws IOException {
           // skip max_stack (short), max_local (short)
           dis.skipBytes(2 * 2);
  @@ -87,22 +100,44 @@
           }
       }
   
  +    /**
  +     * Get the access flags.
  +     * @return the access flags
  +     */
       public int getAccessFlags() {
  -        return access_flags;
  +        return accessFlags;
       }
   
  +    /**
  +     * Get the name.
  +     * @return the name
  +     */
       public String getName() {
           return name;
       }
   
  +    /**
  +     * Get the descriptor.
  +     * @return the descriptor
  +     */
       public String getDescriptor() {
           return descriptor;
       }
   
  +    /**
  +     * Get the full signature of the method.
  +     * This is the return type, the name and the parameters.
  +     * @return the full signature
  +     */
       public String getFullSignature() {
           return getReturnType() + " " + getShortSignature();
       }
   
  +    /**
  +     * Get the short signature of the method.
  +     * This is just the name and the parameters.
  +     * @return the short signature
  +     */
       public String getShortSignature() {
           StringBuffer buf = new StringBuffer(getName());
           buf.append("(");
  @@ -117,22 +152,42 @@
           return buf.toString();
       }
   
  +    /**
  +     * Get the return type.
  +     * @return the return type
  +     */
       public String getReturnType() {
           return Utils.getMethodReturnType(getDescriptor());
       }
   
  +    /**
  +     * Get the paramaters types.
  +     * @return an array of types
  +     */
       public String[] getParametersType() {
           return Utils.getMethodParams(getDescriptor());
       }
   
  +    /**
  +     * Get the number of lines in the method.
  +     * @return the number of lines
  +     */
       public int getNumberOfLines() {
           return loc;
       }
   
  +    /**
  +     * Get the access flags as a string.
  +     * @return the access flags.
  +     */
       public String getAccess() {
  -        return Utils.getMethodAccess(access_flags);
  +        return Utils.getMethodAccess(accessFlags);
       }
   
  +    /**
  +     * Return a string represention of this object.
  +     * @return the access, and the full signature
  +     */
       public String toString() {
           StringBuffer sb = new StringBuffer();
           sb.append("Method: ").append(getAccess()).append(" ");
  @@ -140,5 +195,3 @@
           return sb.toString();
       }
   }
  -
  -
  
  
  
  1.15      +89 -75    ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Utils.java	9 Mar 2004 16:48:36 -0000	1.14
  +++ Utils.java	25 May 2005 14:23:31 -0000	1.15
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2004 The Apache Software Foundation
  + * Copyright  2001-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -25,7 +25,7 @@
    * Utilities mostly to manipulate methods and access flags.
    *
    */
  -public class Utils {
  +public final class Utils {
       /** public access flag */
       public static final short ACC_PUBLIC = 1;
       /** private access flag */
  @@ -98,7 +98,7 @@
   
       /**
        * return the object type of a return type.
  -     * @param descriptor
  +     * @param descriptor the description symbol
        * @return get the return type objet of a given descriptor
        */
       public static String getMethodReturnType(String descriptor) {
  @@ -172,143 +172,157 @@
   
       /**
        * check for abstract access
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there is abstact access
        */
  -    public static boolean isAbstract(int access_flags) {
  -        return (access_flags & ACC_ABSTRACT) != 0;
  +    public static boolean isAbstract(int accessFlags) {
  +        return (accessFlags & ACC_ABSTRACT) != 0;
       }
   
       /**
        * check for public access
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there is public access
        */
  -    public static boolean isPublic(int access_flags) {
  -        return (access_flags & ACC_PUBLIC) != 0;
  +    public static boolean isPublic(int accessFlags) {
  +        return (accessFlags & ACC_PUBLIC) != 0;
       }
   
       /**
        * check for a static access
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there is static access
        */
  -    public static boolean isStatic(int access_flags) {
  -        return (access_flags & ACC_STATIC) != 0;
  +    public static boolean isStatic(int accessFlags) {
  +        return (accessFlags & ACC_STATIC) != 0;
       }
   
       /**
  -     *  check for native access
  -     * @param access_flags access flags
  +     * check for native access
  +     * @param accessFlags access flags
  +     * @return true if there is native access
        */
  -    public static boolean isNative(int access_flags) {
  -        return (access_flags & ACC_NATIVE) != 0;
  +    public static boolean isNative(int accessFlags) {
  +        return (accessFlags & ACC_NATIVE) != 0;
       }
   
       /**
        * check for class access
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there is class access
        */
  -    public static boolean isClass(int access_flags) {
  -        return !isInterface(access_flags);
  +    public static boolean isClass(int accessFlags) {
  +        return !isInterface(accessFlags);
       }
   
       /**
        * check for strict access
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there is strict access
        */
  -    public static boolean isStrict(int access_flags) {
  -        return (access_flags & ACC_STRICT) != 0;
  +    public static boolean isStrict(int accessFlags) {
  +        return (accessFlags & ACC_STRICT) != 0;
       }
   
       /**
        * check for interface access
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there is interface access
        */
  -    public static boolean isInterface(int access_flags) {
  -        return (access_flags & ACC_INTERFACE) != 0;
  +    public static boolean isInterface(int accessFlags) {
  +        return (accessFlags & ACC_INTERFACE) != 0;
       }
   
       /**
        * check for private access
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there is private access
        */
  -    public static boolean isPrivate(int access_flags) {
  -        return (access_flags & ACC_PRIVATE) != 0;
  +    public static boolean isPrivate(int accessFlags) {
  +        return (accessFlags & ACC_PRIVATE) != 0;
       }
   
       /**
        * check for transient flag
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there is transient access
        */
  -    public static boolean isTransient(int access_flags) {
  -        return (access_flags & ACC_TRANSIENT) != 0;
  +    public static boolean isTransient(int accessFlags) {
  +        return (accessFlags & ACC_TRANSIENT) != 0;
       }
   
       /**
        * check for volatile flag
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there is volatile access
        */
  -    public static boolean isVolatile(int access_flags) {
  -        return (access_flags & ACC_VOLATILE) != 0;
  +    public static boolean isVolatile(int accessFlags) {
  +        return (accessFlags & ACC_VOLATILE) != 0;
       }
   
       /**
        * check for super flag
  -     * @param access_flags access flag
  +     * @param accessFlags access flag
  +     * @return true if there the super flag is set
        */
  -    public static boolean isSuper(int access_flags) {
  -        return (access_flags & ACC_SUPER) != 0;
  +    public static boolean isSuper(int accessFlags) {
  +        return (accessFlags & ACC_SUPER) != 0;
       }
   
       /**
        * check for protected flag
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there is protected access
        */
  -    public static boolean isProtected(int access_flags) {
  -        return (access_flags & ACC_PROTECTED) != 0;
  +    public static boolean isProtected(int accessFlags) {
  +        return (accessFlags & ACC_PROTECTED) != 0;
       }
   
       /**
        * chck for final flag
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there the final flag is set
        */
  -    public static boolean isFinal(int access_flags) {
  -        return (access_flags & ACC_FINAL) != 0;
  +    public static boolean isFinal(int accessFlags) {
  +        return (accessFlags & ACC_FINAL) != 0;
       }
   
       /**
        * check for synchronized flag
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
  +     * @return true if there the synchronized flag is set
        */
  -    public static boolean isSynchronized(int access_flags) {
  -        return (access_flags & ACC_SYNCHRONIZED) != 0;
  +    public static boolean isSynchronized(int accessFlags) {
  +        return (accessFlags & ACC_SYNCHRONIZED) != 0;
       }
   
       /**
        * return the method access flag as java modifiers
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
        * @return the access flags as modifier strings
        */
  -    public static String getMethodAccess(int access_flags) {
  +    public static String getMethodAccess(int accessFlags) {
           StringBuffer sb = new StringBuffer();
  -        if (isPublic(access_flags)) {
  +        if (isPublic(accessFlags)) {
               sb.append("public ");
  -        } else if (isPrivate(access_flags)) {
  +        } else if (isPrivate(accessFlags)) {
               sb.append("private ");
  -        } else if (isProtected(access_flags)) {
  +        } else if (isProtected(accessFlags)) {
               sb.append("protected ");
           }
  -        if (isFinal(access_flags)) {
  +        if (isFinal(accessFlags)) {
               sb.append("final ");
           }
  -        if (isStatic(access_flags)) {
  +        if (isStatic(accessFlags)) {
               sb.append("static ");
           }
  -        if (isSynchronized(access_flags)) {
  +        if (isSynchronized(accessFlags)) {
               sb.append("synchronized ");
           }
  -        if (isNative(access_flags)) {
  +        if (isNative(accessFlags)) {
               sb.append("native ");
           }
  -        if (isAbstract(access_flags)) {
  +        if (isAbstract(accessFlags)) {
               sb.append("abstract ");
           }
           return sb.toString().trim();
  @@ -316,28 +330,28 @@
   
       /**
        * return the field access flag as java modifiers
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
        * @return the access flags as modifier strings
        */
  -    public static String getFieldAccess(int access_flags) {
  +    public static String getFieldAccess(int accessFlags) {
           StringBuffer sb = new StringBuffer();
  -        if (isPublic(access_flags)) {
  +        if (isPublic(accessFlags)) {
               sb.append("public ");
  -        } else if (isPrivate(access_flags)) {
  +        } else if (isPrivate(accessFlags)) {
               sb.append("private ");
  -        } else if (isProtected(access_flags)) {
  +        } else if (isProtected(accessFlags)) {
               sb.append("protected ");
           }
  -        if (isFinal(access_flags)) {
  +        if (isFinal(accessFlags)) {
               sb.append("final ");
           }
  -        if (isStatic(access_flags)) {
  +        if (isStatic(accessFlags)) {
               sb.append("static ");
           }
  -        if (isVolatile(access_flags)) {
  +        if (isVolatile(accessFlags)) {
               sb.append("volatile ");
           }
  -        if (isTransient(access_flags)) {
  +        if (isTransient(accessFlags)) {
               sb.append("transient ");
           }
           return sb.toString().trim();
  @@ -345,31 +359,31 @@
   
       /**
        * return the class access flag as java modifiers
  -     * @param access_flags access flags
  +     * @param accessFlags access flags
        * @return the access flags as modifier strings
        */
  -    public static String getClassAccess(int access_flags) {
  +    public static String getClassAccess(int accessFlags) {
           StringBuffer sb = new StringBuffer();
  -        if (isPublic(access_flags)) {
  +        if (isPublic(accessFlags)) {
               sb.append("public ");
  -        } else if (isProtected(access_flags)) {
  +        } else if (isProtected(accessFlags)) {
               sb.append("protected ");
  -        } else if (isPrivate(access_flags)) {
  +        } else if (isPrivate(accessFlags)) {
               sb.append("private ");
           }
  -        if (isFinal(access_flags)) {
  +        if (isFinal(accessFlags)) {
               sb.append("final ");
           }
  -        if (isSuper(access_flags)) {
  +        if (isSuper(accessFlags)) {
               sb.append("/*super*/ ");
           }
  -        if (isInterface(access_flags)) {
  +        if (isInterface(accessFlags)) {
               sb.append("interface ");
           }
  -        if (isAbstract(access_flags)) {
  +        if (isAbstract(accessFlags)) {
               sb.append("abstract ");
           }
  -        if (isClass(access_flags)) {
  +        if (isClass(accessFlags)) {
               sb.append("class ");
           }
           return sb.toString().trim();
  
  
  
  1.11      +12 -2     ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/attributes/AttributeInfo.java
  
  Index: AttributeInfo.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/attributes/AttributeInfo.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AttributeInfo.java	9 Mar 2004 16:48:36 -0000	1.10
  +++ AttributeInfo.java	25 May 2005 14:23:31 -0000	1.11
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2002,2004 The Apache Software Foundation
  + * Copyright  2001-2002,2004-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -22,26 +22,36 @@
    */
   public interface AttributeInfo {
   
  +    /** The source file attribute */
       String SOURCE_FILE = "SourceFile";
   
  +    /** The constant value attribute */
       String CONSTANT_VALUE = "ConstantValue";
   
  +    /** The code attribute */
       String CODE = "Code";
   
  +    /** The exceptions attribute */
       String EXCEPTIONS = "Exceptions";
   
  +    /** The line number table attribute */
       String LINE_NUMBER_TABLE = "LineNumberTable";
   
  +    /** The local variable table attribute */
       String LOCAL_VARIABLE_TABLE = "LocalVariableTable";
   
  +    /** The inner classes attribute */
       String INNER_CLASSES = "InnerClasses";
   
  +    /** The source dir attribute */
       String SOURCE_DIR = "SourceDir";
   
  +    /** The synthetic attribute */
       String SYNTHETIC = "Synthetic";
   
  +    /** The deprecated attribute */
       String DEPRECATED = "Deprecated";
   
  +    /** The unknown attribute */
       String UNKNOWN = "Unknown";
  -
   }
  
  
  

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


Mime
View raw message