From c5c3bb8ac8ae3ec657126d0ac01b55f416a8ff99 Mon Sep 17 00:00:00 2001 From: Jan Schatteman Date: Fri, 9 Jun 2023 21:57:34 +0200 Subject: [PATCH] HHH-16515 - Add o.h.exception to nullness checking HHH-16515 - Add o.h.integrator to nullness checking HHH-16515 - Add o.h.service to nullness checking HHH-16515 - Add o.h.engine.jndi to nullness checking HHH-16515 - Add o.h.engine.config to nullness checking Signed-off-by: Jan Schatteman --- gradle/java-module.gradle | 2 +- .../boot/internal/MetadataBuilderImpl.java | 4 -- .../BootstrapServiceRegistryBuilder.java | 2 +- .../StandardServiceRegistryBuilder.java | 2 +- .../BootstrapServiceRegistryImpl.java | 8 ++- .../internal/StandardServiceRegistryImpl.java | 24 +++++--- .../cache/spi/access/AccessType.java | 4 +- .../internal/ConfigurationServiceImpl.java | 14 +++-- .../config/spi/ConfigurationService.java | 12 ++-- .../engine/config/spi/StandardConverters.java | 14 +---- .../engine/jndi/internal/JndiServiceImpl.java | 3 +- .../internal/AbstractJtaPlatform.java | 3 +- .../internal/AtomikosJtaPlatform.java | 3 +- .../internal/BitronixJtaPlatform.java | 3 +- .../internal/JBossStandAloneJtaPlatform.java | 9 +-- .../platform/internal/JOTMJtaPlatform.java | 3 +- .../internal/JtaPlatformInitiator.java | 5 +- .../JtaPlatformResolverInitiator.java | 3 +- .../internal/StandardJtaPlatformResolver.java | 3 +- .../internal/WebSphereLibertyJtaPlatform.java | 4 +- .../WildFlyStandAloneJtaPlatform.java | 9 +-- .../ConstraintViolationException.java | 10 ++-- .../internal/SQLExceptionTypeDelegate.java | 4 +- .../internal/SQLStateConversionDelegate.java | 4 +- .../StandardSQLExceptionConverter.java | 4 +- .../spi/SQLExceptionConversionDelegate.java | 4 +- ...platedViolatedConstraintNameExtractor.java | 10 +++- .../spi/ViolatedConstraintNameExtractor.java | 4 +- .../id/SequenceMismatchStrategy.java | 4 +- .../internal/IntegratorServiceImpl.java | 20 ++++--- .../util/config/ConfigurationHelper.java | 4 -- .../hibernate/service/ServiceRegistry.java | 6 +- .../internal/AbstractServiceRegistryImpl.java | 53 +++++++++--------- ...sionFactoryServiceRegistryBuilderImpl.java | 2 +- ...sionFactoryServiceRegistryFactoryImpl.java | 3 +- .../SessionFactoryServiceRegistryImpl.java | 28 +++++++--- .../hibernate/service/spi/ServiceBinding.java | 6 +- .../spi/ServiceRegistryImplementor.java | 6 +- .../stat/internal/StatisticsInitiator.java | 7 ++- .../hibernate/type/WrapperArrayHandling.java | 4 +- .../connection/ConnectionCreatorTest.java | 56 ++++++++++++++----- .../hibernate/stat/HibernateQueryMetrics.java | 3 +- .../boot/ServiceRegistryTestingImpl.java | 20 +++++-- .../validation/MockSessionFactory.java | 2 +- 44 files changed, 249 insertions(+), 149 deletions(-) diff --git a/gradle/java-module.gradle b/gradle/java-module.gradle index 7932564bf1..376962189c 100644 --- a/gradle/java-module.gradle +++ b/gradle/java-module.gradle @@ -544,7 +544,7 @@ checkerFramework { extraJavacArgs = [ '-AsuppressWarnings=initialization', // stubs is passed directly through options.compilerArgumentProviders - '-AonlyDefs=^org\\.hibernate\\.(jpamodelgen|spi|pretty|stat|engine\\.(profile|transaction)|(action|context|bytecode)\\.spi)\\.' + '-AonlyDefs=^org\\.hibernate\\.(exception|integrator|jpamodelgen|service|spi|pretty|stat|engine\\.(config|jndi|profile|transaction)|(action|context|bytecode)\\.spi)\\.' ] } 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 4bb559fb35..3ccb42386f 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 @@ -659,10 +659,6 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont this.sharedCacheMode = configService.getSetting( AvailableSettings.JAKARTA_SHARED_CACHE_MODE, value -> { - if ( value == null ) { - return null; - } - if ( value instanceof SharedCacheMode ) { return (SharedCacheMode) value; } 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 6c298370e1..4740514a0a 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 @@ -187,7 +187,7 @@ public class BootstrapServiceRegistryBuilder { classLoaderService = providedClassLoaderService; } - final IntegratorServiceImpl integratorService = new IntegratorServiceImpl( + final IntegratorServiceImpl integratorService = IntegratorServiceImpl.create( providedIntegrators, classLoaderService ); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/registry/StandardServiceRegistryBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/registry/StandardServiceRegistryBuilder.java index b66523e066..7e772aab14 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/registry/StandardServiceRegistryBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/registry/StandardServiceRegistryBuilder.java @@ -365,7 +365,7 @@ public class StandardServiceRegistryBuilder { settingsCopy.put( LOADED_CONFIG_KEY, aggregatedCfgXml ); ConfigurationHelper.resolvePlaceHolders( settingsCopy ); - return new StandardServiceRegistryImpl( + return StandardServiceRegistryImpl.create( autoCloseRegistry, bootstrapServiceRegistry, initiators, diff --git a/hibernate-core/src/main/java/org/hibernate/boot/registry/internal/BootstrapServiceRegistryImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/registry/internal/BootstrapServiceRegistryImpl.java index a799553772..9b6de3c3e5 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/registry/internal/BootstrapServiceRegistryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/registry/internal/BootstrapServiceRegistryImpl.java @@ -29,6 +29,8 @@ import org.hibernate.service.spi.ServiceInitiator; import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.Stoppable; +import org.checkerframework.checker.nullness.qual.Nullable; + /** * {@link ServiceRegistry} implementation containing specialized "bootstrap" services, specifically: