Browse Source

Performance:

if a task does not have an id, do not bother
  to replace the unknownelement in the tasks list of the target


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@448382 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 19 years ago
parent
commit
e028c28100
2 changed files with 21 additions and 5 deletions
  1. +15
    -2
      src/main/org/apache/tools/ant/RuntimeConfigurable.java
  2. +6
    -3
      src/main/org/apache/tools/ant/UnknownElement.java

+ 15
- 2
src/main/org/apache/tools/ant/RuntimeConfigurable.java View File

@@ -85,6 +85,9 @@ public class RuntimeConfigurable implements Serializable {
/** the polymorphic type */
private String polyType = null;

/** the "id" of this Element if it has one */
private String id = null;

/**
* Sole constructor creating a wrapper for the specified object.
*
@@ -130,6 +133,14 @@ public class RuntimeConfigurable implements Serializable {
return wrappedObject;
}

/**
* Returns the id for this element.
* @return the id.
*/
public synchronized String getId() {
return id;
}

/**
* Get the polymorphic type for this element.
* @return the ant component type name, null if not set.
@@ -176,6 +187,9 @@ public class RuntimeConfigurable implements Serializable {
}
attributeNames.add(name);
attributeMap.put(name, value);
if (name.equals("id")) {
this.id = value;
}
}
}

@@ -346,11 +360,11 @@ public class RuntimeConfigurable implements Serializable {
*/
public synchronized void maybeConfigure(Project p, boolean configureChildren)
throws BuildException {
String id = null;

if (proxyConfigured) {
return;
}

// Configure the object
Object target = (wrappedObject instanceof TypeAdapter)
? ((TypeAdapter) wrappedObject).getProxy() : wrappedObject;
@@ -388,7 +402,6 @@ public class RuntimeConfigurable implements Serializable {
}
}
}
id = (String) attributeMap.get("id");
}

if (characters != null) {


+ 6
- 3
src/main/org/apache/tools/ant/UnknownElement.java View File

@@ -175,10 +175,13 @@ public class UnknownElement extends Task {

task.setRuntimeConfigurableWrapper(getWrapper());

// For Script to work. Ugly
// For Script example that modifies id'ed tasks in other
// targets to work. *very* Ugly
// The reference is replaced by RuntimeConfigurable
this.getOwningTarget().replaceChild(this, (Task) realThing);
}
if (getWrapper().getId() != null) {
this.getOwningTarget().replaceChild(this, (Task) realThing);
}
}

handleChildren(realThing, getWrapper());



Loading…
Cancel
Save