Skip to content

Commit 7e36768

Browse files
committed
fix warnings in StatelessSessionImpl
1 parent 362da7e commit 7e36768

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package org.hibernate.internal;
88

99
import java.util.ArrayList;
10-
import java.util.Arrays;
1110
import java.util.List;
1211
import java.util.Set;
1312
import java.util.function.BiConsumer;
@@ -32,8 +31,6 @@
3231
import org.hibernate.engine.spi.EntityKey;
3332
import org.hibernate.engine.spi.LoadQueryInfluencers;
3433
import org.hibernate.engine.spi.PersistenceContext;
35-
import org.hibernate.engine.spi.PersistentAttributeInterceptable;
36-
import org.hibernate.engine.spi.PersistentAttributeInterceptor;
3734
import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper;
3835
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
3936
import org.hibernate.event.spi.PostDeleteEvent;
@@ -71,7 +68,6 @@
7168
import jakarta.persistence.EntityGraph;
7269
import jakarta.transaction.SystemException;
7370

74-
import static java.util.Arrays.asList;
7571
import static org.hibernate.engine.internal.ManagedTypeHelper.asPersistentAttributeInterceptable;
7672
import static org.hibernate.engine.internal.ManagedTypeHelper.isPersistentAttributeInterceptable;
7773
import static org.hibernate.engine.internal.Versioning.incrementVersion;
@@ -760,11 +756,8 @@ public void fetch(Object association) {
760756
}
761757
}
762758
else if ( isPersistentAttributeInterceptable( association ) ) {
763-
final PersistentAttributeInterceptable interceptable = asPersistentAttributeInterceptable( association );
764-
final PersistentAttributeInterceptor interceptor = interceptable.$$_hibernate_getInterceptor();
765-
if ( interceptor instanceof EnhancementAsProxyLazinessInterceptor ) {
766-
final EnhancementAsProxyLazinessInterceptor proxyInterceptor =
767-
(EnhancementAsProxyLazinessInterceptor) interceptor;
759+
if ( asPersistentAttributeInterceptable( association ).$$_hibernate_getInterceptor()
760+
instanceof EnhancementAsProxyLazinessInterceptor proxyInterceptor ) {
768761
proxyInterceptor.setSession( this );
769762
try {
770763
proxyInterceptor.forceInitialize( association, null );
@@ -778,8 +771,7 @@ else if ( isPersistentAttributeInterceptable( association ) ) {
778771
}
779772
}
780773
}
781-
else if ( association instanceof PersistentCollection ) {
782-
final PersistentCollection<?> persistentCollection = (PersistentCollection<?>) association;
774+
else if ( association instanceof PersistentCollection<?> persistentCollection ) {
783775
if ( !persistentCollection.wasInitialized() ) {
784776
final CollectionPersister collectionDescriptor = getFactory().getMappingMetamodel()
785777
.getCollectionDescriptor( persistentCollection.getRole() );

0 commit comments

Comments
 (0)