Browse Source

move same definition to AntTypeDefinition

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275099 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 22 years ago
parent
commit
6f6769834a
2 changed files with 23 additions and 11 deletions
  1. +22
    -2
      src/main/org/apache/tools/ant/AntTypeDefinition.java
  2. +1
    -9
      src/main/org/apache/tools/ant/ComponentHelper.java

+ 22
- 2
src/main/org/apache/tools/ant/AntTypeDefinition.java View File

@@ -54,6 +54,7 @@

package org.apache.tools.ant;


/**
* This class contains all the information
* on a particular ant type,
@@ -217,7 +218,7 @@ public class AntTypeDefinition {
* @return the created object
*/
public Object create(Project project) {
return icreate(project);
return icreate(project);
}

/**
@@ -326,5 +327,24 @@ public class AntTypeDefinition {
"Could not create type " + name + " due to " + t, t);
}
}
}

/**
* Equality method for this definition
*
* @param other another definition
* @param project the project the definition
* @return true if the definitions are the same
*/
public boolean sameDefinition(AntTypeDefinition other, Project project) {
if (other == null) {
return false;
}
if (other.getClass() != this.getClass()) {
return false;
}
if (!(other.getTypeClass(project).equals(getTypeClass(project)))) {
return false;
}
return other.getExposedClass(project).equals(getExposedClass(project));
}
}

+ 1
- 9
src/main/org/apache/tools/ant/ComponentHelper.java View File

@@ -651,15 +651,7 @@ public class ComponentHelper {
if (!validDefinition(def) || !validDefinition(old)) {
return validDefinition(def) == validDefinition(old);
}

if (!(old.getTypeClass(project).equals(def.getTypeClass(project)))) {
return false;
}
if (!(old.getExposedClass(project).equals(
def.getExposedClass(project)))) {
return false;
}
return true;
return def.sameDefinition(old, project);
}




Loading…
Cancel
Save