Browse Source

checkstyle

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@475982 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 19 years ago
parent
commit
ce0b8ac7d0
19 changed files with 97 additions and 29 deletions
  1. +4
    -0
      src/main/org/apache/tools/ant/types/AbstractFileSet.java
  2. +5
    -0
      src/main/org/apache/tools/ant/types/ArchiveFileSet.java
  3. +8
    -0
      src/main/org/apache/tools/ant/types/ArchiveScanner.java
  4. +1
    -1
      src/main/org/apache/tools/ant/types/Commandline.java
  5. +3
    -0
      src/main/org/apache/tools/ant/types/CommandlineJava.java
  6. +4
    -0
      src/main/org/apache/tools/ant/types/DataType.java
  7. +5
    -2
      src/main/org/apache/tools/ant/types/EnumeratedAttribute.java
  8. +3
    -0
      src/main/org/apache/tools/ant/types/Environment.java
  9. +0
    -11
      src/main/org/apache/tools/ant/types/LogLevel.java
  10. +3
    -0
      src/main/org/apache/tools/ant/types/Mapper.java
  11. +23
    -5
      src/main/org/apache/tools/ant/types/Path.java
  12. +5
    -0
      src/main/org/apache/tools/ant/types/Quantifier.java
  13. +4
    -3
      src/main/org/apache/tools/ant/types/Resource.java
  14. +3
    -3
      src/main/org/apache/tools/ant/types/ResourceCollection.java
  15. +10
    -0
      src/main/org/apache/tools/ant/types/TarFileSet.java
  16. +9
    -2
      src/main/org/apache/tools/ant/types/XMLCatalog.java
  17. +4
    -0
      src/main/org/apache/tools/ant/types/ZipFileSet.java
  18. +2
    -2
      src/main/org/apache/tools/ant/types/optional/ScriptMapper.java
  19. +1
    -0
      src/main/org/apache/tools/ant/types/spi/Service.java

+ 4
- 0
src/main/org/apache/tools/ant/types/AbstractFileSet.java View File

@@ -332,6 +332,7 @@ public abstract class AbstractFileSet extends DataType

