ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Property vs. user property - what's the difference?
Date Thu, 16 Feb 2006 16:52:09 GMT
I once researched this... I think what happened was
just that the author of <available> used the wrong
method call.  I can say this without sounding too
terrible because I did it once myself in Ant's code,
except that my mistake was discovered soon enough to
avoid compromising the API.  Regarding <available>,
backward compatibility being taken as seriously as it
is in Ant, the decision was made to let the error
stand rather than break builds in the wild which
depended on this behavior.  If I have told this story
incorrectly I'm sure one of the older hands will
correct me.  :)

-Matt

--- Patrick Martin <antuser@gmail.com> wrote:

> Thanks a lot for this very useful and clear
> information.
> I am surprised to read that <available> can override
> properties. Is
> there a reason for it?
> Patrick M.
> 
> On 2/16/06, Stefan Bodewig <bodewig@apache.org>
> wrote:
> > On Wed, 15 Feb 2006, Patrick Martin
> <antuser@gmail.com> wrote:
> >
> > > Could you explain the "even more immutable" part
> of your mail ?
> >
> > Sure.
> >
> > Properties are not immutable at all if you use
> Ant's Java API.  It's
> > just that (almost[1]) all of the built-in Ant
> tasks refuse to change
> > the value of an existing property.  But it is
> trivial to write a task
> > that changes the value of a property and in fact a
> lot of people and
> > projects have done so.
> >
> > There are five property setting methods in Ant's
> Project class:
> >
> > setNewProperty        - sets a property, will
> never override an
> >                         existing one - user
> property or not.
> >                         Used by almost all
> built-in Ant tasks.
> > setProperty           - sets or overrides a
> property, will never override
> >                         a user property.  Used by
> <available>.
> > setPropertyInternal   - same as setProperty but
> without any warning if
> >                         it overrides a property.
> > setUserProperty       - sets or overrides a user
> property.  Used when
> >                         parsing the command line.
> > setInheritedProperty  - sets or overrides a user
> property.  Used for
> >                         <property> nested in Ant.
> >
> > So both "plain properties" and "user properties"
> are in fact mutable
> > if you use the Ant API.  Only one of the five
> setter methods will not
> > overwrite an existing property, only two of them
> will overwrite an
> > existing user property - which makes user
> properties "more immutable".
> >
> > Stefan
> >
> > Footnotes:
> > [1]  Since I know I'll have to explain the
> "almost", <available> will
> >      happily overwrite existing properties.
> >
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> user-help@ant.apache.org
> >
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Mime
View raw message