From abcdd60b7612a741026f9e4bccfe0dbb719990d8 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Thu, 14 Nov 2024 13:42:36 +0100 Subject: [PATCH] move ClassmateContext to SPI package, since it occurs in BootstrapContext it was previously in an internal package, and leaked onto the SPI --- .../org/hibernate/boot/internal/BootstrapContextImpl.java | 1 + .../convert/internal/AbstractConverterDescriptor.java | 2 +- .../convert/internal/ClassBasedConverterDescriptor.java | 2 +- .../boot/model/convert/internal/ConverterHelper.java | 2 +- .../convert/internal/InstanceBasedConverterDescriptor.java | 2 +- .../java/org/hibernate/boot/model/internal/XMLContext.java | 2 +- .../hibernate/boot/models/spi/ConversionRegistration.java | 2 +- .../main/java/org/hibernate/boot/spi/BootstrapContext.java | 7 ++----- .../hibernate/boot/{internal => spi}/ClassmateContext.java | 6 +++++- .../src/main/java/org/hibernate/cfg/Configuration.java | 2 +- .../jpa/boot/internal/EntityManagerFactoryBuilderImpl.java | 2 +- .../src/main/java/org/hibernate/mapping/BasicValue.java | 2 +- .../orm/test/boot/models/BootstrapContextTesting.java | 2 +- .../test/bootstrap/scanning/ScanningCoordinatorTest.java | 2 +- .../converted/converter/AttributeConverterTest.java | 2 +- .../org/hibernate/testing/boot/BootstrapContextImpl.java | 2 +- 16 files changed, 21 insertions(+), 19 deletions(-) rename hibernate-core/src/main/java/org/hibernate/boot/{internal => spi}/ClassmateContext.java (84%) diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/BootstrapContextImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/BootstrapContextImpl.java index 561b08b6bd..6efbabb6b9 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/BootstrapContextImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/BootstrapContextImpl.java @@ -24,6 +24,7 @@ import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; import org.hibernate.boot.registry.selector.spi.StrategySelector; import org.hibernate.boot.spi.BootstrapContext; import org.hibernate.boot.spi.ClassLoaderAccess; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.spi.MetadataBuildingOptions; import org.hibernate.cfg.AvailableSettings; import org.hibernate.engine.config.spi.ConfigurationService; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/AbstractConverterDescriptor.java b/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/AbstractConverterDescriptor.java index 8012a82220..4cdcf972ef 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/AbstractConverterDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/AbstractConverterDescriptor.java @@ -6,7 +6,7 @@ package org.hibernate.boot.model.convert.internal; import java.util.List; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.model.convert.spi.AutoApplicableConverterDescriptor; import org.hibernate.boot.model.convert.spi.ConverterDescriptor; import org.hibernate.boot.model.convert.spi.JpaAttributeConverterCreationContext; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/ClassBasedConverterDescriptor.java b/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/ClassBasedConverterDescriptor.java index d5da7294f5..1987e71ddb 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/ClassBasedConverterDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/ClassBasedConverterDescriptor.java @@ -4,7 +4,7 @@ */ package org.hibernate.boot.model.convert.internal; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.model.convert.spi.JpaAttributeConverterCreationContext; import org.hibernate.resource.beans.spi.ManagedBean; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/ConverterHelper.java b/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/ConverterHelper.java index e4093de379..ff4408f53e 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/ConverterHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/ConverterHelper.java @@ -12,7 +12,7 @@ import java.util.List; import org.hibernate.AnnotationException; import org.hibernate.HibernateException; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.internal.util.GenericsHelper; import org.hibernate.internal.util.type.PrimitiveWrapperHelper; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/InstanceBasedConverterDescriptor.java b/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/InstanceBasedConverterDescriptor.java index 989a619b3d..d20732c387 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/InstanceBasedConverterDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/convert/internal/InstanceBasedConverterDescriptor.java @@ -4,7 +4,7 @@ */ package org.hibernate.boot.model.convert.internal; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.model.convert.spi.JpaAttributeConverterCreationContext; import org.hibernate.resource.beans.spi.ManagedBean; import org.hibernate.resource.beans.spi.ProvidedInstanceManagedBeanImpl; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/XMLContext.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/XMLContext.java index 0531e86ae9..8089bc3001 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/XMLContext.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/XMLContext.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.Map; import org.hibernate.AnnotationException; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.jaxb.mapping.spi.JaxbConverterImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityImpl; import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityListenerContainerImpl; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/models/spi/ConversionRegistration.java b/hibernate-core/src/main/java/org/hibernate/boot/models/spi/ConversionRegistration.java index 17d2ed46a6..69c6ba6f11 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/models/spi/ConversionRegistration.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/models/spi/ConversionRegistration.java @@ -8,7 +8,7 @@ import java.lang.annotation.Annotation; import java.util.List; import java.util.Objects; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.model.convert.internal.AutoApplicableConverterDescriptorBypassedImpl; import org.hibernate.boot.model.convert.internal.AutoApplicableConverterDescriptorStandardImpl; import org.hibernate.boot.model.convert.internal.ConverterHelper; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/BootstrapContext.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/BootstrapContext.java index fb8abe4705..fa4c04244b 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/BootstrapContext.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/BootstrapContext.java @@ -13,8 +13,6 @@ import org.hibernate.boot.Metadata; 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.internal.ClassmateContext; -import org.hibernate.boot.internal.TypeBeanInstanceProducer; import org.hibernate.boot.model.convert.spi.ConverterDescriptor; import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject; import org.hibernate.boot.registry.StandardServiceRegistry; @@ -62,7 +60,7 @@ public interface BootstrapContext { /** * The {@link BeanInstanceProducer} to use when creating custom type references. * - * @implNote Usually a {@link TypeBeanInstanceProducer}. + * @implNote Usually a {@link org.hibernate.boot.internal.TypeBeanInstanceProducer}. */ BeanInstanceProducer getCustomTypeProducer(); @@ -105,9 +103,8 @@ public interface BootstrapContext { /** * Access to the shared {@link ClassmateContext} object used * throughout the bootstrap process. - * - * @return Access to the shared {@link ClassmateContext} delegates. */ + @Incubating ClassmateContext getClassmateContext(); /** diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/ClassmateContext.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/ClassmateContext.java similarity index 84% rename from hibernate-core/src/main/java/org/hibernate/boot/internal/ClassmateContext.java rename to hibernate-core/src/main/java/org/hibernate/boot/spi/ClassmateContext.java index e072735691..bd216e2d0f 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/ClassmateContext.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/ClassmateContext.java @@ -2,14 +2,18 @@ * SPDX-License-Identifier: LGPL-2.1-or-later * Copyright Red Hat Inc. and Hibernate Authors */ -package org.hibernate.boot.internal; +package org.hibernate.boot.spi; import com.fasterxml.classmate.MemberResolver; import com.fasterxml.classmate.TypeResolver; +import org.hibernate.Incubating; /** + * Exposes the Classmate {@link TypeResolver} and {@link MemberResolver}. + * * @author Steve Ebersole */ +@Incubating public class ClassmateContext { private TypeResolver typeResolver = new TypeResolver(); private MemberResolver memberResolver = new MemberResolver( typeResolver ); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java index 3a384c9342..34e97c252e 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java @@ -26,7 +26,7 @@ import org.hibernate.boot.Metadata; import org.hibernate.boot.MetadataBuilder; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.SessionFactoryBuilder; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.jaxb.spi.Binding; import org.hibernate.boot.model.FunctionContributor; import org.hibernate.boot.model.NamedEntityGraphDefinition; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java index 22e53e68eb..9ed86a0ed8 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java @@ -26,7 +26,7 @@ import org.hibernate.boot.beanvalidation.BeanValidationIntegrator; import org.hibernate.boot.cfgxml.spi.CfgXmlAccessService; import org.hibernate.boot.cfgxml.spi.LoadedConfig; import org.hibernate.boot.cfgxml.spi.MappingReference; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmHibernateMapping; import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmRootEntityType; import org.hibernate.boot.jaxb.spi.Binding; diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java index d90eb61e73..1e6191984b 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java @@ -17,7 +17,7 @@ import org.hibernate.TimeZoneStorageStrategy; import org.hibernate.annotations.SoftDelete; import org.hibernate.annotations.SoftDeleteType; import org.hibernate.annotations.TimeZoneStorageType; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.model.TypeDefinition; import org.hibernate.boot.model.convert.internal.AutoApplicableConverterDescriptorBypassedImpl; import org.hibernate.boot.model.convert.internal.InstanceBasedConverterDescriptor; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/boot/models/BootstrapContextTesting.java b/hibernate-core/src/test/java/org/hibernate/orm/test/boot/models/BootstrapContextTesting.java index 6a934b9a20..8a8e778aa9 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/boot/models/BootstrapContextTesting.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/boot/models/BootstrapContextTesting.java @@ -16,7 +16,7 @@ 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.internal.ClassLoaderAccessImpl; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.internal.TypeBeanInstanceProducer; import org.hibernate.boot.model.convert.spi.ConverterDescriptor; import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/scanning/ScanningCoordinatorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/scanning/ScanningCoordinatorTest.java index 90cbdab2ea..70a8534c70 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/scanning/ScanningCoordinatorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/scanning/ScanningCoordinatorTest.java @@ -25,7 +25,7 @@ import org.hibernate.boot.archive.scan.spi.ScanParameters; import org.hibernate.boot.archive.scan.spi.ScanResult; import org.hibernate.boot.archive.scan.spi.Scanner; import org.hibernate.boot.archive.spi.InputStreamAccess; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.model.convert.spi.ConverterDescriptor; import org.hibernate.boot.model.process.internal.ManagedResourcesImpl; import org.hibernate.boot.model.process.internal.ScanningCoordinator; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java index bc82034790..a18ac1ed67 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java @@ -13,7 +13,7 @@ import org.hibernate.IrrelevantEntity; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.boot.MetadataSources; -import org.hibernate.boot.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.model.convert.internal.InstanceBasedConverterDescriptor; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/boot/BootstrapContextImpl.java b/hibernate-testing/src/main/java/org/hibernate/testing/boot/BootstrapContextImpl.java index 0786040189..68e8cf47fe 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/boot/BootstrapContextImpl.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/boot/BootstrapContextImpl.java @@ -11,7 +11,7 @@ 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.internal.ClassmateContext; +import org.hibernate.boot.spi.ClassmateContext; import org.hibernate.boot.internal.MetadataBuilderImpl; import org.hibernate.boot.model.convert.spi.ConverterDescriptor; import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject;