Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void process(
EntityPersisterConcurrentMap entityPersisterMap,
Map<String, CollectionPersister> collectionPersisterMap,
RuntimeModelCreationContext creationContext) {
final MappingModelCreationProcess process = new MappingModelCreationProcess(
final var process = new MappingModelCreationProcess(
entityPersisterMap,
collectionPersisterMap,
creationContext
Expand Down Expand Up @@ -75,21 +75,21 @@ public SqmFunctionRegistry getSqmFunctionRegistry() {
* Instance-level trigger for {@link #process}
*/
private void execute() {
for ( EntityPersister entityPersister : entityPersisterMap.values() ) {
for ( var entityPersister : entityPersisterMap.values() ) {
if ( entityPersister instanceof InFlightEntityMappingType inFlightEntityMappingType ) {
inFlightEntityMappingType.linkWithSuperType( this );
}
}

for ( EntityPersister entityPersister : entityPersisterMap.values() ) {
for ( var entityPersister : entityPersisterMap.values() ) {
currentlyProcessingRole = entityPersister.getEntityName();

if ( entityPersister instanceof InFlightEntityMappingType inFlightEntityMappingType ) {
inFlightEntityMappingType.prepareMappingModel( this );
}
}

for ( CollectionPersister collectionPersister : collectionPersisterMap.values() ) {
for ( var collectionPersister : collectionPersisterMap.values() ) {
if ( collectionPersister instanceof InFlightCollectionMapping inFlightCollectionMapping ) {
inFlightCollectionMapping.prepareMappingModel( this );
}
Expand All @@ -103,15 +103,15 @@ private void executePostInitCallbacks() {

Map<PostInitCallbackEntry, Exception> exceptions = new HashMap<>();
while ( postInitCallbacks != null && !postInitCallbacks.isEmpty() ) {
// copy to avoid CCME
final ArrayList<PostInitCallbackEntry> copy = new ArrayList<>( postInitCallbacks );
// cope the callback list to avoid CCME
final var callbacks = new ArrayList<>( postInitCallbacks );

// NOTE : this is *not* the same as the lengths between `copy` and `postInitCallbacks`
// NOTE: this is *not* the same as the lengths between `callbacks` and `postInitCallbacks`
boolean anyCompleted = false;

//noinspection ForLoopReplaceableByForEach
for ( int i = 0; i < copy.size(); i++ ) {
final PostInitCallbackEntry callbackEntry = copy.get( i );
for ( int i = 0; i < callbacks.size(); i++ ) {
final var callbackEntry = callbacks.get( i );
try {
final boolean completed = callbackEntry.process();
if ( completed ) {
Expand All @@ -123,14 +123,14 @@ private void executePostInitCallbacks() {
catch (Exception e) {
if ( e instanceof NonTransientException ) {
MAPPING_MODEL_CREATION_MESSAGE_LOGGER.debugf(
"Mapping-model creation encountered non-transient error : %s",
"Mapping-model creation encountered non-transient error: %s",
e
);
throw e;
}
exceptions.put( callbackEntry, e );

final String format = "Mapping-model creation encountered (possibly) transient error : %s";
final String format = "Mapping-model creation encountered (possibly) transient error: %s";
if ( MAPPING_MODEL_CREATION_MESSAGE_LOGGER.isTraceEnabled() ) {
MAPPING_MODEL_CREATION_MESSAGE_LOGGER.tracef( e, format, e );
}
Expand All @@ -142,7 +142,7 @@ private void executePostInitCallbacks() {

if ( !anyCompleted ) {
// none of the remaining callbacks could complete fully, this is an error
final StringBuilder buff = new StringBuilder(
final var buff = new StringBuilder(
"PostInitCallback queue could not be processed..."
);
postInitCallbacks.forEach(
Expand All @@ -151,9 +151,8 @@ private void executePostInitCallbacks() {
);
buff.append( EOL );

final IllegalStateException illegalStateException = new IllegalStateException( buff.toString() );

for ( Map.Entry<PostInitCallbackEntry, Exception> entry : exceptions.entrySet() ) {
final var illegalStateException = new IllegalStateException( buff.toString() );
for ( var entry : exceptions.entrySet() ) {
illegalStateException.addSuppressed( entry.getValue() );
}
throw illegalStateException;
Expand All @@ -165,10 +164,8 @@ public <T extends ModelPart> T processSubPart(
String localName,
SubPartMappingProducer<T> subPartMappingProducer) {
assert currentlyProcessingRole != null;

final String initialRole = currentlyProcessingRole;
currentlyProcessingRole = currentlyProcessingRole + '#' + localName;

try {
return subPartMappingProducer.produceSubMapping( currentlyProcessingRole, this );
}
Expand Down Expand Up @@ -196,7 +193,7 @@ public void withForeignKey(ModelPart keyOwner, Consumer<ForeignKeyDescriptor> co
}

private void withForeignKey(NavigableRole navigableRole, Consumer<ForeignKeyDescriptor> consumer) {
final ForeignKeyDescriptor keyDescriptor = keyDescriptorMap.get( navigableRole );
final var keyDescriptor = keyDescriptorMap.get( navigableRole );
if ( keyDescriptor != null ) {
consumer.accept( keyDescriptor );
}
Expand All @@ -215,9 +212,8 @@ private void withForeignKey(NavigableRole navigableRole, Consumer<ForeignKeyDesc
}

public void registerForeignKey(ModelPart keyOwner, ForeignKeyDescriptor keyDescriptor) {
final NavigableRole navigableRole = keyOwner.getNavigableRole();
final var navigableRole = keyOwner.getNavigableRole();
keyDescriptorMap.put( navigableRole, keyDescriptor );

final var waitingConsumers = keyDescriptorWaitingConsumerMap.remove( navigableRole );
if ( waitingConsumers != null ) {
for ( int i = 0; i < waitingConsumers.size(); i++ ) {
Expand Down
Loading
Loading