ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gscok...@apache.org
Subject svn commit: r687832 - in /ant/core/trunk/src/main/org/apache/tools/ant: IntrospectionHelper.java Location.java TaskConfigurationChecker.java UnknownElement.java UnsupportedAttributeException.java UnsupportedElementException.java
Date Thu, 21 Aug 2008 19:06:44 GMT
Author: gscokart
Date: Thu Aug 21 12:06:43 2008
New Revision: 687832

URL: http://svn.apache.org/viewvc?rev=687832&view=rev
Log:
add some final keyword to immutable things

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java
    ant/core/trunk/src/main/org/apache/tools/ant/Location.java
    ant/core/trunk/src/main/org/apache/tools/ant/TaskConfigurationChecker.java
    ant/core/trunk/src/main/org/apache/tools/ant/UnknownElement.java
    ant/core/trunk/src/main/org/apache/tools/ant/UnsupportedAttributeException.java
    ant/core/trunk/src/main/org/apache/tools/ant/UnsupportedElementException.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java?rev=687832&r1=687831&r2=687832&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java Thu Aug 21 12:06:43
2008
@@ -90,40 +90,40 @@
      * Map from attribute names to attribute types
      * (String to Class).
      */
-    private Hashtable attributeTypes = new Hashtable();
+    private final Hashtable attributeTypes = new Hashtable();
 
     /**
      * Map from attribute names to attribute setter methods
      * (String to AttributeSetter).
      */
-    private Hashtable attributeSetters = new Hashtable();
+    private final Hashtable attributeSetters = new Hashtable();
 
     /**
      * Map from attribute names to nested types
      * (String to Class).
      */
-    private Hashtable nestedTypes = new Hashtable();
+    private final Hashtable nestedTypes = new Hashtable();
 
     /**
      * Map from attribute names to methods to create nested types
      * (String to NestedCreator).
      */
-    private Hashtable nestedCreators = new Hashtable();
+    private final Hashtable nestedCreators = new Hashtable();
 
     /**
      * 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.
      */
-    private Method addText = null;
+    private final Method addText;
 
     /**
      * The class introspected by this instance.
      */
-    private Class bean;
+    private final Class bean;
 
     /**
      * Sole constructor, which is private to ensure that all
@@ -178,6 +178,7 @@
     private IntrospectionHelper(final Class bean) {
         this.bean = bean;
         Method[] methods = bean.getMethods();
+        Method addTextMethod = null;
         for (int i = 0; i < methods.length; i++) {
             final Method m = methods[i];
             final String name = m.getName();
@@ -202,7 +203,7 @@
             }
             if ("addText".equals(name) && java.lang.Void.TYPE.equals(returnType)
                     && 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)
                     && args.length == 1 && !args[0].isArray()) {
                 String propName = getPropertyName(name, "set");
@@ -294,6 +295,7 @@
                 }
             }
         }
+        addText = addTextMethod;
     }
 
     /**

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Location.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Location.java?rev=687832&r1=687831&r2=687832&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Location.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Location.java Thu Aug 21 12:06:43 2008
@@ -31,11 +31,11 @@
 public class Location implements Serializable {
 
     /** Name of the file. */
-    private String fileName;
+    private final String fileName;
     /** Line number within the file. */
-    private int lineNumber;
+    private final int lineNumber;
     /** Column number within the file. */
-    private int columnNumber;
+    private final int columnNumber;
 
     /** Location to use when one is needed but no information is available */
     public static final Location UNKNOWN_LOCATION = new Location();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/TaskConfigurationChecker.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/TaskConfigurationChecker.java?rev=687832&r1=687831&r2=687832&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/TaskConfigurationChecker.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/TaskConfigurationChecker.java Thu Aug 21
12:06:43 2008
@@ -59,7 +59,7 @@
     private List/*<String>*/ errors = new ArrayList();
 
     /** Task for which the configuration should be checked. */
-    private Task task;
+    private final Task task;
 
     /**
      * Constructor.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/UnknownElement.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/UnknownElement.java?rev=687832&r1=687831&r2=687832&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/UnknownElement.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/UnknownElement.java Thu Aug 21 12:06:43 2008
@@ -39,7 +39,7 @@
      * task/type that hasn't been defined at parser time or has
      * been redefined since original creation.
      */
-    private String elementName;
+    private final String elementName;
 
     /**
      * Holds the namespace of the element.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/UnsupportedAttributeException.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/UnsupportedAttributeException.java?rev=687832&r1=687831&r2=687832&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/UnsupportedAttributeException.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/UnsupportedAttributeException.java Thu Aug
21 12:06:43 2008
@@ -24,7 +24,7 @@
  */
 public class UnsupportedAttributeException extends BuildException {
 
-    private String attribute;
+    private final String attribute;
 
     /**
      * Constructs an unsupported attribute exception.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/UnsupportedElementException.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/UnsupportedElementException.java?rev=687832&r1=687831&r2=687832&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/UnsupportedElementException.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/UnsupportedElementException.java Thu Aug
21 12:06:43 2008
@@ -33,7 +33,7 @@
  */
 public class UnsupportedElementException extends BuildException {
 
-    private String element;
+    private final String element;
 
     /**
      * Constructs an unsupported element exception.



Mime
View raw message