HHH-10977 - Fix enhanced classloader so that the testsuite behaves as the enhancement plugins do

(cherry picked from commit b3aaa12b64)

Conflicts:
	hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/EnhancerTestUtils.java
This commit is contained in:
barreiro 2016-07-22 03:23:24 +01:00 committed by Gail Badner
parent 606cc34049
commit 0f881d7cf2
1 changed files with 4 additions and 1 deletions

View File

@ -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();