bodewig 01/12/06 23:16:56
Modified: . WHATSNEW
src/main/org/apache/tools/ant Project.java
src/main/org/apache/tools/ant/taskdefs Available.java
Log:
Don't punish people who want to modify the values of existing
properties in tasks of their own.
Revision Changes Path
1.187 +4 -4 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -r1.186 -r1.187
--- WHATSNEW 2001/12/06 18:31:39 1.186
+++ WHATSNEW 2001/12/07 07:16:56 1.187
@@ -16,10 +16,10 @@
represents a directory. Support for nested filesets is provided
instead.
-* Some loopholes in the immutability rule have been closed. It is no longer
- possible to overwrite a property using tasks like <checksum>, <condition>,
- <exec>, <pathconvert>, or <tstamp>. In some exceptional cases it will
- generate a warning if you attempt to subvert property immutability.
+* It is no longer possible to overwrite a property using tasks like
+ <condition>, <exec>, <pathconvert>, or <tstamp>. In some exceptional
+ cases it will generate a warning if you attempt to overwrite an
+ existing property.
* Taskwriters please note: Whenever tasks had any overloaded set* methods,
Ant's introspection mechanism would select the last overloaded method
1.84 +4 -10 jakarta-ant/src/main/org/apache/tools/ant/Project.java
Index: Project.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- Project.java 2001/12/06 09:11:16 1.83
+++ Project.java 2001/12/07 07:16:56 1.84
@@ -298,10 +298,8 @@
/**
* set a property. Any existing property of the same name
* is overwritten, unless it is a user property.
- * <i>the immutability policy is not implemented at this level</i>
* @param name name of property
* @param value new value of the property
- * @deprecated use, set setNewProperty
*/
public void setProperty(String name, String value) {
// command line properties take precedence
@@ -311,10 +309,8 @@
}
if (null != properties.get(name)) {
- log("DEPRECATED - Project.setProperty('" + name + "','" + value
+ "') used " +
- "to overide an immutable property. Task writer should use
Project.setNewProperty() " +
- "instead and the build writer should not reuse the same
property name for " +
- "different values.");
+ log("Overriding previous definition of property " + name,
+ MSG_VERBOSE);
}
log("Setting project property: " + name + " -> " +
@@ -323,15 +319,13 @@
}
/**
- * set a property. Any existing property of the same name
- * is overwritten, unless it is a user property.
- * <i>the immutability policy <b>is</b> enforced at this level</i>
+ * set a property. An existing property of the same name
+ * will not be overwritten.
* @param name name of property
* @param value new value of the property
* @since 1.5
*/
public void setNewProperty(String name, String value) {
- // command line properties take precedence
if (null != properties.get(name)) {
log("Override ignored for property " + name, MSG_VERBOSE);
return;
1.30 +7 -0
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Available.java
Index: Available.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Available.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Available.java 2001/12/05 01:15:57 1.29
+++ Available.java 2001/12/07 07:16:56 1.30
@@ -156,6 +156,13 @@
}
if (eval()) {
+ String lSep = System.getProperty("line.separator");
+ if (null != project.getProperty(property)) {
+ log("DEPRECATED - <available> used to overide an existing
property. "
+ + lSep
+ + " Build writer should not reuse the same property name
for "
+ + lSep + "different values.");
+ }
this.project.setProperty(property, value);
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>