Automated cleanup: inefficient branching (thanks IntelliJ)

This commit is contained in:
Sanne Grinovero 2023-06-20 22:38:06 +02:00 committed by Sanne Grinovero
parent 0fb5895d08
commit e9f879d9d6
9 changed files with 10 additions and 50 deletions

View File

@ -987,12 +987,7 @@ public abstract class AbstractPostgreSQLStructJdbcType implements AggregateJdbcT
} }
else if ( value instanceof TemporalAccessor ) { else if ( value instanceof TemporalAccessor ) {
final TemporalAccessor temporalAccessor = (TemporalAccessor) value; final TemporalAccessor temporalAccessor = (TemporalAccessor) value;
if ( temporalAccessor.isSupported( ChronoField.OFFSET_SECONDS ) ) { appendAsTimestampWithMicros( appender, temporalAccessor, temporalAccessor.isSupported( ChronoField.OFFSET_SECONDS ), jdbcTimeZone );
appendAsTimestampWithMicros( appender, temporalAccessor, true, jdbcTimeZone );
}
else {
appendAsTimestampWithMicros( appender, temporalAccessor, false, jdbcTimeZone );
}
} }
else { else {
appendAsTimestampWithMicros( appendAsTimestampWithMicros(

View File

@ -44,9 +44,6 @@ public final class CharSequenceHelper {
} }
else if ( charSequence instanceof SubSequence ) { else if ( charSequence instanceof SubSequence ) {
int idx = ( (SubSequence) charSequence ).lastIndexOf( c, fromIndex, endIndex ); int idx = ( (SubSequence) charSequence ).lastIndexOf( c, fromIndex, endIndex );
if ( idx == -1 ) {
return -1;
}
return idx; return idx;
} }
else { else {
@ -72,9 +69,6 @@ public final class CharSequenceHelper {
} }
else if ( charSequence instanceof SubSequence ) { else if ( charSequence instanceof SubSequence ) {
int idx = ( (SubSequence) charSequence ).indexOf( c, fromIndex, endIndex ); int idx = ( (SubSequence) charSequence ).indexOf( c, fromIndex, endIndex );
if ( idx == -1 ) {
return -1;
}
return idx; return idx;
} }
else { else {
@ -96,9 +90,6 @@ public final class CharSequenceHelper {
} }
else if ( charSequence instanceof SubSequence ) { else if ( charSequence instanceof SubSequence ) {
int idx = ( (SubSequence) charSequence ).indexOf( target, fromIndex, endIndex ); int idx = ( (SubSequence) charSequence ).indexOf( target, fromIndex, endIndex );
if ( idx == -1 ) {
return -1;
}
return idx; return idx;
} }
else { else {

View File

@ -51,14 +51,9 @@ public enum JpaStaticMetaModelPopulationSetting {
} }
private static String determineSetting(Map configurationValues) { private static String determineSetting(Map configurationValues) {
final String setting = ConfigurationHelper.getString( return ConfigurationHelper.getString(
AvailableSettings.STATIC_METAMODEL_POPULATION, AvailableSettings.STATIC_METAMODEL_POPULATION,
configurationValues configurationValues
); );
if ( setting != null ) {
return setting;
}
return null;
} }
} }

View File

@ -33,10 +33,7 @@ public class FromClauseAccessImpl implements FromClauseAccess {
public TableGroup findByAlias(String alias) { public TableGroup findByAlias(String alias) {
if ( tableGroupBySqlAlias != null ) { if ( tableGroupBySqlAlias != null ) {
final TableGroup tableGroup = tableGroupBySqlAlias.get( alias ); return tableGroupBySqlAlias.get( alias );
if ( tableGroup != null ) {
return tableGroup;
}
} }
return null; return null;
@ -51,9 +48,7 @@ public class FromClauseAccessImpl implements FromClauseAccess {
public TableGroup findTableGroup(NavigablePath navigablePath) { public TableGroup findTableGroup(NavigablePath navigablePath) {
if ( tableGroupByPath != null ) { if ( tableGroupByPath != null ) {
final TableGroup tableGroup = tableGroupByPath.get( navigablePath ); final TableGroup tableGroup = tableGroupByPath.get( navigablePath );
if ( tableGroup != null ) { return tableGroup;
return tableGroup;
}
} }
return null; return null;

View File

@ -172,9 +172,7 @@ public class SqmExpressionHelper {
return lhs; return lhs;
} }
final SqmPath<?> rhs = findPath( binaryArithmetic.getRightHandOperand(), nodeType ); final SqmPath<?> rhs = findPath( binaryArithmetic.getRightHandOperand(), nodeType );
if ( rhs != null ) { return rhs;
return rhs;
}
} }
return null; return null;
} }

View File

@ -107,9 +107,7 @@ public class CollectionTableGroup extends StandardTableGroup implements PluralTa
tableExpression, tableExpression,
resolve resolve
); );
if ( elementTableReference != null ) { return elementTableReference;
return elementTableReference;
}
} }
return null; return null;
} }

View File

@ -93,9 +93,7 @@ public class CorrelatedPluralTableGroup extends CorrelatedTableGroup implements
tableExpression, tableExpression,
resolve resolve
); );
if ( elementTableReference != null ) { return elementTableReference;
return elementTableReference;
}
} }
return null; return null;
} }
@ -129,9 +127,7 @@ public class CorrelatedPluralTableGroup extends CorrelatedTableGroup implements
tableExpression, tableExpression,
resolve resolve
); );
if ( elementTableReference != null ) { return elementTableReference;
return elementTableReference;
}
} }
return null; return null;
} }

View File

@ -286,10 +286,7 @@ public abstract class AbstractEmbeddableInitializer extends AbstractFetchParentA
} }
final EntityInitializer entityInitializer = parentAccess.asEntityInitializer(); final EntityInitializer entityInitializer = parentAccess.asEntityInitializer();
if ( entityInitializer != null && entityInitializer.getParentKey() == null ) { return entityInitializer != null && entityInitializer.getParentKey() == null;
return true;
}
return false;
} }
private void extractRowState(RowProcessingState processingState) { private void extractRowState(RowProcessingState processingState) {

View File

@ -84,12 +84,7 @@ public class ImportContextImpl implements ImportContext {
String simpleName = unqualify( fqcn ); String simpleName = unqualify( fqcn );
if ( simpleNames.containsKey( simpleName ) ) { if ( simpleNames.containsKey( simpleName ) ) {
String existingFqcn = simpleNames.get( simpleName ); String existingFqcn = simpleNames.get( simpleName );
if ( existingFqcn.equals( pureFqcn ) ) { canBeSimple = existingFqcn.equals( pureFqcn );
canBeSimple = true;
}
else {
canBeSimple = false;
}
} }
else { else {
canBeSimple = true; canBeSimple = true;