diff --git a/proposal/mutant/build/ant1compat.xml b/proposal/mutant/build/ant1compat.xml index 612be9d8e..77dc1c910 100644 --- a/proposal/mutant/build/ant1compat.xml +++ b/proposal/mutant/build/ant1compat.xml @@ -28,11 +28,7 @@ - - - - @@ -40,8 +36,21 @@ + + + + + + + + + + + + + @@ -53,21 +62,11 @@ - - - - - - - - - - - - + + diff --git a/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java b/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java index eb52b7308..37e00d568 100644 --- a/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java +++ b/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java @@ -340,6 +340,45 @@ public class Project implements org.apache.ant.common.event.BuildListener { } } + /** + * Returns a description of the type of the given element, with + * special handling for instances of tasks and data types. + *

+ * This is useful for logging purposes. + * + * @param element The element to describe. + * Must not be null. + * + * @return a description of the element type + * + * @since 1.95, Ant 1.5 + */ + public String getElementName(Object element) { + Hashtable elements = taskClassDefinitions; + Class elementClass = element.getClass(); + String typeName = "task"; + if (!elements.contains(elementClass)) { + elements = dataClassDefinitions; + typeName = "data type"; + if (!elements.contains(elementClass)) { + elements = null; + } + } + + if (elements != null) { + Enumeration e = elements.keys(); + while (e.hasMoreElements()) { + String name = (String) e.nextElement(); + Class clazz = (Class) elements.get(name); + if (elementClass.equals(clazz)) { + return "The <" + name + "> " + typeName; + } + } + } + + return "Class " + elementClass.getName(); + } + /** * Gets the Antlib factory of the Project * diff --git a/proposal/mutant/src/java/common/org/apache/ant/common/model/BuildElement.java b/proposal/mutant/src/java/common/org/apache/ant/common/model/BuildElement.java index b1fe83435..2a93a2947 100644 --- a/proposal/mutant/src/java/common/org/apache/ant/common/model/BuildElement.java +++ b/proposal/mutant/src/java/common/org/apache/ant/common/model/BuildElement.java @@ -61,7 +61,7 @@ import java.util.Map; import org.apache.ant.common.util.Location; /** - * A BuildElement is a holder configuration information for an element of + * A BuildElement is a holder of configuration information for an element of * the build. BuildElements may be grouped into a hierarchy to capture any * level of element nesting. *