From 11f76e5f8dfe27f27946c7c5644b0735704e0f54 Mon Sep 17 00:00:00 2001 From: Conor MacNeill Date: Tue, 11 Feb 2003 13:41:33 +0000 Subject: [PATCH] Allow TaskContainers to have nested elements which take precedence over tasks git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274056 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/IntrospectionHelper.java | 14 +++++++++++++- src/main/org/apache/tools/ant/UnknownElement.java | 9 ++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java index f9cf5d453..b444edcee 100644 --- a/src/main/org/apache/tools/ant/IntrospectionHelper.java +++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -563,6 +563,18 @@ public class IntrospectionHelper implements BuildListener { } } + /** + * Indicate if this element supports a nested element of the + * given name. + * + * @param elementName the name of the nested element being checked + * + * @return true if the given nested element is supported + */ + public boolean supportsNestedElement(String elementName) { + return nestedCreators.containsKey(elementName); + } + /** * Stores a named nested element using a storage method determined * by the initial introspection. If no appropriate storage method diff --git a/src/main/org/apache/tools/ant/UnknownElement.java b/src/main/org/apache/tools/ant/UnknownElement.java index ec3ef83cc..5bb8d63a2 100644 --- a/src/main/org/apache/tools/ant/UnknownElement.java +++ b/src/main/org/apache/tools/ant/UnknownElement.java @@ -269,10 +269,8 @@ public class UnknownElement extends Task { UnknownElement child = (UnknownElement) children.elementAt(i); Object realChild = null; - if (parent instanceof TaskContainer) { - //ProjectComponentHelper helper=ProjectComponentHelper.getProjectComponentHelper(); - //realChild = helper.createProjectComponent( child, getProject(), null, - // child.getTag()); + if (!ih.supportsNestedElement(child.getTag()) + && parent instanceof TaskContainer) { realChild = makeTask(child, childWrapper, false); if (realChild == null) { @@ -296,7 +294,8 @@ public class UnknownElement extends Task { } childWrapper.setProxy(realChild); - if (parent instanceof TaskContainer) { + if (parent instanceof TaskContainer + && realChild instanceof Task) { ((Task) realChild).setRuntimeConfigurableWrapper(childWrapper); }