diff --git a/src/main/org/apache/tools/ant/PropertyHelper.java b/src/main/org/apache/tools/ant/PropertyHelper.java
index 4ab1951f8..5c560a951 100644
--- a/src/main/org/apache/tools/ant/PropertyHelper.java
+++ b/src/main/org/apache/tools/ant/PropertyHelper.java
@@ -57,7 +57,7 @@ import java.util.Enumeration;
*
* @since Ant 1.6
*/
-public class PropertyHelper {
+public class PropertyHelper implements Cloneable {
/**
* Marker interface for a PropertyHelper delegate.
@@ -198,6 +198,7 @@ public class PropertyHelper {
* least for non-dynamic properties)
*
* @param next the next property helper in the chain.
+ * @deprecated
*/
public void setNext(PropertyHelper next) {
this.next = next;
@@ -207,6 +208,7 @@ public class PropertyHelper {
* Get the next property helper in the chain.
*
* @return the next property helper.
+ * @deprecated
*/
public PropertyHelper getNext() {
return next;
@@ -707,7 +709,6 @@ public class PropertyHelper {
* the return value is also null
.
* @return the property value, or null
for no match
* or if a null
name is provided.
- * @deprecated namespaces are unnecessary.
*/
public synchronized Object getUserProperty(String name) {
if (name == null) {
@@ -909,9 +910,10 @@ public class PropertyHelper {
list = new ArrayList();
delegates.put(key, list);
}
- if (!list.contains(delegate)) {
- list.add(0, delegate);
+ if (list.contains(delegate)) {
+ list.remove(delegate);
}
+ list.add(0, delegate);
}
}
@@ -942,4 +944,19 @@ public class PropertyHelper {
}
return result;
}
+
+ /**
+ * Make a clone of this PropertyHelper.
+ * @return the cloned PropertyHelper.
+ * @since Ant 1.8
+ */
+ public Object clone() {
+ PropertyHelper result;
+ try {
+ result = (PropertyHelper) super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new BuildException(e);
+ }
+ return result;
+ }
}