@@ -35,7 +35,7 @@ public static void process(
35
35
EntityPersisterConcurrentMap entityPersisterMap ,
36
36
Map <String , CollectionPersister > collectionPersisterMap ,
37
37
RuntimeModelCreationContext creationContext ) {
38
- final MappingModelCreationProcess process = new MappingModelCreationProcess (
38
+ final var process = new MappingModelCreationProcess (
39
39
entityPersisterMap ,
40
40
collectionPersisterMap ,
41
41
creationContext
@@ -75,21 +75,21 @@ public SqmFunctionRegistry getSqmFunctionRegistry() {
75
75
* Instance-level trigger for {@link #process}
76
76
*/
77
77
private void execute () {
78
- for ( EntityPersister entityPersister : entityPersisterMap .values () ) {
78
+ for ( var entityPersister : entityPersisterMap .values () ) {
79
79
if ( entityPersister instanceof InFlightEntityMappingType inFlightEntityMappingType ) {
80
80
inFlightEntityMappingType .linkWithSuperType ( this );
81
81
}
82
82
}
83
83
84
- for ( EntityPersister entityPersister : entityPersisterMap .values () ) {
84
+ for ( var entityPersister : entityPersisterMap .values () ) {
85
85
currentlyProcessingRole = entityPersister .getEntityName ();
86
86
87
87
if ( entityPersister instanceof InFlightEntityMappingType inFlightEntityMappingType ) {
88
88
inFlightEntityMappingType .prepareMappingModel ( this );
89
89
}
90
90
}
91
91
92
- for ( CollectionPersister collectionPersister : collectionPersisterMap .values () ) {
92
+ for ( var collectionPersister : collectionPersisterMap .values () ) {
93
93
if ( collectionPersister instanceof InFlightCollectionMapping inFlightCollectionMapping ) {
94
94
inFlightCollectionMapping .prepareMappingModel ( this );
95
95
}
@@ -103,15 +103,15 @@ private void executePostInitCallbacks() {
103
103
104
104
Map <PostInitCallbackEntry , Exception > exceptions = new HashMap <>();
105
105
while ( postInitCallbacks != null && !postInitCallbacks .isEmpty () ) {
106
- // copy to avoid CCME
107
- final ArrayList < PostInitCallbackEntry > copy = new ArrayList <>( postInitCallbacks );
106
+ // cope the callback list to avoid CCME
107
+ final var callbacks = new ArrayList <>( postInitCallbacks );
108
108
109
- // NOTE : this is *not* the same as the lengths between `copy ` and `postInitCallbacks`
109
+ // NOTE: this is *not* the same as the lengths between `callbacks ` and `postInitCallbacks`
110
110
boolean anyCompleted = false ;
111
111
112
112
//noinspection ForLoopReplaceableByForEach
113
- for ( int i = 0 ; i < copy .size (); i ++ ) {
114
- final PostInitCallbackEntry callbackEntry = copy .get ( i );
113
+ for ( int i = 0 ; i < callbacks .size (); i ++ ) {
114
+ final var callbackEntry = callbacks .get ( i );
115
115
try {
116
116
final boolean completed = callbackEntry .process ();
117
117
if ( completed ) {
@@ -123,14 +123,14 @@ private void executePostInitCallbacks() {
123
123
catch (Exception e ) {
124
124
if ( e instanceof NonTransientException ) {
125
125
MAPPING_MODEL_CREATION_MESSAGE_LOGGER .debugf (
126
- "Mapping-model creation encountered non-transient error : %s" ,
126
+ "Mapping-model creation encountered non-transient error: %s" ,
127
127
e
128
128
);
129
129
throw e ;
130
130
}
131
131
exceptions .put ( callbackEntry , e );
132
132
133
- final String format = "Mapping-model creation encountered (possibly) transient error : %s" ;
133
+ final String format = "Mapping-model creation encountered (possibly) transient error: %s" ;
134
134
if ( MAPPING_MODEL_CREATION_MESSAGE_LOGGER .isTraceEnabled () ) {
135
135
MAPPING_MODEL_CREATION_MESSAGE_LOGGER .tracef ( e , format , e );
136
136
}
@@ -142,7 +142,7 @@ private void executePostInitCallbacks() {
142
142
143
143
if ( !anyCompleted ) {
144
144
// none of the remaining callbacks could complete fully, this is an error
145
- final StringBuilder buff = new StringBuilder (
145
+ final var buff = new StringBuilder (
146
146
"PostInitCallback queue could not be processed..."
147
147
);
148
148
postInitCallbacks .forEach (
@@ -151,9 +151,8 @@ private void executePostInitCallbacks() {
151
151
);
152
152
buff .append ( EOL );
153
153
154
- final IllegalStateException illegalStateException = new IllegalStateException ( buff .toString () );
155
-
156
- for ( Map .Entry <PostInitCallbackEntry , Exception > entry : exceptions .entrySet () ) {
154
+ final var illegalStateException = new IllegalStateException ( buff .toString () );
155
+ for ( var entry : exceptions .entrySet () ) {
157
156
illegalStateException .addSuppressed ( entry .getValue () );
158
157
}
159
158
throw illegalStateException ;
@@ -165,10 +164,8 @@ public <T extends ModelPart> T processSubPart(
165
164
String localName ,
166
165
SubPartMappingProducer <T > subPartMappingProducer ) {
167
166
assert currentlyProcessingRole != null ;
168
-
169
167
final String initialRole = currentlyProcessingRole ;
170
168
currentlyProcessingRole = currentlyProcessingRole + '#' + localName ;
171
-
172
169
try {
173
170
return subPartMappingProducer .produceSubMapping ( currentlyProcessingRole , this );
174
171
}
@@ -196,7 +193,7 @@ public void withForeignKey(ModelPart keyOwner, Consumer<ForeignKeyDescriptor> co
196
193
}
197
194
198
195
private void withForeignKey (NavigableRole navigableRole , Consumer <ForeignKeyDescriptor > consumer ) {
199
- final ForeignKeyDescriptor keyDescriptor = keyDescriptorMap .get ( navigableRole );
196
+ final var keyDescriptor = keyDescriptorMap .get ( navigableRole );
200
197
if ( keyDescriptor != null ) {
201
198
consumer .accept ( keyDescriptor );
202
199
}
@@ -215,9 +212,8 @@ private void withForeignKey(NavigableRole navigableRole, Consumer<ForeignKeyDesc
215
212
}
216
213
217
214
public void registerForeignKey (ModelPart keyOwner , ForeignKeyDescriptor keyDescriptor ) {
218
- final NavigableRole navigableRole = keyOwner .getNavigableRole ();
215
+ final var navigableRole = keyOwner .getNavigableRole ();
219
216
keyDescriptorMap .put ( navigableRole , keyDescriptor );
220
-
221
217
final var waitingConsumers = keyDescriptorWaitingConsumerMap .remove ( navigableRole );
222
218
if ( waitingConsumers != null ) {
223
219
for ( int i = 0 ; i < waitingConsumers .size (); i ++ ) {
0 commit comments