ASF Bugzilla – Attachment 12728 Details for
Bug 31215
same macrodef causes "Trying to override task definition"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
possible patch of the problem
31215.patch (text/plain), 4.43 KB, created by
David Konecny
on 2004-09-14 11:09:47 UTC
(
hide
)
Description:
possible patch of the problem
Filename:
MIME Type:
Creator:
David Konecny
Created:
2004-09-14 11:09:47 UTC
Size:
4.43 KB
patch
obsolete
>diff -r -u D:\ant\apache-ant-1.6.2\src\main/org/apache/tools/ant/AntTypeDefinition.java D:\ant\src\main/org/apache/tools/ant/AntTypeDefinition.java >--- D:\ant\apache-ant-1.6.2\src\main/org/apache/tools/ant/AntTypeDefinition.java Fri Jul 16 07:57:30 2004 >+++ D:\ant\src\main/org/apache/tools/ant/AntTypeDefinition.java Tue Sep 14 09:29:19 2004 >@@ -355,10 +355,11 @@ > return > newLoader != null > && oldLoader != null >- && oldLoader instanceof AntClassLoader >+ && ((oldLoader instanceof AntClassLoader > && newLoader instanceof AntClassLoader > && ((AntClassLoader) oldLoader).getClasspath() >- .equals(((AntClassLoader) newLoader).getClasspath()); >+ .equals(((AntClassLoader) newLoader).getClasspath())) || >+ (newLoader == oldLoader)); > } > > private String extractClassname(Class c) { >diff -r -u D:\ant\apache-ant-1.6.2\src\main/org/apache/tools/ant/taskdefs/MacroDef.java D:\ant\src\main/org/apache/tools/ant/taskdefs/MacroDef.java >--- D:\ant\apache-ant-1.6.2\src\main/org/apache/tools/ant/taskdefs/MacroDef.java Fri Jul 16 07:57:34 2004 >+++ D:\ant\src\main/org/apache/tools/ant/taskdefs/MacroDef.java Tue Sep 14 09:51:54 2004 >@@ -359,6 +359,26 @@ > * @return a <code>boolean</code> value > */ > public boolean equals(Object obj) { >+ if (!similar(obj)) { >+ return false; >+ } >+ Attribute other = (Attribute) obj; >+ if (defaultValue == null) { >+ if (other.defaultValue != null) { >+ return false; >+ } >+ } else if (!defaultValue.equals(other.defaultValue)) { >+ return false; >+ } >+ return true; >+ } >+ >+ /** >+ * Check attributes similarity. Only difference from {@link #equals} >+ * method is that default value of the attribute is ignored and is >+ * tested only for presence. >+ */ >+ public boolean similar(Object obj) { > if (obj == null) { > return false; > } >@@ -377,7 +397,7 @@ > if (other.defaultValue != null) { > return false; > } >- } else if (!defaultValue.equals(other.defaultValue)) { >+ } else if (other.defaultValue == null) { > return false; > } > return true; >@@ -628,6 +648,17 @@ > * @param obj an <code>Object</code> value > * @return a <code>boolean</code> value > */ >+ public boolean same(Object obj) { >+ if (!similar(obj)) { >+ return false; >+ } >+ MacroDef other = (MacroDef) obj; >+ if (!attributes.equals(other.attributes)) { >+ return false; >+ } >+ return true; >+ } >+ > public boolean similar(Object obj) { > if (obj == this) { > return true; >@@ -670,7 +701,7 @@ > if (!nestedSequential.similar(other.nestedSequential)) { > return false; > } >- if (!attributes.equals(other.attributes)) { >+ if (!areAttributesSimilar(other.attributes)) { > return false; > } > if (!elements.equals(other.elements)) { >@@ -678,6 +709,28 @@ > } > return true; > } >+ >+ private boolean areAttributesSimilar(List otherAttributes) { >+ if (attributes == otherAttributes) { >+ return true; >+ } >+ >+ Iterator e1 = attributes.iterator(); >+ Iterator e2 = otherAttributes.iterator(); >+ while(e1.hasNext() && e2.hasNext()) { >+ Object o1 = e1.next(); >+ Object o2 = e2.next(); >+ if (!(o1 instanceof Attribute) || !(o2 instanceof Attribute)) { >+ return false; >+ } >+ Attribute a1 = (Attribute)o1; >+ Attribute a2 = (Attribute)o2; >+ if (!a1.similar(a2)) { >+ return false; >+ } >+ } >+ return !(e1.hasNext() || e2.hasNext()); >+ } > > /** > * extends AntTypeDefinition, on create >@@ -723,7 +776,7 @@ > return false; > } > MyAntTypeDefinition otherDef = (MyAntTypeDefinition) other; >- return macroDef.similar(otherDef.macroDef); >+ return macroDef.same(otherDef.macroDef); > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 31215
:
12727
| 12728