use of DynamicConfigurator. Fix the doc and the code to at least make this consistent. PR: 25687 Obtained from: Geoffrey Wiseman git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275830 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -59,7 +59,11 @@ | |||||
| AT this location"). | AT this location"). | ||||
| The escape sequence @@{x} is used to allow @{x} to be | The escape sequence @@{x} is used to allow @{x} to be | ||||
| placed in the text without substitution of x. | placed in the text without substitution of x. | ||||
| This corresponds to the $${x} escape sequence for properties | |||||
| This corresponds to the $${x} escape sequence for properties. | |||||
| </p> | |||||
| <p> | |||||
| The case of the attribute is ignored, so @{myAttribute} is treated the | |||||
| same as @{MyAttribute}. | |||||
| </p> | </p> | ||||
| <h3>Parameters</h3> | <h3>Parameters</h3> | ||||
| <table border="1" cellpadding="2" cellspacing="0"> | <table border="1" cellpadding="2" cellspacing="0"> | ||||
| @@ -75,4 +75,15 @@ | |||||
| <property name="property" value="A property value"/> | <property name="property" value="A property value"/> | ||||
| <double prop="property"/> | <double prop="property"/> | ||||
| </target> | </target> | ||||
| <target name="ignorecase"> | |||||
| <macrodef name="ignore"> | |||||
| <attribute name="MyAttribute"/> | |||||
| <sequential> | |||||
| <echo>@{myattribute} is @{MYATTRIBUTE}</echo> | |||||
| </sequential> | |||||
| </macrodef> | |||||
| <ignore myattribute="a"/> | |||||
| <ignore Myattribute="b"/> | |||||
| </target> | |||||
| </project> | </project> | ||||
| @@ -57,6 +57,7 @@ package org.apache.tools.ant.taskdefs; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.Locale; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import org.apache.tools.ant.AntTypeDefinition; | import org.apache.tools.ant.AntTypeDefinition; | ||||
| @@ -293,7 +294,7 @@ public class MacroDef extends AntlibDefinition { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "Illegal name [" + name + "] for attribute"); | "Illegal name [" + name + "] for attribute"); | ||||
| } | } | ||||
| this.name = name; | |||||
| this.name = name.toLowerCase(Locale.US); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -57,6 +57,7 @@ package org.apache.tools.ant.taskdefs; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.Locale; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.Set; | import java.util.Set; | ||||
| import java.util.HashSet; | import java.util.HashSet; | ||||
| @@ -200,7 +201,7 @@ public class MacroInstance extends Task implements DynamicConfigurator { | |||||
| case STATE_EXPECT_NAME: | case STATE_EXPECT_NAME: | ||||
| if (ch == '}') { | if (ch == '}') { | ||||
| state = STATE_NORMAL; | state = STATE_NORMAL; | ||||
| String name = macroName.toString(); | |||||
| String name = macroName.toString().toLowerCase(Locale.US); | |||||
| String value = (String) macroMapping.get(name); | String value = (String) macroMapping.get(name); | ||||
| if (value == null) { | if (value == null) { | ||||
| ret.append("@{" + name + "}"); | ret.append("@{" + name + "}"); | ||||
| @@ -103,5 +103,11 @@ public class MacroDefTest extends BuildFileTest { | |||||
| "double", | "double", | ||||
| "@{prop} is 'property', value of ${property} is 'A property value'"); | "@{prop} is 'property', value of ${property} is 'A property value'"); | ||||
| } | } | ||||
| public void testIgnoreCase() { | |||||
| expectLog( | |||||
| "ignorecase", | |||||
| "a is ab is b"); | |||||
| } | |||||
| } | } | ||||