HHH-17596 Use new Byte Buddy API

Update code to replace deprecated Byte Buddy code
with replacement.
This commit is contained in:
Philippe Marschall 2023-12-28 13:47:24 +01:00 committed by Christian Beikov
parent 6941ddd58c
commit e6c106f527
1 changed files with 3 additions and 2 deletions

View File

@ -41,6 +41,7 @@ public class ByteBuddyProxyHelper implements Serializable {
private static final CoreMessageLogger LOG = messageLogger( ByteBuddyProxyHelper.class );
private static final String PROXY_NAMING_SUFFIX = "HibernateProxy";
private static final TypeDescription OBJECT = TypeDescription.ForLoadedType.of(Object.class);
private final ByteBuddyState byteBuddyState;
@ -84,8 +85,8 @@ public class ByteBuddyProxyHelper implements Serializable {
ByteBuddyState.ProxyDefinitionHelpers helpers = byteBuddyState.getProxyDefinitionHelpers();
return byteBuddy -> helpers.appendIgnoreAlsoAtEnd( byteBuddy
.ignore( helpers.getGroovyGetMetaClassFilter() )
.with( new NamingStrategy.SuffixingRandom( PROXY_NAMING_SUFFIX, new NamingStrategy.SuffixingRandom.BaseNameResolver.ForFixedValue( persistentClass.getTypeName() ) ) )
.subclass( interfaces.size() == 1 ? persistentClass : TypeDescription.OBJECT, ConstructorStrategy.Default.IMITATE_SUPER_CLASS_OPENING )
.with( new NamingStrategy.SuffixingRandom( PROXY_NAMING_SUFFIX, new NamingStrategy.Suffixing.BaseNameResolver.ForFixedValue( persistentClass.getTypeName() ) ) )
.subclass( interfaces.size() == 1 ? persistentClass : OBJECT, ConstructorStrategy.Default.IMITATE_SUPER_CLASS_OPENING )
.implement( interfaces )
.method( helpers.getVirtualNotFinalizerFilter() )
.intercept( helpers.getDelegateToInterceptorDispatcherMethodDelegation() )