/**
* Whether default exclusions should be used or not.
* @return the default exclusions value.
* @since Ant 1.6.3
*/
public synchronized boolean getDefaultexcludes() {
@@ -768,6 +769,7 @@ public abstract class AbstractFileSet extends DataType

/**
* Get the merged include patterns for this AbstractFileSet.
* @param p the project to use.
* @return the include patterns of the default pattern set and all
* nested patternsets.
*
@@ -779,6 +781,7 @@ public abstract class AbstractFileSet extends DataType

/**
* Get the merged exclude patterns for this AbstractFileSet.
* @param p the project to use.
* @return the exclude patterns of the default pattern set and all
* nested patternsets.
*
@@ -790,6 +793,7 @@ public abstract class AbstractFileSet extends DataType

/**
* Get the merged patterns for this AbstractFileSet.
* @param p the project to use.
* @return the default patternset merged with the additional sets
* in a new PatternSet instance.
*


+ 5
- 0
src/main/org/apache/tools/ant/types/ArchiveFileSet.java View File

@@ -225,6 +225,7 @@ public abstract class ArchiveFileSet extends FileSet {

/**
* Creates a scanner for this type of archive.
* @return the scanner.
*/
protected abstract ArchiveScanner newArchiveScanner();

@@ -444,6 +445,7 @@ public abstract class ArchiveFileSet extends FileSet {

/**
* Return the prefix prepended to entries in the archive file.
* @return the prefix.
* @deprecated since 1.7.
*/
public String getPrefix() {
@@ -452,6 +454,7 @@ public abstract class ArchiveFileSet extends FileSet {

/**
* Return the full pathname of the single entryZ in this fileset.
* @return the full pathname.
* @deprecated since 1.7.
*/
public String getFullpath() {
@@ -459,6 +462,7 @@ public abstract class ArchiveFileSet extends FileSet {
}

/**
* @return the file mode.
* @deprecated since 1.7.
*/
public int getFileMode() {
@@ -466,6 +470,7 @@ public abstract class ArchiveFileSet extends FileSet {
}

/**
* @return the dir mode.
* @deprecated since 1.7.
*/
public int getDirMode() {


+ 8
- 0
src/main/org/apache/tools/ant/types/ArchiveScanner.java View File

@@ -38,12 +38,15 @@ import org.apache.tools.ant.types.resources.FileResourceIterator;
* @since Ant 1.7
*/
public abstract class ArchiveScanner extends DirectoryScanner {
// CheckStyle:VisibilityModifier OFF - bc

/**
* The archive file which should be scanned.
*/
protected File srcFile;

// CheckStyle:VisibilityModifier ON

/**
* The archive resource which should be scanned.
*/
@@ -320,6 +323,11 @@ public abstract class ArchiveScanner extends DirectoryScanner {
lastScannedResource = thisresource;
}

/**
* Remove trailing slash if present.
* @param s the file name to trim.
* @return the trimed file name.
*/
protected static final String trimSeparator(String s) {
return s.endsWith("/") ? s.substring(0, s.length() - 1) : s;
}


+ 1
- 1
src/main/org/apache/tools/ant/types/Commandline.java View File

@@ -54,7 +54,7 @@ import org.apache.tools.ant.taskdefs.condition.Os;
*/
public class Commandline implements Cloneable {
/** win9x uses a (shudder) bat file (antRun.bat) for executing commands */
private static boolean IS_WIN_9X = Os.isFamily("win9x");
private static final boolean IS_WIN_9X = Os.isFamily("win9x");

/**
* The arguments of the command


+ 3
- 0
src/main/org/apache/tools/ant/types/CommandlineJava.java View File

@@ -75,7 +75,10 @@ public class CommandlineJava implements Cloneable {
* Specialized Environment class for System properties.
*/
public static class SysProperties extends Environment implements Cloneable {
// CheckStyle:VisibilityModifier OFF - bc
/** the system properties. */
Properties sys = null;
// CheckStyle:VisibilityModifier ON
private Vector propertySets = new Vector();

/**


+ 4
- 0
src/main/org/apache/tools/ant/types/DataType.java View File

@@ -38,6 +38,7 @@ import org.apache.tools.ant.util.IdentityStack;
*
*/
public abstract class DataType extends ProjectComponent implements Cloneable {
// CheckStyle:VisibilityModifier OFF - bc

/**
* The description the user has set.
@@ -73,6 +74,8 @@ public abstract class DataType extends ProjectComponent implements Cloneable {
*/
protected boolean checked = true;

// CheckStyle:VisibilityModifier ON

/**
* Sets a description of the current data type. It will be useful
* in commenting what we are doing.
@@ -355,6 +358,7 @@ public abstract class DataType extends ProjectComponent implements Cloneable {
/**
* @since Ant 1.7
* @return a shallow copy of this DataType.
* @throws CloneNotSupportedException if there is a problem.
*/
public Object clone() throws CloneNotSupportedException {
DataType dt = (DataType) super.clone();


+ 5
- 2
src/main/org/apache/tools/ant/types/EnumeratedAttribute.java View File

@@ -29,12 +29,14 @@ import org.apache.tools.ant.BuildException;
*
*/
public abstract class EnumeratedAttribute {
// CheckStyle:VisibilityModifier OFF - bc
/**
* The selected value in this enumeration.
*/
protected String value;

// CheckStyle:VisibilityModifier ON

/**
* the index of the selected value in the array.
*/
@@ -68,7 +70,8 @@ public abstract class EnumeratedAttribute {
Class/*<? extends EnumeratedAttribute>*/ clazz,
String value) throws BuildException {
if (!EnumeratedAttribute.class.isAssignableFrom(clazz)) {
throw new BuildException("You have to provide a subclass from EnumeratedAttribut as clazz-parameter.");
throw new BuildException(
"You have to provide a subclass from EnumeratedAttribut as clazz-parameter.");
}
EnumeratedAttribute ea = null;
try {


+ 3
- 0
src/main/org/apache/tools/ant/types/Environment.java View File

@@ -26,6 +26,7 @@ import org.apache.tools.ant.BuildException;
*
*/
public class Environment {
// CheckStyle:VisibilityModifier OFF - bc

/**
* a vector of type Enviromment.Variable
@@ -33,6 +34,8 @@ public class Environment {
*/
protected Vector variables;

// CheckStyle:VisibilityModifier ON

/**
* representation of a single env value
*/


+ 0
- 11
src/main/org/apache/tools/ant/types/LogLevel.java View File

@@ -18,18 +18,7 @@

package org.apache.tools.ant.types;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.FileOutputStream;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.EnumeratedAttribute;

/**
* The enumerated values for Ant's log level.


+ 3
- 0
src/main/org/apache/tools/ant/types/Mapper.java View File

@@ -30,6 +30,7 @@ import org.apache.tools.ant.util.ContainerMapper;
*
*/
public class Mapper extends DataType implements Cloneable {
// CheckStyle:VisibilityModifier OFF - bc

protected MapperType type = null;
protected String classname = null;
@@ -37,6 +38,8 @@ public class Mapper extends DataType implements Cloneable {
protected String from = null;
protected String to = null;

// CheckStyle:VisibilityModifier ON

private ContainerMapper container = null;

/**


+ 23
- 5
src/main/org/apache/tools/ant/types/Path.java View File

@@ -42,7 +42,8 @@ import org.apache.tools.ant.util.JavaEnvUtils;
* &lt;sometask&gt;<br>
* &nbsp;&nbsp;&lt;somepath&gt;<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&lt;pathelement location="/path/to/file.jar" /&gt;<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&lt;pathelement path="/path/to/file2.jar:/path/to/class2;/path/to/class3" /&gt;
* &nbsp;&nbsp;&nbsp;&nbsp;&lt;pathelement
* path="/path/to/file2.jar:/path/to/class2;/path/to/class3" /&gt;
* <br>
* &nbsp;&nbsp;&nbsp;&nbsp;&lt;pathelement location="/path/to/file3.jar" /&gt;<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&lt;pathelement location="/path/to/file4.jar" /&gt;<br>
@@ -61,11 +62,13 @@ import org.apache.tools.ant.util.JavaEnvUtils;
*/

public class Path extends DataType implements Cloneable, ResourceCollection {
// CheckStyle:VisibilityModifier OFF - bc

/** The system classpath as a Path object */
public static Path systemClasspath =
new Path(null, System.getProperty("java.class.path"));


/**
* The system bootclasspath as a Path object.
*
@@ -74,7 +77,10 @@ public class Path extends DataType implements Cloneable, ResourceCollection {
public static Path systemBootClasspath =
new Path(null, System.getProperty("sun.boot.class.path"));

private static Iterator EMPTY_ITERATOR = Collections.EMPTY_SET.iterator();
private static final Iterator EMPTY_ITERATOR
= Collections.EMPTY_SET.iterator();

// CheckStyle:VisibilityModifier OFF - bc

/**
* Helper class, holds the nested <code>&lt;pathelement&gt;</code> values.
@@ -109,14 +115,26 @@ public class Path extends DataType implements Cloneable, ResourceCollection {
return parts;
}

/**
* Create an iterator.
* @return an iterator.
*/
public Iterator iterator() {
return new FileResourceIterator(null, parts);
}

/**
* Check if this resource is only for filesystems.
* @return true.
*/
public boolean isFilesystemOnly() {
return true;
}

/**
* Get the number of resources.
* @return the number of parts.
*/
public int size() {
return parts == null ? 0 : parts.length;
}
@@ -344,8 +362,8 @@ public class Path extends DataType implements Cloneable, ResourceCollection {
* @return a textual representation of the path.
*/
public String toString() {
return isReference() ? getCheckedRef().toString() :
union == null ? "" : union.toString();
return isReference() ? getCheckedRef().toString()
: union == null ? "" : union.toString();
}

/**
@@ -660,7 +678,7 @@ public class Path extends DataType implements Cloneable, ResourceCollection {
* are added to this container while the Iterator is in use.
* @return a "fail-fast" Iterator.
*/
public synchronized final Iterator iterator() {
public final synchronized Iterator iterator() {
if (isReference()) {
return ((Path) getCheckedRef()).iterator();
}


+ 5
- 0
src/main/org/apache/tools/ant/types/Quantifier.java View File

@@ -40,10 +40,15 @@ public class Quantifier extends EnumeratedAttribute {
= new String[] {"all", "each", "every", "any", "some", "one",
"majority", "most", "none"};

/** ALL instance */
public static final Quantifier ALL = new Quantifier("all");
/** ANY instance */
public static final Quantifier ANY = new Quantifier("any");
/** ONE instance */
public static final Quantifier ONE = new Quantifier("one");
/** MAJORITY instance */
public static final Quantifier MAJORITY = new Quantifier("majority");
/** NONE instance */
public static final Quantifier NONE = new Quantifier("none");

private static abstract class Predicate {


+ 4
- 3
src/main/org/apache/tools/ant/types/Resource.java View File

@@ -241,8 +241,8 @@ public class Resource extends DataType
if (isReference()) {
return ((Resource) getCheckedRef()).getSize();
}
return isExists() ?
(size != null ? size.longValue() : UNKNOWN_SIZE)
return isExists()
? (size != null ? size.longValue() : UNKNOWN_SIZE)
: 0L;
}

@@ -280,6 +280,7 @@ public class Resource extends DataType

/**
* Implement basic Resource equality.
* @param other the object to check against.
* @return true if the specified Object is equal to this Resource.
* @since Ant 1.7
*/
@@ -343,7 +344,7 @@ public class Resource extends DataType
public Iterator iterator() {
return isReference() ? ((Resource) getCheckedRef()).iterator()
: new Iterator() {
boolean done = false;
private boolean done = false;
public boolean hasNext() {
return !done;
}


+ 3
- 3
src/main/org/apache/tools/ant/types/ResourceCollection.java View File

@@ -30,13 +30,13 @@ public interface ResourceCollection {
* are <code>org.apache.tools.ant.types.Resource</code> instances.
* @return an Iterator of Resources.
*/
public Iterator iterator();
Iterator iterator();

/**
* Learn the number of contained Resources.
* @return number of elements as int.
*/
public int size();
int size();

/**
* Indicate whether this ResourceCollection is composed entirely of
@@ -45,6 +45,6 @@ public interface ResourceCollection {
* instances of FileResource.
* @return whether this is a filesystem-only resource collection.
*/
public boolean isFilesystemOnly();
boolean isFilesystemOnly();

}

+ 10
- 0
src/main/org/apache/tools/ant/types/TarFileSet.java View File

@@ -174,6 +174,10 @@ public class TarFileSet extends ArchiveFileSet {
return groupIdSet;
}

/**
* Create a new scanner.
* @return the created scanner.
*/
protected ArchiveScanner newArchiveScanner() {
TarScanner zs = new TarScanner();
return zs;
@@ -215,6 +219,12 @@ public class TarFileSet extends ArchiveFileSet {
}
}

/**
* Configure a fileset based on this fileset.
* If the fileset is a TarFileSet copy in the tarfileset
* specific attributes.
* @param zfs the archive fileset to configure.
*/
protected void configureFileSet(ArchiveFileSet zfs) {
super.configureFileSet(zfs);
if (zfs instanceof TarFileSet) {


+ 9
- 2
src/main/org/apache/tools/ant/types/XMLCatalog.java View File

@@ -368,7 +368,11 @@ public class XMLCatalog extends DataType

/**
* Implements the EntityResolver.resolveEntity() interface method.
*
* @param publicId the public id to resolve.
* @param systemId the system id to resolve.
* @throws SAXException if there is a parsing problem.
* @throws IOException if there is an IO problem.
* @return the resolved entity.
* @see org.xml.sax.EntityResolver#resolveEntity
*/
public InputSource resolveEntity(String publicId, String systemId)
@@ -396,7 +400,10 @@ public class XMLCatalog extends DataType

/**
* Implements the URIResolver.resolve() interface method.
*
* @param href an href attribute.
* @param base the base URI.
* @return a Source object, or null if href cannot be resolved.
* @throws TransformerException if an error occurs.
* @see javax.xml.transform.URIResolver#resolve
*/
public Source resolve(String href, String base)


+ 4
- 0
src/main/org/apache/tools/ant/types/ZipFileSet.java View File

@@ -84,6 +84,10 @@ public class ZipFileSet extends ArchiveFileSet {
return encoding;
}

/**
* Return a new archive scanner based on this one.
* @return a new ZipScanner with the same encoding as this one.
*/
protected ArchiveScanner newArchiveScanner() {
ZipScanner zs = new ZipScanner();
zs.setEncoding(encoding);


+ 2
- 2
src/main/org/apache/tools/ant/types/optional/ScriptMapper.java View File

@@ -28,7 +28,7 @@ import java.util.ArrayList;
public class ScriptMapper extends AbstractScriptComponent implements FileNameMapper {


ArrayList files;
private ArrayList files;
static final String[] EMPTY_STRING_ARRAY = new String[0];


@@ -59,7 +59,7 @@ public class ScriptMapper extends AbstractScriptComponent implements FileNameMap

/**
* Add a mapped name
* @param mapping
* @param mapping the value to use.
*/
public void addMappedName(String mapping) {
files.add(mapping);


+ 1
- 0
src/main/org/apache/tools/ant/types/spi/Service.java View File

@@ -81,6 +81,7 @@ public class Service extends ProjectComponent {
* services as an inputstream.
* @return an inputstream of the classname names
* encoded as UTF-8.
* @throws IOException if there is an error.
*/
public InputStream getAsStream() throws IOException {
ByteArrayOutputStream arrayOut;


Loading…
Cancel
Save