You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2005/02/25 11:58:52 UTC

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc JJDoc.java JJTree.java JavaCC.java

bodewig     2005/02/25 02:58:52

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/javacc
                        JJDoc.java JJTree.java JavaCC.java
  Log:
  fix name-hiding and style by Kev Jackson
  
  Revision  Changes    Path
  1.13      +10 -6     ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java
  
  Index: JJDoc.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- JJDoc.java	22 Nov 2004 09:23:33 -0000	1.12
  +++ JJDoc.java	25 Feb 2005 10:58:51 -0000	1.13
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2003-2004 The Apache Software Foundation
  + * Copyright  2003-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.
  @@ -21,6 +21,7 @@
   import java.io.IOException;
   import java.util.Enumeration;
   import java.util.Hashtable;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
  @@ -95,6 +96,9 @@
           this.javaccHome = javaccHome;
       }
   
  +    /**
  +     * Constructor
  +     */
       public JJDoc() {
           cmdl.setVm(JavaEnvUtils.getJreExecutable("java"));
       }
  @@ -161,12 +165,12 @@
           }
       }
   
  -    private String createOutputFileName(File targetFile, String optionalOutputFile,
  -                                        boolean plainText) {
  +    private String createOutputFileName(File destFile, String optionalOutputFile,
  +                                        boolean plain) {
           String suffix = DEFAULT_SUFFIX_HTML;
  -        String javaccFile = targetFile.getAbsolutePath().replace('\\', '/');
  +        String javaccFile = destFile.getAbsolutePath().replace('\\', '/');
   
  -        if (plainText) {
  +        if (plain) {
               suffix = DEFAULT_SUFFIX_TEXT;
           }
   
  @@ -198,4 +202,4 @@
           return (getProject().getBaseDir() + "/" + optionalOutputFile)
               .replace('\\', '/');
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.35      +27 -29    ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  
  Index: JJTree.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- JJTree.java	15 Nov 2004 14:52:27 -0000	1.34
  +++ JJTree.java	25 Feb 2005 10:58:51 -0000	1.35
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2000-2004 The Apache Software Foundation
  + * Copyright  2000-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.
  @@ -21,6 +21,7 @@
   import java.io.IOException;
   import java.util.Enumeration;
   import java.util.Hashtable;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
  @@ -175,6 +176,9 @@
           this.javaccHome = javaccHome;
       }
   
  +    /**
  +     * Constructor
  +     */
       public JJTree() {
           cmdl.setVm(JavaEnvUtils.getJreExecutable("java"));
       }
  @@ -264,11 +268,11 @@
           }
       }
   
  -    private String createOutputFileName(File targetFile, String optionalOutputFile,
  -                                        String outputDirectory) {
  +    private String createOutputFileName(File destFile, String optionalOutputFile,
  +                                        String outputDir) {
           optionalOutputFile = validateOutputFile(optionalOutputFile,
  -                                                outputDirectory);
  -        String jjtreeFile = targetFile.getAbsolutePath().replace('\\', '/');
  +                                                outputDir);
  +        String jjtreeFile = destFile.getAbsolutePath().replace('\\', '/');
   
           if ((optionalOutputFile == null) || optionalOutputFile.equals("")) {
               int filePos = jjtreeFile.lastIndexOf("/");
  @@ -293,57 +297,51 @@
               }
           }
   
  -        if ((outputDirectory == null) || outputDirectory.equals("")) {
  -            outputDirectory = getDefaultOutputDirectory();
  +        if ((outputDir == null) || outputDir.equals("")) {
  +            outputDir = getDefaultOutputDirectory();
           }
   
  -        return (outputDirectory + "/" + optionalOutputFile).replace('\\', '/');
  +        return (outputDir + "/" + optionalOutputFile).replace('\\', '/');
       }
   
  - /*
  -  * Not used anymore
  -    private boolean isAbsolute(String fileName) {
  -        return (fileName.startsWith("/") || (new File(fileName).isAbsolute()));
  -    }
  -*/
       /**
        * When running JJTree from an Ant taskdesk the -OUTPUT_DIRECTORY must
        * always be set. But when -OUTPUT_DIRECTORY is set, -OUTPUT_FILE is
        * handled as if relative of this -OUTPUT_DIRECTORY. Thus when the
        * -OUTPUT_FILE is absolute or contains a drive letter we have a problem.
        *
  -     * @param outputFile
  -     * @param outputDirectory
  +     * @param destFile
  +     * @param outputDir
        * @return
        * @throws BuildException
        */
  -    private String validateOutputFile(String outputFile,
  -                                      String outputDirectory)
  +    private String validateOutputFile(String destFile,
  +                                      String outputDir)
           throws BuildException {
  -        if (outputFile == null) {
  +        if (destFile == null) {
               return null;
           }
   
  -        if ((outputDirectory == null)
  -            && (outputFile.startsWith("/") || outputFile.startsWith("\\"))) {
  -            String relativeOutputFile = makeOutputFileRelative(outputFile);
  +        if ((outputDir == null)
  +            && (destFile.startsWith("/") || destFile.startsWith("\\"))) {
  +            String relativeOutputFile = makeOutputFileRelative(destFile);
               setOutputfile(relativeOutputFile);
   
               return relativeOutputFile;
           }
   
  -        String root = getRoot(new File(outputFile)).getAbsolutePath();
  +        String root = getRoot(new File(destFile)).getAbsolutePath();
   
           if ((root.length() > 1)
  -            && outputFile.startsWith(root.substring(0, root.length() - 1))) {
  +            && destFile.startsWith(root.substring(0, root.length() - 1))) {
               throw new BuildException("Drive letter in 'outputfile' not "
  -                                     + "supported: " + outputFile);
  +                                     + "supported: " + destFile);
           }
   
  -        return outputFile;
  +        return destFile;
       }
   
  -    private String makeOutputFileRelative(String outputFile) {
  +    private String makeOutputFileRelative(String destFile) {
           StringBuffer relativePath = new StringBuffer();
           String defaultOutputDirectory = getDefaultOutputDirectory();
           int nextPos = defaultOutputDirectory.indexOf('/');
  @@ -360,7 +358,7 @@
               }
           }
   
  -        relativePath.append(outputFile);
  +        relativePath.append(destFile);
   
           return relativePath.toString();
       }
  @@ -384,4 +382,4 @@
   
           return root;
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.34      +2 -3      ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
  
  Index: JavaCC.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- JavaCC.java	22 Nov 2004 09:23:33 -0000	1.33
  +++ JavaCC.java	25 Feb 2005 10:58:51 -0000	1.34
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2000-2004 The Apache Software Foundation
  + * Copyright  2000-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.
  @@ -19,10 +19,9 @@
   
   import java.io.File;
   import java.io.InputStream;
  -import java.io.IOException;
   import java.util.Enumeration;
   import java.util.Hashtable;
  -import java.util.zip.ZipFile;
  +
   import org.apache.tools.ant.AntClassLoader;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
  
  
  

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