diff --git a/src/main/org/apache/tools/ant/AntClassLoader.java b/src/main/org/apache/tools/ant/AntClassLoader.java
index 2748865ae..f9dc88dd6 100644
--- a/src/main/org/apache/tools/ant/AntClassLoader.java
+++ b/src/main/org/apache/tools/ant/AntClassLoader.java
@@ -70,7 +70,7 @@ import org.apache.tools.ant.types.Path;
* @author Conor MacNeill
* @author Jesse Glick
*/
-public class AntClassLoader extends ClassLoader {
+public class AntClassLoader extends ClassLoader implements BuildListener {
/**
* An enumeration of all resources of a given name found within the
@@ -228,6 +228,7 @@ public class AntClassLoader extends ClassLoader {
*/
public AntClassLoader(Project project, Path classpath) {
this.project = project;
+ this.project.addBuildListener(this);
this.classpath = classpath.concatSystemClasspath("ignore");
}
@@ -839,4 +840,26 @@ public class AntClassLoader extends ClassLoader {
return base.loadClass(name);
}
}
+
+ public void buildStarted(BuildEvent event) {}
+
+ public void buildFinished(BuildEvent event) {
+ classpath = null;
+ project = null;
+ }
+
+ public void targetStarted(BuildEvent event) {
+ }
+
+ public void targetFinished(BuildEvent event) {
+ }
+
+ public void taskStarted(BuildEvent event) {
+ }
+
+ public void taskFinished(BuildEvent event) {
+ }
+
+ public void messageLogged(BuildEvent event) {
+ }
}
diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java
index bc99c4a4f..5a3dfd0bb 100644
--- a/src/main/org/apache/tools/ant/IntrospectionHelper.java
+++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java
@@ -68,7 +68,7 @@ import java.util.*;
*
* @author Stefan Bodewig
*/
-public class IntrospectionHelper {
+public class IntrospectionHelper implements BuildListener {
/**
* holds the types of the attributes that could be set.
@@ -552,4 +552,20 @@ public class IntrospectionHelper {
throws InvocationTargetException, IllegalAccessException,
BuildException;
}
+
+ public void buildStarted(BuildEvent event) {}
+ public void buildFinished(BuildEvent event) {
+ attributeTypes.clear();
+ attributeSetters.clear();
+ nestedTypes.clear();
+ nestedCreators.clear();
+ addText = null;
+ helpers.clear();
+ }
+
+ public void targetStarted(BuildEvent event) {}
+ public void targetFinished(BuildEvent event) {}
+ public void taskStarted(BuildEvent event) {}
+ public void taskFinished(BuildEvent event) {}
+ public void messageLogged(BuildEvent event) {}
}
diff --git a/src/main/org/apache/tools/ant/ProjectHelper.java b/src/main/org/apache/tools/ant/ProjectHelper.java
index 02ecdfba6..62bfb2b50 100644
--- a/src/main/org/apache/tools/ant/ProjectHelper.java
+++ b/src/main/org/apache/tools/ant/ProjectHelper.java
@@ -628,6 +628,8 @@ public class ProjectHelper {
IntrospectionHelper ih =
IntrospectionHelper.getHelper(target.getClass());
+ project.addBuildListener(ih);
+
for (int i = 0; i < attrs.getLength(); i++) {
// reflect these into the target
String value=replaceProperties(project, attrs.getValue(i),