ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject TaskContainer and nested data-types
Date Fri, 08 Nov 2002 12:32:25 GMT

a technical question, for a change 8-)

If you look into ProjectHelperImpl, you'll see

        public void startElement(String name, AttributeList attrs) throws SAXParseException
            if (task instanceof TaskContainer) {
                // task can contain other tasks - no other nested elements possible
                new TaskHandler(helperImpl, this, (TaskContainer) task,
                    wrapper, target).init(name, attrs);

the intention seems to be that TaskContainers are not allowed to hold
data-types.  Now try this build file snippet

      <path id="path">
        <pathelement location="loc1" />

it will work.  The reason is that ProjectHelperImpl inserts a
UnknownElement for <path> and this one replaces itself with the
data-type at runtime.

If you now replace <sequential> with a TaskContainer of your own,
things start to get messy.

      <path id="path">
        <pathelement location="loc1" />

will not work in CVS HEAD at all - because <mycontainer> will become
an UnknownElement itself and the handleChildren code in there doesn't
allow any non-tasks to slip through.

To make things worse, in 1.5.1 it will depend on where you place the
<taskdef> for mycontainer.  If you put it at the top-level in front of
the target containing the snippet above, it will work.  If you place
the taskdef after the target (or inside a target), it will fail.

Before I go and make things consistent, I thought I'd ask you what the
correct behavior would be 8-)

Is 1.5.1 wrong in that it should never allow the construct above to
pass?  If so, the sequential case must not pass either.  Be aware that
changing this may cause some build files to break.

Should data-types be allowed inside TaskContainer?  If so,
UnknownElement needs to get fixed.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message