Menu

#1208 ClassLoader for generated bytecode

v9.4
open
Internals (8)
5
2012-10-08
2012-01-26
Michael Kay
No

When Saxon-EE generates bytecode, it loads the generated classes using a custom ClassLoader whose parent ClassLoader is obtained using getClass().getClassLoader(). In some circumstances this parent ClassLoader can subsequently be invoked for loading resources such as extension functions referenced by the generated bytecode. In an environment with specialized class loading requirements, this may be inadequate, and it may be preferable to use the context class loader for the thread instead. A patch is being raised whose effect is to choose which ever of the following first produces a result:

(a) the user-defined ClassLoader registered with configuration.getDynamicLoader().setClassLoader()

(b) the result of Thread.currentThread().getContextClassLoader()

(c) the result of getClass().getClassLoader()

This is consistent with the strategy Saxon generally uses for dynamic loading of classes.

Discussion