diff --git a/docs/manual/CoreTypes/custom-programming.html b/docs/manual/CoreTypes/custom-programming.html index b87dd8ebe..6e253fafe 100644 --- a/docs/manual/CoreTypes/custom-programming.html +++ b/docs/manual/CoreTypes/custom-programming.html @@ -39,8 +39,6 @@

After the class has been written, it is added to the ant system by using <typedef>. - One thing to be aware of is that currently this will only work - if the definition name is all lower case.

Custom Conditions

diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java index 2c314b79c..ef01eb605 100644 --- a/src/main/org/apache/tools/ant/IntrospectionHelper.java +++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java @@ -594,7 +594,8 @@ public final class IntrospectionHelper implements BuildListener { private NestedCreator getNestedCreator(Project project, Object parent, String elementName) throws BuildException { - NestedCreator nc = (NestedCreator) nestedCreators.get(elementName); + NestedCreator nc = (NestedCreator) nestedCreators.get( + elementName.toLowerCase(Locale.US)); if (nc == null) { nc = createAddTypeCreator(project, parent, elementName); } @@ -696,7 +697,7 @@ public final class IntrospectionHelper implements BuildListener { * @return true if the given nested element is supported */ public boolean supportsNestedElement(String elementName) { - return nestedCreators.containsKey(elementName) + return nestedCreators.containsKey(elementName.toLowerCase(Locale.US)) || DynamicConfigurator.class.isAssignableFrom(bean) || addTypeMethods.size() != 0; } @@ -726,7 +727,8 @@ public final class IntrospectionHelper implements BuildListener { if (elementName == null) { return; } - NestedCreator ns = (NestedCreator) nestedCreators.get(elementName); + NestedCreator ns = (NestedCreator) nestedCreators.get( + elementName.toLowerCase(Locale.US)); if (ns == null) { return; } diff --git a/src/main/org/apache/tools/ant/UnknownElement.java b/src/main/org/apache/tools/ant/UnknownElement.java index b01777319..a6844fa5c 100644 --- a/src/main/org/apache/tools/ant/UnknownElement.java +++ b/src/main/org/apache/tools/ant/UnknownElement.java @@ -57,7 +57,6 @@ package org.apache.tools.ant; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.Locale; import java.io.IOException; /** @@ -515,13 +514,8 @@ public class UnknownElement extends Task { private boolean handleChild(IntrospectionHelper ih, Object parent, UnknownElement child, RuntimeConfigurable childWrapper) { - // backwards compatibility - element names of nested - // elements have been all lower-case in Ant, except for - // TaskContainers - // This does not work too good for typedefed elements... - String childName = - ProjectHelper.genComponentName( - child.getNamespace(), child.getTag().toLowerCase(Locale.US)); + String childName = ProjectHelper.genComponentName( + child.getNamespace(), child.getTag()); if (ih.supportsNestedElement(childName)) { IntrospectionHelper.Creator creator = ih.getElementCreator(getProject(), parent, childName);