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

(cherry picked from commit b3aaa12b64)
This commit is contained in:
barreiro 2016-07-22 03:23:24 +01:00 committed by Gail Badner
parent a41242fcef
commit 788f0dd3cd
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 {
@ -146,7 +149,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();