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:
parent
606cc34049
commit
0f881d7cf2
|
@ -126,6 +126,9 @@ public abstract class EnhancerTestUtils extends BaseUnitTestCase {
|
||||||
|
|
||||||
private static ClassLoader getEnhancerClassLoader(final EnhancementContext context, final String packageName) {
|
private static ClassLoader getEnhancerClassLoader(final EnhancementContext context, final String packageName) {
|
||||||
return new ClassLoader() {
|
return new ClassLoader() {
|
||||||
|
private Enhancer enhancer = new Enhancer( context );
|
||||||
|
|
||||||
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
@Override
|
@Override
|
||||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||||
if ( !name.startsWith( packageName ) ) {
|
if ( !name.startsWith( packageName ) ) {
|
||||||
|
@ -145,7 +148,7 @@ public abstract class EnhancerTestUtils extends BaseUnitTestCase {
|
||||||
byte[] original = new byte[is.available()];
|
byte[] original = new byte[is.available()];
|
||||||
new BufferedInputStream( is ).read( original );
|
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" );
|
File f = new File( workingDir + File.separator + name.replace( ".", File.separator ) + ".class" );
|
||||||
f.getParentFile().mkdirs();
|
f.getParentFile().mkdirs();
|
||||||
|
|
Loading…
Reference in New Issue