ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: Test Failures
Date Mon, 07 Jul 2003 08:27:29 GMT
I think in general it is not a good idea.

The code in question is:
in Target#execute
                Iterator it = children.iterator();
                Object o = it.next();
                if (o instanceof Task) {
                    Task task = (Task) o;
                    task.perform();
                } else {
                    RuntimeConfigurable r = (RuntimeConfigurable) o;
                    r.maybeConfigure(project);
                }

This was:
            Enumeration enum = children.elements();
            while (enum.hasMoreElements()) {
                Object o = enum.nextElement();
                if (o instanceof Task) {
                    Task task = (Task) o;
                    task.perform();
                } else {
                    RuntimeConfigurable r = (RuntimeConfigurable) o;
                    r.maybeConfigure(project);
                }

The first picks up the fact that children has been modified
while it is being iterated, and the second does not. (See
src.zip/../Vector#elements()).

I am not sure that that depending on an undocumented (I think)
feature of Vector/Enumeration is a good idea. So to support this feature
one would have to modify the way the task list of a target is
visitied.

Peter.

On Mon, 2003-07-07 at 08:37, Stefan Bodewig wrote:
> On 04 Jul 2003, peter reilly <peter.reilly@corvil.com> wrote:
> 
> > The test code in question was inserting tasks
> > into the current target, and this does not
> > seem to be a good idea.
> 
> In general or just after the code change?
> 
> If we agree that adding tasks to the current target is no good idea in
> general (I'm not sure), we should document it - otherwise it might be
> better to revert that part of the Target changes as well as your
> changes to the test and fix the situation.
> 
> Stefan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message