Grokbase Groups Ant dev February 2012
Hi all,

for those who don't follow bugzilla comment threads (I know I seldomly

Until Ant 1.8.2 ${} sequences in macrodef attributes were expanded once
before @{} sequences are expanded and once in the context where the @{}
is expanded. I.e. with

<macrodef name="propertycopy">
<attribute name="name"/>
<attribute name="from"/>
<property name="@{name}" value="${@{from}}"/>

<property name="choice" value="2"/>
<property name="thing.1" value="one"/>
<property name="thing.2" value="two"/>
<property name="thing.3" value="three"/>
<propertycopy to="thing" from="thing.${choice}"/>

@{from} becomes thing.2 and the second expansion does what the FAQ says.

Ant's trunk has removed the ${} expansion that happens before @{}
expansion, breaking the example of our own FAQ and breaking some other
existing macrodefs out there (for example in Netbeans).

Double expansion is unexpected and leads to subtle issues:

In particular it made some AntUnit tests pass in Ant's own code base
even though the code was actually broken.

Jesse suggests to introduce an attribute to macrodef (or even at the
granularity of the individual attribute definition of a macrodef) to
control ${} expansion.

I'm not sure whether the macrodef writer will always know whether she
wants double-expansion or not. I also fear it will be quite difficult
to explain in the manual of a macrodefed task ("this attribute may have
${} sequences expanded twice, this other one will not").

Another option would be to not fix the 1.8.2 behavior at all but call it
a feature. Macrodef writers then can say something like "foo is
implemented as a macrodef so ${} will be expanded twice, see - not sure
whether this a good option.

Any other ideas?


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

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 9 | next ›
Discussion Overview
groupdev @
postedFeb 12, '12 at 10:13a
activeFeb 25, '12 at 5:18p

2 users in discussion

Stefan Bodewig: 5 posts Jesse Glick: 4 posts



site design / logo © 2018 Grokbase