Browse Source

add some final keyword to immutable things

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@687832 13f79535-47bb-0310-9956-ffa450edef68
master
Scokart Gilles 17 years ago
parent
commit
502a6bcbf7
6 changed files with 17 additions and 15 deletions
  1. +10
    -8
      src/main/org/apache/tools/ant/IntrospectionHelper.java
  2. +3
    -3
      src/main/org/apache/tools/ant/Location.java
  3. +1
    -1
      src/main/org/apache/tools/ant/TaskConfigurationChecker.java
  4. +1
    -1
      src/main/org/apache/tools/ant/UnknownElement.java
  5. +1
    -1
      src/main/org/apache/tools/ant/UnsupportedAttributeException.java
  6. +1
    -1
      src/main/org/apache/tools/ant/UnsupportedElementException.java

+ 10
- 8
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -90,40 +90,40 @@ public final class IntrospectionHelper {
* Map from attribute names to attribute types * Map from attribute names to attribute types
* (String to Class). * (String to Class).
*/ */
private Hashtable attributeTypes = new Hashtable();
private final Hashtable attributeTypes = new Hashtable();


/** /**
* Map from attribute names to attribute setter methods * Map from attribute names to attribute setter methods
* (String to AttributeSetter). * (String to AttributeSetter).
*/ */
private Hashtable attributeSetters = new Hashtable();
private final Hashtable attributeSetters = new Hashtable();


/** /**
* Map from attribute names to nested types * Map from attribute names to nested types
* (String to Class). * (String to Class).
*/ */
private Hashtable nestedTypes = new Hashtable();
private final Hashtable nestedTypes = new Hashtable();


/** /**
* Map from attribute names to methods to create nested types * Map from attribute names to methods to create nested types
* (String to NestedCreator). * (String to NestedCreator).
*/ */
private Hashtable nestedCreators = new Hashtable();
private final Hashtable nestedCreators = new Hashtable();


/** /**
* Vector of methods matching add[Configured](Class) pattern. * Vector of methods matching add[Configured](Class) pattern.
*/ */
private List addTypeMethods = new ArrayList();
private final List addTypeMethods = new ArrayList();


/** /**
* The method to invoke to add PCDATA. * The method to invoke to add PCDATA.
*/ */
private Method addText = null;
private final Method addText;


/** /**
* The class introspected by this instance. * The class introspected by this instance.
*/ */
private Class bean;
private final Class bean;


/** /**
* Sole constructor, which is private to ensure that all * Sole constructor, which is private to ensure that all
@@ -178,6 +178,7 @@ public final class IntrospectionHelper {
private IntrospectionHelper(final Class bean) { private IntrospectionHelper(final Class bean) {
this.bean = bean; this.bean = bean;
Method[] methods = bean.getMethods(); Method[] methods = bean.getMethods();
Method addTextMethod = null;
for (int i = 0; i < methods.length; i++) { for (int i = 0; i < methods.length; i++) {
final Method m = methods[i]; final Method m = methods[i];
final String name = m.getName(); final String name = m.getName();
@@ -202,7 +203,7 @@ public final class IntrospectionHelper {
} }
if ("addText".equals(name) && java.lang.Void.TYPE.equals(returnType) if ("addText".equals(name) && java.lang.Void.TYPE.equals(returnType)
&& args.length == 1 && java.lang.String.class.equals(args[0])) { && args.length == 1 && java.lang.String.class.equals(args[0])) {
addText = methods[i];
addTextMethod = methods[i];
} else if (name.startsWith("set") && java.lang.Void.TYPE.equals(returnType) } else if (name.startsWith("set") && java.lang.Void.TYPE.equals(returnType)
&& args.length == 1 && !args[0].isArray()) { && args.length == 1 && !args[0].isArray()) {
String propName = getPropertyName(name, "set"); String propName = getPropertyName(name, "set");
@@ -294,6 +295,7 @@ public final class IntrospectionHelper {
} }
} }
} }
addText = addTextMethod;
} }


/** /**


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

@@ -31,11 +31,11 @@ import org.xml.sax.Locator;
public class Location implements Serializable { public class Location implements Serializable {


/** Name of the file. */ /** Name of the file. */
private String fileName;
private final String fileName;
/** Line number within the file. */ /** Line number within the file. */
private int lineNumber;
private final int lineNumber;
/** Column number within the file. */ /** Column number within the file. */
private int columnNumber;
private final int columnNumber;


/** Location to use when one is needed but no information is available */ /** Location to use when one is needed but no information is available */
public static final Location UNKNOWN_LOCATION = new Location(); public static final Location UNKNOWN_LOCATION = new Location();


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

@@ -59,7 +59,7 @@ public class TaskConfigurationChecker {
private List/*<String>*/ errors = new ArrayList(); private List/*<String>*/ errors = new ArrayList();
/** Task for which the configuration should be checked. */ /** Task for which the configuration should be checked. */
private Task task;
private final Task task;
/** /**
* Constructor. * Constructor.


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

@@ -39,7 +39,7 @@ public class UnknownElement extends Task {
* task/type that hasn't been defined at parser time or has * task/type that hasn't been defined at parser time or has
* been redefined since original creation. * been redefined since original creation.
*/ */
private String elementName;
private final String elementName;


/** /**
* Holds the namespace of the element. * Holds the namespace of the element.


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

@@ -24,7 +24,7 @@ package org.apache.tools.ant;
*/ */
public class UnsupportedAttributeException extends BuildException { public class UnsupportedAttributeException extends BuildException {


private String attribute;
private final String attribute;


/** /**
* Constructs an unsupported attribute exception. * Constructs an unsupported attribute exception.


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

@@ -33,7 +33,7 @@ package org.apache.tools.ant;
*/ */
public class UnsupportedElementException extends BuildException { public class UnsupportedElementException extends BuildException {


private String element;
private final String element;


/** /**
* Constructs an unsupported element exception. * Constructs an unsupported element exception.


Loading…
Cancel
Save