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

This commit is contained in:
barreiro 2015-09-25 03:08:55 +01:00 committed by Steve Ebersole
parent cd7212a1e8
commit a11d2e7783
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 ) );