diff --git a/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/EnhancerTestUtils.java b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/EnhancerTestUtils.java index d9a7890123..474b0530ae 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/EnhancerTestUtils.java +++ b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/EnhancerTestUtils.java @@ -126,6 +126,9 @@ public abstract class EnhancerTestUtils extends BaseUnitTestCase { private static ClassLoader getEnhancerClassLoader(final EnhancementContext context, final String packageName) { return new ClassLoader() { + private Enhancer enhancer = new Enhancer( context ); + + @SuppressWarnings("ResultOfMethodCallIgnored") @Override public Class loadClass(String name) throws ClassNotFoundException { if ( !name.startsWith( packageName ) ) { @@ -145,7 +148,7 @@ public abstract class EnhancerTestUtils extends BaseUnitTestCase { byte[] original = new byte[is.available()]; new BufferedInputStream( is ).read( original ); - byte[] enhanced = new Enhancer( context ).enhance( name, original ); + byte[] enhanced = enhancer.enhance( name, original ); File f = new File( workingDir + File.separator + name.replace( ".", File.separator ) + ".class" ); f.getParentFile().mkdirs();