HHH-10112 - [enhancer] Use loading classloader in ClassPool

This commit is contained in:
barreiro 2015-09-25 03:08:55 +01:00
parent 70c9c8e855
commit 3f2c78533e
1 changed files with 8 additions and 2 deletions

View File

@ -93,8 +93,14 @@ public class Enhancer {
}
}
private ClassPool buildClassPool(EnhancementContext enhancementContext) {
final ClassPool classPool = new ClassPool( false );
private ClassPool buildClassPool(final EnhancementContext enhancementContext) {
final ClassPool classPool = new ClassPool( false ) {
@Override
public ClassLoader getClassLoader() {
return enhancementContext.getLoadingClassLoader();
}
};
final ClassLoader loadingClassLoader = enhancementContext.getLoadingClassLoader();
if ( loadingClassLoader != null ) {
classPool.appendClassPath( new LoaderClassPath( loadingClassLoader ) );