You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2006/12/12 23:15:31 UTC

svn commit: r486365 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java

Author: peterreilly
Date: Tue Dec 12 14:15:30 2006
New Revision: 486365

URL: http://svn.apache.org/viewvc?view=rev&rev=486365
Log:
stop making MacroDef#TemplateElement extend MacroDef#Member - BC reasons, and remore MacroDef#Member

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java?view=diff&rev=486365&r1=486364&r2=486365
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java Tue Dec 12 14:15:30 2006
@@ -319,96 +319,6 @@
         log("creating macro  " + name, Project.MSG_VERBOSE);
     }
 
-    /**
-     * Base class for a macro's attributes, elements, and text element.
-     *
-     * @since ant 1.7
-     */
-    public static class Member {
-
-        private String name;
-        private String description;
-
-        /**
-         * Sets the name of this member.
-         *
-         * @param name the name of the attribute
-         */
-        public void setName(String name) {
-            if (!isValidName(name)) {
-                throw new BuildException(
-                    "Illegal name [" + name + "] for macro member");
-            }
-            this.name = name.toLowerCase(Locale.US);
-        }
-
-        /**
-         * Gets the name of this macro member.
-         *
-         * @return the name of the member.
-         */
-        public String getName() {
-            return name;
-        }
-
-        /**
-         * Sets a textual description of this member,
-         * for build documentation purposes only.
-         *
-         * @param desc Description of the element.
-         * @since ant 1.6.1
-         */
-        public void setDescription(String desc) {
-            description = desc;
-        }
-
-        /**
-         * Gets the description of this member.
-         *
-         * @return the description of the element, or <code>null</code> if
-         *         no description is available.
-         * @since ant 1.6.1
-         */
-        public String getDescription() {
-            return description;
-        }
-
-        /**
-         * equality method.
-         *
-         * @param obj an <code>Object</code> value
-         * @return a <code>boolean</code> value
-         */
-        public boolean equals(Object obj) {
-            if (obj == this) {
-              return true;
-            }
-            if (obj != null && obj.getClass().equals(getClass())) {
-              return equals((Member) obj);
-            }
-            return false;
-        }
-
-        /**
-         * Equality method once it has been ascertain the object
-         * to compare to is not ourselves and is of the same type.
-         *
-         * @param m macro member guaranteed to be of the same type as this.
-         * @return a <code>boolean</code> value
-         */
-        protected boolean equals(Member m) {
-            return (name == null) ? m.name == null : name.equals(m.name);
-        }
-
-        /**
-         * Gets the hash code of this member, consistent with equals.
-         * @return a hash code value for this object.
-         */
-        public int hashCode() {
-            return objectHashCode(name);
-        }
-
-    }
 
     /**
      * An attribute for the MacroDef task.
@@ -631,12 +541,58 @@
     /**
      * A nested element for the MacroDef task.
      */
-    public static class TemplateElement extends Member {
+    public static class TemplateElement {
 
+        private String name;
+        private String description;
         private boolean optional = false;
         private boolean implicit = false;
 
         /**
+         * Sets the name of this element.
+         *
+         * @param name the name of the element
+         */
+        public void setName(String name) {
+            if (!isValidName(name)) {
+                throw new BuildException(
+                    "Illegal name [" + name + "] for macro element");
+            }
+            this.name = name.toLowerCase(Locale.US);
+        }
+
+        /**
+         * Gets the name of this element.
+         *
+         * @return the name of the element.
+         */
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * Sets a textual description of this element,
+         * for build documentation purposes only.
+         *
+         * @param desc Description of the element.
+         * @since ant 1.6.1
+         */
+        public void setDescription(String desc) {
+            description = desc;
+        }
+
+        /**
+         * Gets the description of this element.
+         *
+         * @return the description of the element, or <code>null</code> if
+         *         no description is available.
+         * @since ant 1.6.1
+         */
+        public String getDescription() {
+            return description;
+        }
+
+        /**
          * Sets whether this element is optional.
          *
          * @param optional if true this element may be left out, default
@@ -674,18 +630,32 @@
             return implicit;
         }
 
-        /** {@inheritDoc}. */
-        protected boolean equals(Member m) {
-            TemplateElement t = (TemplateElement) m;
-            return super.equals(m)
-                && optional == t.optional && implicit == t.implicit;
+        /**
+         * equality method.
+         *
+         * @param obj an <code>Object</code> value
+         * @return a <code>boolean</code> value
+         */
+        public boolean equals(Object obj) {
+            if (obj == this) {
+              return true;
+            }
+            if (obj == null || !obj.getClass().equals(getClass())) {
+                return false;
+            }
+            TemplateElement t = (TemplateElement) obj;
+            return
+                (name == null ? t.name == null : name.equals(t.name))
+                && optional == t.optional
+                && implicit == t.implicit;
         }
 
         /**
          * @return a hash code value for this object.
          */
         public int hashCode() {
-            return super.hashCode() + (optional ? 1 : 0) + (implicit ? 1 : 0);
+            return objectHashCode(name)
+                + (optional ? 1 : 0) + (implicit ? 1 : 0);
         }
 
     } // END static class TemplateElement



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