ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mariusz Nowostawski <>
Subject [patch] on immutable properties
Date Sun, 23 Jul 2000 04:13:46 GMT
I really understand the reasons why properties are desired to be
immutable, however, sometimes it makes people upset, when they are forced
to use patterns which they do not like.  The proposed patch does not
change anything within the standard behaviour of properties, they are
immutable by default. But.. the user can override the default behaviour,
by new, introduced attribute 'final' (in analogy to final variables in
Java). If attribute final is "off", "false", "not", or "0", the property
will behave exactly like in ANT 1.0.8.

<property name="cpath" value="${ext.dir}/OB.jar" final="off" />
<property name="cpath" value="${cpath}:${ext.dir}/jndi.jar" final="off" />
<property name="cpath" value="${cpath}:${ext.dir}/gnu-regexp.jar" final="off"/>
<property name="cpath" value="${cpath}:${ext.dir}/myutil.jar" final="off"/> 
<property name="cpath" value="${cpath}:${ext.dir}/myother.jar" final="off"/>

will work as in ANT 1.0.8, but if you add another line:

<property name="cpath" value="myallinone.jar" />

you will get:

$ ant
Buildfile: build.xml
 [property] Override ignored for cpath with myallinone.jar

The patch also changes ignoring overriding from being silent in normal ant
mode to being explicitly reported. I think not setting property because of
immutability should be reported to the user even if ant is invoked not in
verbose mode.  
The keyword 'final' is a little abused here, because it does not really
work as in Java, while it referes to the previously declared property not
to the current one.. any suggestions for better attribute name ;o)  ?
I think it should be left to the user, whether he wants to mess up with
his properties, or not...

best regards

View raw message