ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Bergbauer" <>
Subject Re: Submission: refid, CompositeType, NestedDataType
Date Fri, 13 Oct 2000 14:08:20 GMT
> Stefan
> But there may be a situation where you want to hand DataType a
> different project than the current one - if we made subproject inherit
> references from the parent project for example.
If a subproject inherits any attribute from its parent, it obviously needs to have a link
to its parent, but tasks
and DataTypes associated with that subproject still know only one project.
Since only one project is active at a time, (if we go towards multiple threads, one project
per thread is active),
Project.getCurrent() will still be sufficient.
If tasks lost their project field and rely on the current project instead, you might think
that the Ant task would have
a problem, but since it creates the new project itself, it can easily cache the original project:

public class Ant extends Task {
    private Project parentProject = Project.getCurrent();
   public void init() {
       // we now  have a new current project

       // Of course it would be simpler to write:
       //     Project p = Project.create();
       //     p.setJavaVersionProperty();
       //     p.addTaskDefinition("property", 
       //                                     (Class)parentProject.getTaskDefinitions().get("property"));
       // But this is for illustration purpose.

  // Any other method can use parentProject and Project.getCurrent()

Now, if we ever came up with a DataType that needs to be aware of more than one Project,
it could have a custom constructor, or a custom initialization method.

Obviously, you can still achieve the functionalities I implemented by passing a Project parameter
in every method,
but I was trying to keep the common case simple.

> Stefan
> This shouldn't happen too much anymore. The main reason why I asked
> you to wait until 1.2 has been released is that we want to have the
> release really soon (read in the next two weeks) and need to spend
> some time in "bugfix and documentation only" mode before that.
Good, I 'll wait until 1.2 is released, then I'll resubmit an evolution of my changes. By
then you will have been warned
of the pain and suffering my submissions can inflict...


Do You Yahoo!?
Get your free address at

View raw message