ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Murdoch" <adammurdoch...@yahoo.com>
Subject [PATCH] build listener class loading
Date Sun, 30 Dec 2001 00:01:33 GMT

Hi,

This patch fixes an odd class loading problem, where the classes used by a
BuildListener's buildFinished() method cannot be loaded.  This is how the
problem happens:

- The task is loaded via an AntClassLoader (e.g. using <taskdef> with a
classpath specified).

- The AntClassLoader adds a BuildListener to the project, so that it can
clean up when the build finishes.

- When the task executes, it adds a BuildListener to its project.

- The build finishes, and a build finished event is fired.

- The AntClassLoader's buildFinished() method is called.  The class loader
cleans itself up.

- The task's buildFinished() method is called.  If this method uses classes
which have not been loaded, the AntClassLoader's findClass() method is
called.

- The AntClassLoader is in an unusable state, and a NPE is thrown.

This patch defers AntClassLoader (and IntrospectionHelper) cleanup until
after the build finished event has been handled by all build listeners.


Adam

Mime
View raw message