From dc2e86d5c1d68b58c786e4540254f3bbeee858b0 Mon Sep 17 00:00:00 2001 From: Jan Schatteman Date: Fri, 21 Jan 2022 22:16:43 +0100 Subject: [PATCH] Remove several deprecations in org.hibernate.boot Signed-off-by: Jan Schatteman --- .../StandardArchiveDescriptorFactory.java | 5 -- .../spi/AbstractArchiveDescriptorFactory.java | 5 -- .../archive/spi/ArchiveDescriptorFactory.java | 12 --- .../boot/internal/MetadataBuilderImpl.java | 35 -------- .../MetadataBuildingContextRootImpl.java | 6 -- .../source/internal/hbm/MappingDocument.java | 6 -- .../BootstrapServiceRegistryBuilder.java | 42 ---------- ...tDelegatingMetadataBuilderImplementor.java | 10 --- ...ractDelegatingMetadataBuildingOptions.java | 40 --------- .../boot/spi/MetadataBuildingContext.java | 10 --- .../boot/spi/MetadataBuildingOptions.java | 84 ------------------- .../boot/spi/SessionFactoryOptions.java | 27 ------ .../main/java/org/hibernate/cfg/Settings.java | 2 +- .../EnversMetadataBuildingContextImpl.java | 6 -- .../MetadataBuildingContextTestingImpl.java | 7 -- 15 files changed, 1 insertion(+), 296 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/StandardArchiveDescriptorFactory.java b/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/StandardArchiveDescriptorFactory.java index fcbbf0cfb2..05be013ef7 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/StandardArchiveDescriptorFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/StandardArchiveDescriptorFactory.java @@ -84,11 +84,6 @@ public class StandardArchiveDescriptorFactory implements ArchiveDescriptorFactor return ArchiveHelper.getJarURLFromURLEntry( url, entry ); } - @Override - public URL getURLFromPath(String jarPath) { - return ArchiveHelper.getURLFromPath( jarPath ); - } - @Override public URL adjustJarFileEntryUrl(URL url, URL rootUrl) { final String protocol = url.getProtocol(); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/archive/spi/AbstractArchiveDescriptorFactory.java b/hibernate-core/src/main/java/org/hibernate/boot/archive/spi/AbstractArchiveDescriptorFactory.java index 4809292710..63f2e1e6ee 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/archive/spi/AbstractArchiveDescriptorFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/archive/spi/AbstractArchiveDescriptorFactory.java @@ -23,9 +23,4 @@ public abstract class AbstractArchiveDescriptorFactory implements ArchiveDescrip public URL getJarURLFromURLEntry(URL url, String entry) throws IllegalArgumentException { return ArchiveHelper.getJarURLFromURLEntry( url, entry ); } - - @Override - public URL getURLFromPath(String jarPath) { - return ArchiveHelper.getURLFromPath( jarPath ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/archive/spi/ArchiveDescriptorFactory.java b/hibernate-core/src/main/java/org/hibernate/boot/archive/spi/ArchiveDescriptorFactory.java index 58646f3350..48d239fb69 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/archive/spi/ArchiveDescriptorFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/archive/spi/ArchiveDescriptorFactory.java @@ -46,16 +46,4 @@ public interface ArchiveDescriptorFactory { */ URL getJarURLFromURLEntry(URL url, String entry) throws IllegalArgumentException; - /** - * Not used! - * - * @param jarPath The jar path - * - * @return The url from the path? - * - * @deprecated Not used! - */ - @Deprecated - @SuppressWarnings("UnusedDeclaration") - URL getURLFromPath(String jarPath); } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java index 8715cec270..6d8a6efd63 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java @@ -794,36 +794,6 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont return bootstrapContext.getReflectionManager(); } - @Override - public IndexView getJandexView() { - return bootstrapContext.getJandexView(); - } - - @Override - public ScanOptions getScanOptions() { - return bootstrapContext.getScanOptions(); - } - - @Override - public ScanEnvironment getScanEnvironment() { - return bootstrapContext.getScanEnvironment(); - } - - @Override - public Object getScanner() { - return bootstrapContext.getScanner(); - } - - @Override - public ArchiveDescriptorFactory getArchiveDescriptorFactory() { - return bootstrapContext.getArchiveDescriptorFactory(); - } - - @Override - public ClassLoader getTempClassLoader() { - return bootstrapContext.getJpaTempClassLoader(); - } - @Override public ImplicitNamingStrategy getImplicitNamingStrategy() { return implicitNamingStrategy; @@ -854,11 +824,6 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont return idGenerationTypeInterpreter; } - @Override - public List getCacheRegionDefinitions() { - return new ArrayList<>( bootstrapContext.getCacheRegionDefinitions() ); - } - @Override public boolean ignoreExplicitDiscriminatorsForJoinedInheritance() { return !explicitDiscriminatorsForJoinedInheritanceSupported; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuildingContextRootImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuildingContextRootImpl.java index ac5635b500..6cd8efd7f9 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuildingContextRootImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuildingContextRootImpl.java @@ -9,7 +9,6 @@ package org.hibernate.boot.internal; import org.hibernate.boot.model.TypeDefinitionRegistryStandardImpl; import org.hibernate.boot.model.naming.ObjectNameNormalizer; import org.hibernate.boot.spi.BootstrapContext; -import org.hibernate.boot.spi.ClassLoaderAccess; import org.hibernate.boot.spi.InFlightMetadataCollector; import org.hibernate.boot.spi.MappingDefaults; import org.hibernate.boot.spi.MetadataBuildingContext; @@ -66,11 +65,6 @@ public class MetadataBuildingContextRootImpl implements MetadataBuildingContext return metadataCollector; } - @Override - public ClassLoaderAccess getClassLoaderAccess() { - return bootstrapContext.getClassLoaderAccess(); - } - @Override public ObjectNameNormalizer getObjectNameNormalizer() { return objectNameNormalizer; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/MappingDocument.java b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/MappingDocument.java index a163e7c242..ac1d2062ff 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/MappingDocument.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/MappingDocument.java @@ -27,7 +27,6 @@ import org.hibernate.boot.model.source.spi.MetadataSourceProcessor; import org.hibernate.boot.model.source.spi.ToolingHintContext; import org.hibernate.boot.query.HbmResultSetMappingDescriptor; import org.hibernate.boot.spi.BootstrapContext; -import org.hibernate.boot.spi.ClassLoaderAccess; import org.hibernate.boot.spi.InFlightMetadataCollector; import org.hibernate.boot.spi.MappingDefaults; import org.hibernate.boot.spi.MetadataBuildingContext; @@ -151,11 +150,6 @@ public class MappingDocument implements HbmLocalMetadataBuildingContext, Metadat return rootBuildingContext.getMetadataCollector(); } - @Override - public ClassLoaderAccess getClassLoaderAccess() { - return rootBuildingContext.getClassLoaderAccess(); - } - @Override public ObjectNameNormalizer getObjectNameNormalizer() { return rootBuildingContext.getObjectNameNormalizer(); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/registry/BootstrapServiceRegistryBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/registry/BootstrapServiceRegistryBuilder.java index 94e7e20415..c77cb2682c 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/registry/BootstrapServiceRegistryBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/registry/BootstrapServiceRegistryBuilder.java @@ -44,14 +44,6 @@ public class BootstrapServiceRegistryBuilder { private boolean autoCloseRegistry = true; - /** - * @deprecated Use {@link #applyIntegrator} instead - */ - @Deprecated - public BootstrapServiceRegistryBuilder with(Integrator integrator) { - return applyIntegrator( integrator ); - } - /** * Add an {@link Integrator} to be applied to the bootstrap registry. * @@ -64,14 +56,6 @@ public class BootstrapServiceRegistryBuilder { return this; } - /** - * @deprecated Use {@link #applyClassLoader} instead - */ - @Deprecated - public BootstrapServiceRegistryBuilder with(ClassLoader classLoader) { - return applyClassLoader( classLoader ); - } - /** * Adds a provided {@link ClassLoader} for use in class-loading and resource-lookup. * @@ -96,14 +80,6 @@ public class BootstrapServiceRegistryBuilder { tcclLookupPrecedence = precedence; } - /** - * @deprecated Use {@link #applyClassLoaderService} instead - */ - @Deprecated - public BootstrapServiceRegistryBuilder with(ClassLoaderService classLoaderService) { - return applyClassLoaderService( classLoaderService ); - } - /** * Adds a provided {@link ClassLoaderService} for use in class-loading and resource-lookup. * @@ -116,15 +92,6 @@ public class BootstrapServiceRegistryBuilder { return this; } - /** - * @deprecated Use {@link #applyStrategySelector} instead - */ - @SuppressWarnings( {"UnusedDeclaration"}) - @Deprecated - public BootstrapServiceRegistryBuilder withStrategySelector(Class strategy, String name, Class implementation) { - return applyStrategySelector( strategy, name, implementation ); - } - /** * Applies a named strategy implementation to the bootstrap registry. * @@ -144,15 +111,6 @@ public class BootstrapServiceRegistryBuilder { return this; } - /** - * @deprecated Use {@link #applyStrategySelectors} instead - */ - @SuppressWarnings( {"UnusedDeclaration"}) - @Deprecated - public BootstrapServiceRegistryBuilder withStrategySelectors(StrategyRegistrationProvider strategyRegistrationProvider) { - return applyStrategySelectors( strategyRegistrationProvider ); - } - /** * Applies one or more strategy selectors announced as available by the passed announcer. * diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadataBuilderImplementor.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadataBuilderImplementor.java index 3e586f7a81..712b9e40c0 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadataBuilderImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadataBuilderImplementor.java @@ -43,16 +43,6 @@ public abstract class AbstractDelegatingMetadataBuilderImplementor getCacheRegionDefinitions() { - return delegate.getCacheRegionDefinitions(); - } - @Override public boolean ignoreExplicitDiscriminatorsForJoinedInheritance() { return delegate.ignoreExplicitDiscriminatorsForJoinedInheritance(); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java index 9356e9b6bb..b828f7ef2a 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java @@ -44,16 +44,6 @@ public interface MetadataBuildingContext { */ InFlightMetadataCollector getMetadataCollector(); - /** - * Provides access to ClassLoader services when needed during binding - * - * @return The ClassLoaderAccess - * - * @deprecated Use {@link BootstrapContext#getClassLoaderAccess()}} instead. - */ - @Deprecated - ClassLoaderAccess getClassLoaderAccess(); - /** * Not sure how I feel about this exposed here * diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java index 73f27bdf3e..6ddc8e50c6 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java @@ -12,10 +12,6 @@ import jakarta.persistence.SharedCacheMode; import org.hibernate.TimeZoneStorageStrategy; import org.hibernate.annotations.common.reflection.ReflectionManager; -import org.hibernate.boot.CacheRegionDefinition; -import org.hibernate.boot.archive.scan.spi.ScanEnvironment; -import org.hibernate.boot.archive.scan.spi.ScanOptions; -import org.hibernate.boot.archive.spi.ArchiveDescriptorFactory; import org.hibernate.boot.model.IdGeneratorStrategyInterpreter; import org.hibernate.boot.model.naming.ImplicitNamingStrategy; import org.hibernate.boot.model.naming.PhysicalNamingStrategy; @@ -28,9 +24,6 @@ import org.hibernate.id.factory.IdentifierGeneratorFactory; import org.hibernate.metamodel.internal.ManagedTypeRepresentationResolverStandard; import org.hibernate.metamodel.spi.ManagedTypeRepresentationResolver; import org.hibernate.type.spi.TypeConfiguration; -import org.jboss.jandex.IndexView; - -import jakarta.persistence.SharedCacheMode; /** * Describes the options used while building the Metadata object (during @@ -95,73 +88,6 @@ public interface MetadataBuildingOptions { @Deprecated ReflectionManager getReflectionManager(); - /** - * Access to the Jandex index passed by call to - * {@link org.hibernate.boot.MetadataBuilder#applyIndexView(IndexView)}, if any. - * - * @return The Jandex index - * - * @deprecated Use {@link BootstrapContext#getJandexView()} instead. - */ - @Deprecated - IndexView getJandexView(); - - /** - * Access to the options to be used for scanning - * - * @return The scan options - * - * @deprecated Use {@link BootstrapContext#getScanOptions()} instead. - */ - @Deprecated - ScanOptions getScanOptions(); - - /** - * Access to the environment for scanning. Consider this temporary; see discussion on - * {@link ScanEnvironment} - * - * @return The scan environment - * - * @deprecated Use {@link BootstrapContext#getScanEnvironment()} instead. - */ - @Deprecated - ScanEnvironment getScanEnvironment(); - - /** - * Access to the Scanner to be used for scanning. Can be:
    - *
  • A Scanner instance
  • - *
  • A Class reference to the Scanner implementor
  • - *
  • A String naming the Scanner implementor
  • - *
- * - * @return The scanner - * - * @deprecated Use {@link BootstrapContext#getScanner()} instead. - */ - @Deprecated - Object getScanner(); - - /** - * Access to the ArchiveDescriptorFactory to be used for scanning - * - * @return The ArchiveDescriptorFactory - * - * @deprecated Use {@link BootstrapContext#getArchiveDescriptorFactory()} instead. - */ - @Deprecated - ArchiveDescriptorFactory getArchiveDescriptorFactory(); - - /** - * Access the temporary ClassLoader passed to us as defined by - * {@link jakarta.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()}, if any. - * - * @return The tempo ClassLoader - * - * @deprecated Use {@link BootstrapContext#getJpaTempClassLoader()} instead. - */ - @Deprecated - ClassLoader getTempClassLoader(); - ImplicitNamingStrategy getImplicitNamingStrategy(); PhysicalNamingStrategy getPhysicalNamingStrategy(); @@ -192,16 +118,6 @@ public interface MetadataBuildingOptions { TypeConfiguration getTypeConfiguration(); - /** - * Access to all explicit cache region mappings. - * - * @return Explicit cache region mappings. - * - * @deprecated Use {@link BootstrapContext#getClassmateContext()} instead. - */ - @Deprecated - List getCacheRegionDefinitions(); - /** * Whether explicit discriminator declarations should be ignored for joined * subclass style inheritance. diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java index 6ae1b80a54..ceb7466335 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java @@ -178,15 +178,6 @@ public interface SessionFactoryOptions extends QueryEngineOptions { boolean isJtaTrackByThread(); - /** - * @deprecated Use {@link JpaCompliance#isJpaQueryComplianceEnabled()} instead - * via {@link #getJpaCompliance()} - */ - @Deprecated - default boolean isStrictJpaQueryLanguageCompliance() { - return getJpaCompliance().isJpaQueryComplianceEnabled(); - } - boolean isNamedQueryStartupCheckingEnabled(); boolean isSecondLevelCacheEnabled(); @@ -292,28 +283,10 @@ public interface SessionFactoryOptions extends QueryEngineOptions { return Statistics.DEFAULT_QUERY_STATISTICS_MAX_SIZE; } - /** - * @deprecated Since 5.4.1, this is no longer used. - */ - @Deprecated - default boolean isPostInsertIdentifierDelayableEnabled() { - return true; - } - default boolean areJPACallbacksEnabled() { return true; } - /** - * Can bytecode-enhanced entity classes be used as a "proxy"? - * - * @deprecated (since 5.5) use of enhanced proxies is always enabled - */ - @Deprecated - default boolean isEnhancementAsProxyEnabled() { - return true; - } - /** * Controls whether Hibernate should try to map named parameter names * specified in a {@link org.hibernate.procedure.ProcedureCall} or diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Settings.java b/hibernate-core/src/main/java/org/hibernate/cfg/Settings.java index 17677469b6..fda28b24e8 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Settings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Settings.java @@ -194,7 +194,7 @@ public final class Settings { } public boolean isStrictJPAQLCompliance() { - return sessionFactoryOptions.isStrictJpaQueryLanguageCompliance(); + return sessionFactoryOptions.getJpaCompliance().isJpaCacheComplianceEnabled(); } public boolean isNamedQueryStartupCheckingEnabled() { diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversMetadataBuildingContextImpl.java b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversMetadataBuildingContextImpl.java index 106065f0b6..0aeab6dae8 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversMetadataBuildingContextImpl.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/EnversMetadataBuildingContextImpl.java @@ -10,7 +10,6 @@ import org.hibernate.annotations.common.reflection.ReflectionManager; import org.hibernate.boot.model.TypeDefinitionRegistry; import org.hibernate.boot.model.naming.ObjectNameNormalizer; import org.hibernate.boot.spi.BootstrapContext; -import org.hibernate.boot.spi.ClassLoaderAccess; import org.hibernate.boot.spi.InFlightMetadataCollector; import org.hibernate.boot.spi.MappingDefaults; import org.hibernate.boot.spi.MetadataBuildingContext; @@ -74,11 +73,6 @@ public class EnversMetadataBuildingContextImpl implements EnversMetadataBuilding return metadataCollector; } - @Override - public ClassLoaderAccess getClassLoaderAccess() { - return metadataCollector.getBootstrapContext().getClassLoaderAccess(); - } - @Override public ObjectNameNormalizer getObjectNameNormalizer() { return objectNameNormalizer; diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/boot/MetadataBuildingContextTestingImpl.java b/hibernate-testing/src/main/java/org/hibernate/testing/boot/MetadataBuildingContextTestingImpl.java index 025895924e..0343699d1e 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/boot/MetadataBuildingContextTestingImpl.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/boot/MetadataBuildingContextTestingImpl.java @@ -12,9 +12,7 @@ import org.hibernate.boot.internal.MetadataBuilderImpl; import org.hibernate.boot.model.TypeDefinitionRegistryStandardImpl; import org.hibernate.boot.model.naming.ObjectNameNormalizer; import org.hibernate.boot.registry.StandardServiceRegistry; -import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.spi.BootstrapContext; -import org.hibernate.boot.spi.ClassLoaderAccess; import org.hibernate.boot.spi.InFlightMetadataCollector; import org.hibernate.boot.spi.MappingDefaults; import org.hibernate.boot.spi.MetadataBuildingContext; @@ -68,11 +66,6 @@ public class MetadataBuildingContextTestingImpl implements MetadataBuildingConte return metadataCollector; } - @Override - public ClassLoaderAccess getClassLoaderAccess() { - return bootstrapContext.getClassLoaderAccess(); - } - @Override public ObjectNameNormalizer getObjectNameNormalizer() { return objectNameNormalizer;