HHH-12610 Upgrade to Byte Buddy 1.8.11 to improve JDK compatibility
This commit is contained in:
parent
89305c994e
commit
2d55060ff6
|
@ -22,7 +22,7 @@ ext {
|
||||||
weldVersion = '3.0.0.Final'
|
weldVersion = '3.0.0.Final'
|
||||||
|
|
||||||
javassistVersion = '3.22.0-GA'
|
javassistVersion = '3.22.0-GA'
|
||||||
byteBuddyVersion = '1.8.0' // Now with JDK10 compatibility and preliminary support for JDK11
|
byteBuddyVersion = '1.8.11' // Now with JDK10 compatibility and preliminary support for JDK11
|
||||||
|
|
||||||
geolatteVersion = '1.3.0'
|
geolatteVersion = '1.3.0'
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class BasicProxyFactoryImpl implements BasicProxyFactory {
|
||||||
.implement( ProxyConfiguration.class )
|
.implement( ProxyConfiguration.class )
|
||||||
.intercept( FieldAccessor.ofField( ProxyConfiguration.INTERCEPTOR_FIELD_NAME ).withAssigner( Assigner.DEFAULT, Assigner.Typing.DYNAMIC ) )
|
.intercept( FieldAccessor.ofField( ProxyConfiguration.INTERCEPTOR_FIELD_NAME ).withAssigner( Assigner.DEFAULT, Assigner.Typing.DYNAMIC ) )
|
||||||
.make()
|
.make()
|
||||||
.load( BasicProxyFactory.class.getClassLoader() )
|
.load( BasicProxyFactory.class.getClassLoader(), ByteBuddyState.getLoadingStrategy() )
|
||||||
.getLoaded();
|
.getLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ package org.hibernate.bytecode.internal.bytebuddy;
|
||||||
|
|
||||||
import net.bytebuddy.ByteBuddy;
|
import net.bytebuddy.ByteBuddy;
|
||||||
import net.bytebuddy.TypeCache;
|
import net.bytebuddy.TypeCache;
|
||||||
|
import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
|
||||||
import net.bytebuddy.dynamic.scaffold.TypeValidation;
|
import net.bytebuddy.dynamic.scaffold.TypeValidation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,6 +24,11 @@ public final class ByteBuddyState {
|
||||||
*/
|
*/
|
||||||
private static final ByteBuddy buddy = new ByteBuddy().with( TypeValidation.DISABLED );
|
private static final ByteBuddy buddy = new ByteBuddy().with( TypeValidation.DISABLED );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This will need to change depending on the runtime JDK.
|
||||||
|
*/
|
||||||
|
private static final ClassLoadingStrategy loadingStrategy = new ClassLoadingStrategy.ForUnsafeInjection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This currently needs to be static: the BytecodeProvider is a static field of Environment and
|
* This currently needs to be static: the BytecodeProvider is a static field of Environment and
|
||||||
* is being accessed from static methods.
|
* is being accessed from static methods.
|
||||||
|
@ -75,4 +81,8 @@ public final class ByteBuddyState {
|
||||||
return buddy;
|
return buddy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ClassLoadingStrategy getLoadingStrategy() {
|
||||||
|
return loadingStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class BytecodeProviderImpl implements BytecodeProvider {
|
||||||
.method( newInstanceMethodName )
|
.method( newInstanceMethodName )
|
||||||
.intercept( MethodCall.construct( constructor ) )
|
.intercept( MethodCall.construct( constructor ) )
|
||||||
.make()
|
.make()
|
||||||
.load( clazz.getClassLoader() )
|
.load( clazz.getClassLoader(), ByteBuddyState.getLoadingStrategy() )
|
||||||
.getLoaded();
|
.getLoaded();
|
||||||
|
|
||||||
final Class bulkAccessor = bytebuddy.getCurrentyByteBuddy()
|
final Class bulkAccessor = bytebuddy.getCurrentyByteBuddy()
|
||||||
|
@ -80,7 +80,7 @@ public class BytecodeProviderImpl implements BytecodeProvider {
|
||||||
.method( getPropertyNamesMethodName )
|
.method( getPropertyNamesMethodName )
|
||||||
.intercept( MethodCall.call( new CloningPropertyCall( getterNames ) ) )
|
.intercept( MethodCall.call( new CloningPropertyCall( getterNames ) ) )
|
||||||
.make()
|
.make()
|
||||||
.load( clazz.getClassLoader() )
|
.load( clazz.getClassLoader(), ByteBuddyState.getLoadingStrategy() )
|
||||||
.getLoaded();
|
.getLoaded();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class ByteBuddyProxyFactory implements ProxyFactory, Serializable {
|
||||||
.implement( ProxyConfiguration.class )
|
.implement( ProxyConfiguration.class )
|
||||||
.intercept( FieldAccessor.ofField( ProxyConfiguration.INTERCEPTOR_FIELD_NAME ).withAssigner( Assigner.DEFAULT, Assigner.Typing.DYNAMIC ) )
|
.intercept( FieldAccessor.ofField( ProxyConfiguration.INTERCEPTOR_FIELD_NAME ).withAssigner( Assigner.DEFAULT, Assigner.Typing.DYNAMIC ) )
|
||||||
.make()
|
.make()
|
||||||
.load( persistentClass.getClassLoader() )
|
.load( persistentClass.getClassLoader(), ByteBuddyState.getLoadingStrategy() )
|
||||||
.getLoaded(), cacheForProxies );
|
.getLoaded(), cacheForProxies );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue