Author: peterreilly Date: Tue Dec 12 13:56:07 2006 New Revision: 486347 URL: http://svn.apache.org/viewvc?view=rev&rev=486347 Log: remove the <define> nested element of <macrodef>
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroInstance.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=486347&r1=486346&r2=486347 ============================================================================== --- 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 13:56:07 2006 @@ -265,42 +265,13 @@ throw new BuildException( "the name \"" + attribute.getName() + "\" has already been used in " - + (att instanceof DefineAttribute ? "a define element" - : "another attribute element")); + + "another attribute element"); } } attributes.add(attribute); } /** - * Add a define element. - * - * @param def a define nested element. - */ - public void addConfiguredDefine(DefineAttribute def) { - if (def.getName() == null) { - throw new BuildException( - "the define nested element needed a \"name\" attribute"); - } - if (def.getName().equals(textName)) { - throw new BuildException( - "the name \"" + def.getName() - + "\" has already been used by the text element"); - } - for (int i = 0; i < attributes.size(); ++i) { - Attribute att = (Attribute) attributes.get(i); - if (att.getName().equals(def.getName())) { - throw new BuildException( - "the name \"" + def.getName() - + "\" has already been used in " - + (att instanceof DefineAttribute ? "another define element" - : "an attribute element")); - } - } - attributes.add(def); - } - - /** * Add an element element. * * @param element an element nested element. @@ -539,63 +510,6 @@ public int hashCode() { return objectHashCode(defaultValue) + objectHashCode(name); } - } - - /** - * A nested define element for the MacroDef task. - * - * It provides an attribute with a guaranteed unique value - * on every instantiation of the macro. This allows to use - * this uniquely named attribute in property names used - * internally by the macro, thus creating unique property - * names and side-stepping Ant's property immutability rules. - * <p> - * Of course, this work around as the side effect of littering - * the global Ant property namespace, so is far for ideal, but - * will have to make do awaiting a better fix... - * - * @since ant 1.7 - */ - public static class DefineAttribute extends Attribute { - - private static long count = 0; - private String prefix = ""; - - /** - * Sets a prefix for the generated name. - * - * @param prefixValue the prefix to use. - */ - public void setPrefix(String prefixValue) { - prefix = prefixValue; - } - - /** - * Sets the default value. - * - * This is not allowed for the define nested element. - * - * @param defaultValue not used - * @throws BuildException always - */ - public void setDefault(String defaultValue) { - throw new BuildException( - "Illegal attribute \"default\" for define element"); - } - - /** - * Gets the default value for this attibute. - * - * @return the generated <em>unique</em> name, of the form - * "prefix#this classname#<aCounter>". - */ - public String getDefault() { - synchronized (DefineAttribute.class) { - // Make sure counter is managed globally - return prefix + "#" + getClass().getName() + "#" + (++count); - } - } - } /** Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java?view=diff&rev=486347&r1=486346&r2=486347 ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java Tue Dec 12 13:56:07 2006 @@ -348,9 +348,6 @@ if (value == null) { value = attribute.getDefault(); value = macroSubs(value, localAttributes); - } else if (attribute instanceof MacroDef.DefineAttribute) { - // Do not process given value, will fail as unknown attribute - continue; } if (value == null) { throw new BuildException( --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]