You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2005/05/30 12:04:42 UTC
cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs MacroDefTest.java
peterreilly 2005/05/30 03:04:42
Modified: . WHATSNEW
src/main/org/apache/tools/ant/taskdefs MacroDef.java
src/etc/testcases/taskdefs macrodef.xml
src/testcases/org/apache/tools/ant/taskdefs
MacroDefTest.java
Log:
* <macrodef> with redefined default values was incorrect. (Fix for
31215 had a bug). Bugzilla report 35109.
PR: 35109
Revision Changes Path
1.835 +15 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.834
retrieving revision 1.835
diff -u -r1.834 -r1.835
--- WHATSNEW 26 May 2005 17:04:47 -0000 1.834
+++ WHATSNEW 30 May 2005 10:04:41 -0000 1.835
@@ -233,6 +233,21 @@
* Try to make subprojects of custom Project subclasses instances of the
same type. Bugzilla report 17901.
+Changes from Ant 1.6.4 to current Ant 1.6 CVS version
+=====================================================
+
+Changes that could break older environments:
+--------------------------------------------
+
+Fixed bugs:
+-----------
+
+* <move> was unable to replace existing files or write into
+ existing directories. Bugzilla report 34962.
+
+* <macrodef> with redefined default values was incorrect. (Fix for
+ 31215 had a bug). Bugzilla report 35109.
+
Changes from Ant 1.6.3 to Ant 1.6.4
===================================
1.33 +26 -4 ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java
Index: MacroDef.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- MacroDef.java 21 Apr 2005 09:49:55 -0000 1.32
+++ MacroDef.java 30 May 2005 10:04:42 -0000 1.33
@@ -715,13 +715,14 @@
}
/**
- * similar equality method for macrodef, ignores project and
+ * same or similar equality method for macrodef, ignores project and
* runtime info.
*
* @param obj an <code>Object</code> value
+ * @param same if true test for sameness, otherwise just similiar
* @return a <code>boolean</code> value
*/
- public boolean similar(Object obj) {
+ private boolean sameOrSimilar(Object obj, boolean same) {
if (obj == this) {
return true;
}
@@ -742,7 +743,8 @@
// Allow two macro definitions with the same location
// to be treated as similar - bugzilla 31215
if (other.getLocation() != null
- && other.getLocation().equals(getLocation())) {
+ && other.getLocation().equals(getLocation())
+ && !same) {
return true;
}
if (text == null) {
@@ -779,6 +781,26 @@
}
/**
+ * Similar method for this definition
+ *
+ * @param obj another definition
+ * @return true if the definitions are similar
+ */
+ public boolean similar(Object obj) {
+ return sameOrSimilar(obj, false);
+ }
+
+ /**
+ * Equality method for this definition
+ *
+ * @param obj another definition
+ * @return true if the definitions are the same
+ */
+ public boolean sameDefinition(Object obj) {
+ return sameOrSimilar(obj, true);
+ }
+
+ /**
* extends AntTypeDefinition, on create
* of the object, the template macro definition
* is given.
@@ -822,7 +844,7 @@
return false;
}
MyAntTypeDefinition otherDef = (MyAntTypeDefinition) other;
- return macroDef.similar(otherDef.macroDef);
+ return macroDef.sameDefinition(otherDef.macroDef);
}
/**
1.14 +17 -0 ant/src/etc/testcases/taskdefs/macrodef.xml
Index: macrodef.xml
===================================================================
RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/macrodef.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- macrodef.xml 21 Apr 2005 09:49:55 -0000 1.13
+++ macrodef.xml 30 May 2005 10:04:42 -0000 1.14
@@ -220,7 +220,24 @@
<explicit/>
</sequential>
</macrodef>
+ </target>
+
+ <property name="default.override" value="old"/>
+ <macrodef name="simple.override">
+ <attribute name="attr" default="${default.override}"/>
+ <sequential>
+ <echo>value is @{attr}</echo>
+ </sequential>
+ </macrodef>
+
+ <target name="override.default">
+ <antcall target="override.call">
+ <param name="default.override" value="new"/>
+ </antcall>
+ </target>
+ <target name="override.call">
+ <simple.override/>
</target>
<target name="backtraceoff">
1.20 +5 -0 ant/src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java
Index: MacroDefTest.java
===================================================================
RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- MacroDefTest.java 25 Apr 2005 07:49:49 -0000 1.19
+++ MacroDefTest.java 30 May 2005 10:04:42 -0000 1.20
@@ -109,6 +109,11 @@
"attribute.description",
"description is hello world");
}
+ public void testOverrideDefault() {
+ expectLog(
+ "override.default",
+ "value is new");
+ }
public void testImplicit() {
expectLog(
"implicit", "Before implicitIn implicitAfter implicit");
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org