Author: peterreilly Date: Wed Sep 13 14:01:23 2006 New Revision: 443120 URL: http://svn.apache.org/viewvc?view=rev&rev=443120 Log: Fix regression: revert changes to MacroDef.Attribute and Macrodef.Text The class had been modified to derive from a new class MacroDef.Member, when ant-contrib is compiled with ant1.7 and used with ant1.6, the <for> task stops working as it tries to load MacroDef.Member when it is loading MacroDef.Attribute.
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=443120&r1=443119&r2=443120 ============================================================================== --- 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 Wed Sep 13 14:01:23 2006 @@ -437,14 +437,36 @@ return objectHashCode(name); } - } // END static class Member + } /** * An attribute for the MacroDef task. + * */ - public static class Attribute extends Member { - + public static class Attribute { + private String name; private String defaultValue; + private String description; + + /** + * The name of the attribute. + * + * @param name the name of the attribute + */ + public void setName(String name) { + if (!isValidName(name)) { + throw new BuildException( + "Illegal name [" + name + "] for attribute"); + } + this.name = name.toLowerCase(Locale.US); + } + + /** + * @return the name of the attribute + */ + public String getName() { + return name; + } /** * The default value to use if the parameter is not @@ -463,20 +485,61 @@ return defaultValue; } - /** [EMAIL PROTECTED] */ - protected boolean equals(Member m) { - Attribute a = (Attribute) m; - return super.equals(m) && - (defaultValue == null)? a.defaultValue == null: - defaultValue.equals(a.defaultValue); + /** + * @param desc Description of the element. + * @since ant 1.6.1 + */ + public void setDescription(String desc) { + description = desc; } - /** [EMAIL PROTECTED] */ - public int hashCode() { - return super.hashCode() + objectHashCode(defaultValue); + /** + * @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 == null) { + return false; + } + if (obj.getClass() != getClass()) { + return false; + } + Attribute other = (Attribute) obj; + if (name == null) { + if (other.name != null) { + return false; + } + } else if (!name.equals(other.name)) { + return false; + } + if (defaultValue == null) { + if (other.defaultValue != null) { + return false; + } + } else if (!defaultValue.equals(other.defaultValue)) { + return false; + } + return true; } - } // END static class Attribute + /** + * @return a hash code value for this object. + */ + public int hashCode() { + return objectHashCode(defaultValue) + objectHashCode(name); + } + } /** * A nested define element for the MacroDef task. @@ -533,17 +596,37 @@ } } - } // END static class DefineAttribute + } /** * A nested text element for the MacroDef task. - * * @since ant 1.6.1 */ - public static class Text extends Member { - + public static class Text { + private String name; private boolean optional; private boolean trim; + private String description; + + /** + * The name of the attribute. + * + * @param name the name of the attribute + */ + public void setName(String name) { + if (!isValidName(name)) { + throw new BuildException( + "Illegal name [" + name + "] for attribute"); + } + this.name = name.toLowerCase(Locale.US); + } + + /** + * @return the name of the attribute + */ + public String getName() { + return name; + } /** * The optional attribute of the text element. @@ -555,8 +638,6 @@ } /** - * Gets whether this text element is optional or not. - * * @return true if the text is optional */ public boolean getOptional() { @@ -574,23 +655,64 @@ } /** - * Gets whether to trim the raw provided text. - * * @return true if the text is trim */ public boolean getTrim() { return trim; } - /** [EMAIL PROTECTED] */ - protected boolean equals(Member m) { - Text t = (Text) m; - return super.equals(m) && - optional == t.optional && - trim == t.trim; + /** + * @param desc Description of the text. + */ + public void setDescription(String desc) { + description = desc; + } + + /** + * @return the description of the text, or <code>null</code> if + * no description is available. + */ + 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 == null) { + return false; + } + if (obj.getClass() != getClass()) { + return false; + } + Text other = (Text) obj; + if (name == null) { + if (other.name != null) { + return false; + } + } else if (!name.equals(other.name)) { + return false; + } + if (optional != other.optional) { + return false; + } + if (trim != other.trim) { + return false; + } + return true; } - } // END static class Text + /** + * @return a hash code value for this object. + */ + public int hashCode() { + return objectHashCode(name); + } + } /** * A nested element for the MacroDef task. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]