Skip to content

Commit 32d32ec

Browse files
barreirosebersole
authored andcommitted
HHH-10112 - [enhancer] Use loading classloader in ClassPool
(cherry picked from commit 3f2c785)
1 parent ca46d28 commit 32d32ec

File tree

1 file changed

+8
-2
lines changed
  • hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi

1 file changed

+8
-2
lines changed

hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/Enhancer.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,14 @@ public synchronized byte[] enhance(String className, byte[] originalBytes) throw
9393
}
9494
}
9595

96-
private ClassPool buildClassPool(EnhancementContext enhancementContext) {
97-
final ClassPool classPool = new ClassPool( false );
96+
private ClassPool buildClassPool(final EnhancementContext enhancementContext) {
97+
final ClassPool classPool = new ClassPool( false ) {
98+
@Override
99+
public ClassLoader getClassLoader() {
100+
return enhancementContext.getLoadingClassLoader();
101+
}
102+
};
103+
98104
final ClassLoader loadingClassLoader = enhancementContext.getLoadingClassLoader();
99105
if ( loadingClassLoader != null ) {
100106
classPool.appendClassPath( new LoaderClassPath( loadingClassLoader ) );

0 commit comments

Comments
 (0)