From abe74a85c5dbec5f3fe1f7a047d4335627ca6d2b Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Wed, 16 Aug 2023 22:49:01 +0200 Subject: [PATCH] HHH-16073 Remove legacy references to BytecodeProvider configuration from Environment --- .../java/org/hibernate/cfg/Environment.java | 34 ------------------- ...rtyCheckPrivateUnMappedCollectionTest.java | 3 +- .../EntityWithMutableAttributesTest.java | 3 +- ...dAndUpdateEntitiesWithCollectionsTest.java | 3 +- .../LoadUninitializedCollectionTest.java | 3 +- ...QueryExecutionWithFlushModeAlwaysTest.java | 3 +- .../SimpleDynamicUpdateTest.java | 3 +- .../DynamicUpdateAndCollectionsTest.java | 3 +- .../jpa/callbacks/PrivateConstructorTest.java | 3 +- 9 files changed, 16 insertions(+), 42 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java index 1a8f603706..9250d732ba 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java @@ -13,8 +13,6 @@ import java.util.Properties; import org.hibernate.HibernateException; import org.hibernate.Internal; import org.hibernate.Version; -import org.hibernate.bytecode.internal.BytecodeProviderInitiator; -import org.hibernate.bytecode.spi.BytecodeProvider; import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.ConfigHelper; import org.hibernate.internal.util.config.ConfigurationHelper; @@ -195,36 +193,4 @@ public final class Environment implements AvailableSettings { return copy; } - /** - * @deprecated Replaced by {@code org.hibernate.bytecode.internal.BytecodeProviderInitiator#BYTECODE_PROVIDER_NAME_BYTEBUDDY}, - * however note that that's an internal contract: a different BytecodeProvider Initiator might ignore these constants - * or interpret them differently. - */ - @Deprecated(forRemoval = true) - public static final String BYTECODE_PROVIDER_NAME_BYTEBUDDY = "bytebuddy"; - - /** - * @deprecated Replaced by {@code org.hibernate.bytecode.internal.BytecodeProviderInitiator#BYTECODE_PROVIDER_NAME_NONE}, - * however note that that's an internal contract: a different BytecodeProvider Initiator might ignore these constants - * or interpret them differently. - */ - @Deprecated(forRemoval = true) - public static final String BYTECODE_PROVIDER_NAME_NONE = "none"; - - /** - * @deprecated Replaced by {@code org.hibernate.bytecode.internal.BytecodeProviderInitiator#BYTECODE_PROVIDER_NAME_DEFAULT} - * however note that that's an internal contract: a different BytecodeProvider Initiator might apply a different default. - */ - @Deprecated(forRemoval = true) - public static final String BYTECODE_PROVIDER_NAME_DEFAULT = BytecodeProviderInitiator.BYTECODE_PROVIDER_NAME_BYTEBUDDY; - - /** - * @deprecated this will be removed; retrieval of the BytecodeProvider should be performed via the {@link org.hibernate.service.ServiceRegistry}. - */ - @Deprecated(forRemoval = true) - public static BytecodeProvider buildBytecodeProvider(Properties properties) { - String provider = ConfigurationHelper.getString( BYTECODE_PROVIDER, properties, BYTECODE_PROVIDER_NAME_DEFAULT ); - return BytecodeProviderInitiator.buildBytecodeProvider( provider ); - } - } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/DirtyCheckPrivateUnMappedCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/DirtyCheckPrivateUnMappedCollectionTest.java index d7ec0d8904..d830058951 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/DirtyCheckPrivateUnMappedCollectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/DirtyCheckPrivateUnMappedCollectionTest.java @@ -20,6 +20,7 @@ import jakarta.persistence.MappedSuperclass; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.bytecode.internal.BytecodeProviderInitiator; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; @@ -51,7 +52,7 @@ public class DirtyCheckPrivateUnMappedCollectionTest extends BaseNonConfigCoreFu @Override protected void applyMetadataSources(MetadataSources sources) { String byteCodeProvider = Environment.getProperties().getProperty( AvailableSettings.BYTECODE_PROVIDER ); - if ( byteCodeProvider != null && !Environment.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { + if ( byteCodeProvider != null && !BytecodeProviderInitiator.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { // skip the test if the bytecode provider is Javassist skipTest = true; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/EntityWithMutableAttributesTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/EntityWithMutableAttributesTest.java index f868341d6d..b34d5a46a5 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/EntityWithMutableAttributesTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/EntityWithMutableAttributesTest.java @@ -19,6 +19,7 @@ import jakarta.validation.constraints.NotNull; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementAsProxyLazinessInterceptor; +import org.hibernate.bytecode.internal.BytecodeProviderInitiator; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.engine.spi.PersistentAttributeInterceptable; @@ -51,7 +52,7 @@ public class EntityWithMutableAttributesTest extends BaseNonConfigCoreFunctional @Override protected void applyMetadataSources(MetadataSources sources) { String byteCodeProvider = Environment.getProperties().getProperty( AvailableSettings.BYTECODE_PROVIDER ); - if ( byteCodeProvider != null && !Environment.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { + if ( byteCodeProvider != null && !BytecodeProviderInitiator.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { // skip the test if the bytecode provider is Javassist skipTest = true; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadAndUpdateEntitiesWithCollectionsTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadAndUpdateEntitiesWithCollectionsTest.java index d9118204c5..cdeff802eb 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadAndUpdateEntitiesWithCollectionsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadAndUpdateEntitiesWithCollectionsTest.java @@ -15,6 +15,7 @@ import jakarta.persistence.criteria.Root; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.bytecode.internal.BytecodeProviderInitiator; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.engine.spi.SessionImplementor; @@ -51,7 +52,7 @@ public class LoadAndUpdateEntitiesWithCollectionsTest extends BaseNonConfigCoreF @Override protected void applyMetadataSources(MetadataSources sources) { String byteCodeProvider = Environment.getProperties().getProperty( AvailableSettings.BYTECODE_PROVIDER ); - if ( byteCodeProvider != null && !Environment.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { + if ( byteCodeProvider != null && !BytecodeProviderInitiator.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { // skip the test if the bytecode provider is Javassist skipTest = true; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadUninitializedCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadUninitializedCollectionTest.java index ccdb7658d9..387fda91f0 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadUninitializedCollectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadUninitializedCollectionTest.java @@ -19,6 +19,7 @@ import jakarta.persistence.OneToMany; import jakarta.persistence.Query; import jakarta.persistence.Table; +import org.hibernate.bytecode.internal.BytecodeProviderInitiator; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; @@ -53,7 +54,7 @@ public class LoadUninitializedCollectionTest extends BaseEntityManagerFunctional @Override protected void addMappings(Map settings) { String byteCodeProvider = Environment.getProperties().getProperty( AvailableSettings.BYTECODE_PROVIDER ); - if ( byteCodeProvider != null && !Environment.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { + if ( byteCodeProvider != null && !BytecodeProviderInitiator.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { // skip the test if the bytecode provider is Javassist skipTest = true; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadingLazyCollectionAfterQueryExecutionWithFlushModeAlwaysTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadingLazyCollectionAfterQueryExecutionWithFlushModeAlwaysTest.java index f3557fdb61..389345542a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadingLazyCollectionAfterQueryExecutionWithFlushModeAlwaysTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadingLazyCollectionAfterQueryExecutionWithFlushModeAlwaysTest.java @@ -12,6 +12,7 @@ import jakarta.persistence.OneToMany; import jakarta.persistence.OneToOne; import org.hibernate.FlushMode; +import org.hibernate.bytecode.internal.BytecodeProviderInitiator; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; @@ -49,7 +50,7 @@ public class LoadingLazyCollectionAfterQueryExecutionWithFlushModeAlwaysTest protected void addMappings(Map settings) { String byteCodeProvider = Environment.getProperties().getProperty( AvailableSettings.BYTECODE_PROVIDER ); settings.put( AvailableSettings.FLUSH_MODE, FlushMode.ALWAYS ); - if ( byteCodeProvider != null && !Environment.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { + if ( byteCodeProvider != null && !BytecodeProviderInitiator.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { // skip the test if the bytecode provider is Javassist skipTest = true; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/SimpleDynamicUpdateTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/SimpleDynamicUpdateTest.java index 4ce6416d4d..8fd765e34d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/SimpleDynamicUpdateTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/SimpleDynamicUpdateTest.java @@ -17,6 +17,7 @@ import org.hibernate.annotations.DynamicUpdate; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementAsProxyLazinessInterceptor; +import org.hibernate.bytecode.internal.BytecodeProviderInitiator; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.engine.spi.PersistentAttributeInterceptable; @@ -50,7 +51,7 @@ public class SimpleDynamicUpdateTest extends BaseNonConfigCoreFunctionalTestCase @Override protected void applyMetadataSources(MetadataSources sources) { String byteCodeProvider = Environment.getProperties().getProperty( AvailableSettings.BYTECODE_PROVIDER ); - if ( byteCodeProvider != null && !Environment.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { + if ( byteCodeProvider != null && !BytecodeProviderInitiator.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { // skip the test if the bytecode provider is Javassist skipTest = true; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/dynamicupdate/DynamicUpdateAndCollectionsTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/dynamicupdate/DynamicUpdateAndCollectionsTest.java index a7a1e80279..2c105926c3 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/dynamicupdate/DynamicUpdateAndCollectionsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/dynamicupdate/DynamicUpdateAndCollectionsTest.java @@ -15,6 +15,7 @@ import jakarta.persistence.criteria.Root; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.bytecode.internal.BytecodeProviderInitiator; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.engine.spi.SessionImplementor; @@ -54,7 +55,7 @@ public class DynamicUpdateAndCollectionsTest extends BaseNonConfigCoreFunctional @Override protected void applyMetadataSources(MetadataSources sources) { String byteCodeProvider = Environment.getProperties().getProperty( AvailableSettings.BYTECODE_PROVIDER ); - if ( byteCodeProvider != null && !Environment.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { + if ( byteCodeProvider != null && !BytecodeProviderInitiator.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { // skip the test if the bytecode provider is Javassist skipTest = true; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/callbacks/PrivateConstructorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/callbacks/PrivateConstructorTest.java index d6c4b78b30..2bd4b372ad 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/callbacks/PrivateConstructorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/callbacks/PrivateConstructorTest.java @@ -15,6 +15,7 @@ import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.ManyToOne; +import org.hibernate.bytecode.internal.BytecodeProviderInitiator; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.internal.CoreMessageLogger; @@ -88,7 +89,7 @@ public class PrivateConstructorTest { private static Class proxyFactoryClass() { String byteCodeProvider = Environment.getProperties().getProperty( AvailableSettings.BYTECODE_PROVIDER ); - if ( byteCodeProvider == null || Environment.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { + if ( byteCodeProvider == null || BytecodeProviderInitiator.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals( byteCodeProvider ) ) { return ByteBuddyProxyFactory.class; } else {