5151import org .hibernate .boot .model .source .internal .hbm .ModelBinder ;
5252import org .hibernate .boot .model .source .spi .MetadataSourceProcessor ;
5353import org .hibernate .boot .models .internal .DomainModelCategorizationCollector ;
54- import org .hibernate .boot .models .internal .OrmAnnotationHelper ;
5554import org .hibernate .boot .models .xml .spi .XmlPreProcessingResult ;
5655import org .hibernate .boot .models .xml .spi .XmlPreProcessor ;
5756import org .hibernate .boot .models .xml .spi .XmlProcessingResult ;
7372import org .hibernate .engine .config .spi .StandardConverters ;
7473import org .hibernate .engine .jdbc .spi .JdbcServices ;
7574import org .hibernate .mapping .Table ;
76- import org .hibernate .models .internal .jandex .JandexClassDetails ;
7775import org .hibernate .models .internal .jandex .JandexIndexerHelper ;
78- import org .hibernate .models .internal .jdk .JdkBuilders ;
79- import org .hibernate .models .spi .AnnotationDescriptorRegistry ;
8076import org .hibernate .models .spi .ClassDetails ;
8177import org .hibernate .models .spi .ClassDetailsRegistry ;
8278import org .hibernate .models .spi .ClassLoading ;
83- import org .hibernate .models .spi .RegistryPrimer ;
8479import org .hibernate .models .spi .SourceModelBuildingContext ;
8580import org .hibernate .type .BasicType ;
8681import org .hibernate .type .BasicTypeRegistry ;
10196import org .hibernate .type .spi .TypeConfiguration ;
10297import org .hibernate .usertype .CompositeUserType ;
10398
104- import org .jboss .jandex .ClassInfo ;
10599import org .jboss .jandex .CompositeIndex ;
106100import org .jboss .jandex .IndexView ;
107101import org .jboss .jandex .Indexer ;
108- import org .jboss .logging .Logger ;
109102
110103import jakarta .persistence .AttributeConverter ;
111104
135128 * @author Steve Ebersole
136129 */
137130public class MetadataBuildingProcess {
138- private static final Logger log = Logger .getLogger ( MetadataBuildingProcess .class );
139131
140132 /**
141133 * Unified single phase for MetadataSources to Metadata process
@@ -221,16 +213,14 @@ public static MetadataImplementor complete(
221213 // Set up the processors and start binding
222214 // NOTE : this becomes even more simplified after we move purely
223215 // to unified model
224- final IndexView jandexView = domainModelSource .getJandexIndex ();
216+ // final IndexView jandexView = domainModelSource.getJandexIndex();
225217
226218 coordinateProcessors (
227219 managedResources ,
228220 options ,
229221 rootMetadataBuildingContext ,
230222 domainModelSource ,
231- classLoaderService ,
232- metadataCollector ,
233- jandexView
223+ metadataCollector
234224 );
235225
236226 processAdditionalMappingContributions ( metadataCollector , options , classLoaderService , rootMetadataBuildingContext );
@@ -245,19 +235,18 @@ private static void coordinateProcessors(
245235 MetadataBuildingOptions options ,
246236 MetadataBuildingContextRootImpl rootMetadataBuildingContext ,
247237 DomainModelSource domainModelSource ,
248- ClassLoaderService classLoaderService ,
249- InFlightMetadataCollectorImpl metadataCollector ,
250- IndexView jandexView ) {
238+ InFlightMetadataCollectorImpl metadataCollector ) {
251239 final MetadataSourceProcessor processor = new MetadataSourceProcessor () {
252240 private final MetadataSourceProcessor hbmProcessor = options .isXmlMappingEnabled ()
253241 ? new HbmMetadataSourceProcessorImpl ( managedResources , rootMetadataBuildingContext )
254242 : new NoOpMetadataSourceProcessorImpl ();
255243
256- private final AnnotationMetadataSourceProcessorImpl annotationProcessor = new AnnotationMetadataSourceProcessorImpl (
257- managedResources ,
258- domainModelSource ,
259- rootMetadataBuildingContext
260- );
244+ private final AnnotationMetadataSourceProcessorImpl annotationProcessor =
245+ new AnnotationMetadataSourceProcessorImpl (
246+ managedResources ,
247+ domainModelSource ,
248+ rootMetadataBuildingContext
249+ );
261250
262251 @ Override
263252 public void prepare () {
@@ -527,66 +516,51 @@ public static IndexView resolveJandexIndex(
527516
528517 return CompositeIndex .create ( suppliedJandexIndex , jandexIndexer .complete () );
529518 }
530-
531- public static void preFillRegistries (RegistryPrimer .Contributions contributions , SourceModelBuildingContext buildingContext ) {
532- OrmAnnotationHelper .forEachOrmAnnotation ( contributions ::registerAnnotation );
533-
534- final IndexView jandexIndex = buildingContext .getJandexIndex ();
535- if ( jandexIndex == null ) {
536- return ;
537- }
538-
539- final ClassDetailsRegistry classDetailsRegistry = buildingContext .getClassDetailsRegistry ();
540- final AnnotationDescriptorRegistry annotationDescriptorRegistry = buildingContext .getAnnotationDescriptorRegistry ();
541-
542- for ( ClassInfo knownClass : jandexIndex .getKnownClasses () ) {
543- final String className = knownClass .name ().toString ();
544-
545- if ( knownClass .isAnnotation () ) {
546- // it is always safe to load the annotation classes - we will never be enhancing them
547- //noinspection rawtypes
548- final Class annotationClass = buildingContext
549- .getClassLoading ()
550- .classForName ( className );
551- //noinspection unchecked
552- annotationDescriptorRegistry .resolveDescriptor (
553- annotationClass ,
554- (t ) -> JdkBuilders .buildAnnotationDescriptor ( annotationClass , buildingContext )
555- );
556- }
557-
558- classDetailsRegistry .resolveClassDetails (
559- className ,
560- (name ) -> new JandexClassDetails ( knownClass , buildingContext )
561- );
562- }
563- }
519+ //
520+ // public static void preFillRegistries(RegistryPrimer.Contributions contributions, SourceModelBuildingContext buildingContext) {
521+ // OrmAnnotationHelper.forEachOrmAnnotation( contributions::registerAnnotation );
522+ //
523+ // final IndexView jandexIndex = buildingContext.getJandexIndex();
524+ // if ( jandexIndex == null ) {
525+ // return;
526+ // }
527+ //
528+ // final ClassDetailsRegistry classDetailsRegistry = buildingContext.getClassDetailsRegistry();
529+ // final AnnotationDescriptorRegistry annotationDescriptorRegistry = buildingContext.getAnnotationDescriptorRegistry();
530+ //
531+ // for ( ClassInfo knownClass : jandexIndex.getKnownClasses() ) {
532+ // final String className = knownClass.name().toString();
533+ //
534+ // if ( knownClass.isAnnotation() ) {
535+ // // it is always safe to load the annotation classes - we will never be enhancing them
536+ // //noinspection rawtypes
537+ // final Class annotationClass = buildingContext
538+ // .getClassLoading()
539+ // .classForName( className );
540+ // //noinspection unchecked
541+ // annotationDescriptorRegistry.resolveDescriptor(
542+ // annotationClass,
543+ // (t) -> JdkBuilders.buildAnnotationDescriptor( annotationClass, buildingContext )
544+ // );
545+ // }
546+ //
547+ // classDetailsRegistry.resolveClassDetails(
548+ // className,
549+ // (name) -> new JandexClassDetails( knownClass, buildingContext )
550+ // );
551+ // }
552+ // }
564553
565554 private static void processAdditionalMappingContributions (
566555 InFlightMetadataCollectorImpl metadataCollector ,
567556 MetadataBuildingOptions options ,
568557 ClassLoaderService classLoaderService ,
569558 MetadataBuildingContextRootImpl rootMetadataBuildingContext ) {
570- final MappingBinder mappingBinder ;
571- if ( options .isXmlMappingEnabled () ) {
572- mappingBinder = new MappingBinder (
573- classLoaderService ,
574- new MappingBinder .Options () {
575- @ Override
576- public boolean validateMappings () {
577- return false ;
578- }
579- }
580- );
581- }
582- else {
583- mappingBinder = null ;
584- }
585559
586560 final AdditionalMappingContributionsImpl contributions = new AdditionalMappingContributionsImpl (
587561 metadataCollector ,
588562 options ,
589- mappingBinder ,
563+ options . isXmlMappingEnabled () ? new MappingBinder ( classLoaderService , () -> false ) : null ,
590564 rootMetadataBuildingContext
591565 );
592566
@@ -1016,29 +990,27 @@ private static void adaptTimestampTypesToDefaultTimeZoneStorage(
1016990 }
1017991
1018992 private static JdbcType getTimeWithTimeZoneOverride (MetadataBuildingOptions options , JdbcTypeRegistry jdbcTypeRegistry ) {
1019- switch ( options .getDefaultTimeZoneStorage () ) {
1020- case NORMALIZE :
993+ return switch ( options .getDefaultTimeZoneStorage () ) {
994+ case NORMALIZE ->
1021995 // For NORMALIZE, we replace the standard types that use TIME_WITH_TIMEZONE to use TIME
1022- return jdbcTypeRegistry .getDescriptor ( Types .TIME );
1023- case NORMALIZE_UTC :
996+ jdbcTypeRegistry .getDescriptor ( Types .TIME );
997+ case NORMALIZE_UTC ->
1024998 // For NORMALIZE_UTC, we replace the standard types that use TIME_WITH_TIMEZONE to use TIME_UTC
1025- return jdbcTypeRegistry .getDescriptor ( SqlTypes .TIME_UTC );
1026- default :
1027- return null ;
1028- }
999+ jdbcTypeRegistry .getDescriptor ( SqlTypes .TIME_UTC );
1000+ default -> null ;
1001+ };
10291002 }
10301003
10311004 private static JdbcType getTimestampWithTimeZoneOverride (MetadataBuildingOptions options , JdbcTypeRegistry jdbcTypeRegistry ) {
1032- switch ( options .getDefaultTimeZoneStorage () ) {
1033- case NORMALIZE :
1005+ return switch (options .getDefaultTimeZoneStorage ()) {
1006+ case NORMALIZE ->
10341007 // For NORMALIZE, we replace the standard types that use TIMESTAMP_WITH_TIMEZONE to use TIMESTAMP
1035- return jdbcTypeRegistry .getDescriptor ( Types .TIMESTAMP );
1036- case NORMALIZE_UTC :
1008+ jdbcTypeRegistry .getDescriptor ( Types .TIMESTAMP );
1009+ case NORMALIZE_UTC ->
10371010 // For NORMALIZE_UTC, we replace the standard types that use TIMESTAMP_WITH_TIMEZONE to use TIMESTAMP_UTC
1038- return jdbcTypeRegistry .getDescriptor ( SqlTypes .TIMESTAMP_UTC );
1039- default :
1040- return null ;
1041- }
1011+ jdbcTypeRegistry .getDescriptor ( SqlTypes .TIMESTAMP_UTC );
1012+ default -> null ;
1013+ };
10421014 }
10431015
10441016 private static void addFallbackIfNecessary (
0 commit comments