diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java index 6ae184825c..3862bd6799 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java @@ -1819,13 +1819,9 @@ public class StatefulPersistenceContext implements PersistenceContext { @Override public boolean containsNullifiableEntityKey(Supplier sek) { - if ( nullifiableEntityKeys == null || nullifiableEntityKeys.size() == 0 ) { - return false; - } - else { - final EntityKey entityKey = sek.get(); - return nullifiableEntityKeys.contains( entityKey ); - } + return nullifiableEntityKeys != null + && nullifiableEntityKeys.size() != 0 + && nullifiableEntityKeys.contains( sek.get() ); } @Override @@ -1838,7 +1834,8 @@ public class StatefulPersistenceContext implements PersistenceContext { @Override public boolean isNullifiableEntityKeysEmpty() { - return ( nullifiableEntityKeys == null || nullifiableEntityKeys.size() == 0 ); + return nullifiableEntityKeys == null + || nullifiableEntityKeys.size() == 0; } @Override @@ -1848,12 +1845,7 @@ public class StatefulPersistenceContext implements PersistenceContext { @Override public CollectionEntry removeCollectionEntry(PersistentCollection collection) { - if ( collectionEntries == null ) { - return null; - } - else { - return collectionEntries.remove( collection ); - } + return collectionEntries == null ? null : collectionEntries.remove(collection); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityKey.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityKey.java index 9e54214a51..d60d5967ba 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityKey.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityKey.java @@ -102,12 +102,8 @@ public final class EntityKey implements Serializable { } private boolean samePersistentType(final EntityKey otherKey) { - if ( otherKey.persister == persister ) { - return true; - } - else { - return Objects.equals( otherKey.persister.getRootEntityName(), persister.getRootEntityName() ); - } + return otherKey.persister == persister + || Objects.equals( otherKey.persister.getRootEntityName(), persister.getRootEntityName() ); } @Override @@ -117,8 +113,7 @@ public final class EntityKey implements Serializable { @Override public String toString() { - return "EntityKey" + - MessageHelper.infoString( this.persister, identifier, persister.getFactory() ); + return "EntityKey" + MessageHelper.infoString( this.persister, identifier, persister.getFactory() ); } /** diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java b/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java index f8a6573ff5..d54c4b6243 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java @@ -319,7 +319,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer { @Override public final Object getImplementation(SharedSessionContractImplementor s) throws HibernateException { final EntityKey entityKey = generateEntityKeyOrNull( getInternalIdentifier(), s, getEntityName() ); - return ( entityKey == null ? null : s.getPersistenceContext().getEntity( entityKey ) ); + return entityKey == null ? null : s.getPersistenceContext().getEntity( entityKey ); } /**