Skip to content

Commit cc812cc

Browse files
committed
[ci] Remove unnecessary parentheses and allow quicker exit
1 parent 200e07e commit cc812cc

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed

src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private void parseCacheRef() {
215215
if (refType != void.class && !refName.isEmpty()) {
216216
throw new BuilderException("Cannot use both value() and name() attribute in the @CacheNamespaceRef");
217217
}
218-
String namespace = (refType != void.class) ? refType.getName() : refName;
218+
String namespace = refType != void.class ? refType.getName() : refName;
219219
try {
220220
assistant.useCacheRef(namespace);
221221
} catch (IncompleteElementException e) {
@@ -462,8 +462,8 @@ private void applyResults(Result[] results, Class<?> resultType, List<ResultMapp
462462
flags.add(ResultFlag.ID);
463463
}
464464
@SuppressWarnings("unchecked")
465-
Class<? extends TypeHandler<?>> typeHandler = (Class<? extends TypeHandler<?>>) ((result
466-
.typeHandler() == UnknownTypeHandler.class) ? null : result.typeHandler());
465+
Class<? extends TypeHandler<?>> typeHandler = (Class<? extends TypeHandler<?>>) (result
466+
.typeHandler() == UnknownTypeHandler.class ? null : result.typeHandler());
467467
boolean hasNestedResultMap = hasNestedResultMap(result);
468468
ResultMapping resultMapping = assistant.buildResultMapping(resultType, nullOrEmpty(result.property()),
469469
nullOrEmpty(result.column()), result.javaType() == void.class ? null : result.javaType(),

src/main/java/org/apache/ibatis/datasource/pooled/PooledDataSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ private PooledConnection popConnection(String username, String password) throws
523523
state.badConnectionCount++;
524524
localBadConnectionCount++;
525525
conn = null;
526-
if (localBadConnectionCount > (poolMaximumIdleConnections + poolMaximumLocalBadConnectionTolerance)) {
526+
if (localBadConnectionCount > poolMaximumIdleConnections + poolMaximumLocalBadConnectionTolerance) {
527527
if (log.isDebugEnabled()) {
528528
log.debug("PooledDataSource: Could not get a good connection to the database.");
529529
}

src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ private boolean applyPropertyMappings(ResultSetWrapper rsw, ResultMap resultMap,
486486
column = null;
487487
}
488488
if (propertyMapping.isCompositeResult()
489-
|| (column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH)))
489+
|| column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH))
490490
|| propertyMapping.getResultSet() != null) {
491491
Object value = getPropertyMappingValue(rsw.getResultSet(), metaObject, propertyMapping, lazyLoader,
492492
columnPrefix);
@@ -503,7 +503,7 @@ private boolean applyPropertyMappings(ResultSetWrapper rsw, ResultMap resultMap,
503503
foundValues = true;
504504
}
505505
if (value != null
506-
|| (configuration.isCallSettersOnNulls() && !metaObject.getSetterType(property).isPrimitive())) {
506+
|| configuration.isCallSettersOnNulls() && !metaObject.getSetterType(property).isPrimitive()) {
507507
// gcode issue #377, call setter on nulls (value is not 'found')
508508
metaObject.setValue(property, value);
509509
}
@@ -565,7 +565,7 @@ private List<UnMappedColumnAutoMapping> createAutomaticMappings(ResultSetWrapper
565565
}
566566
} else {
567567
configuration.getAutoMappingUnknownColumnBehavior().doAction(mappedStatement, columnName,
568-
(property != null) ? property : propertyName, null);
568+
property != null ? property : propertyName, null);
569569
}
570570
}
571571
autoMappingsCache.put(mapKey, autoMapping);
@@ -583,7 +583,7 @@ private boolean applyAutomaticMappings(ResultSetWrapper rsw, ResultMap resultMap
583583
if (value != null) {
584584
foundValues = true;
585585
}
586-
if (value != null || (configuration.isCallSettersOnNulls() && !mapping.primitive)) {
586+
if (value != null || configuration.isCallSettersOnNulls() && !mapping.primitive) {
587587
// gcode issue #377, call setter on nulls (value is not 'found')
588588
metaObject.setValue(mapping.property, value);
589589
}

src/main/java/org/apache/ibatis/jdbc/ScriptRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ private void executeStatement(String command) throws SQLException {
248248
}
249249
try {
250250
boolean hasResults = statement.execute(sql);
251-
while (!(!hasResults && statement.getUpdateCount() == -1)) {
251+
while ((hasResults || (statement.getUpdateCount() != -1))) {
252252
checkWarnings(statement);
253253
printResults(statement, hasResults);
254254
hasResults = statement.getMoreResults();

src/main/java/org/apache/ibatis/mapping/ResultMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public ResultMap build() {
9393
for (ResultMapping resultMapping : resultMap.resultMappings) {
9494
resultMap.hasNestedQueries = resultMap.hasNestedQueries || resultMapping.getNestedQueryId() != null;
9595
resultMap.hasNestedResultMaps = resultMap.hasNestedResultMaps
96-
|| (resultMapping.getNestedResultMapId() != null && resultMapping.getResultSet() == null);
96+
|| resultMapping.getNestedResultMapId() != null && resultMapping.getResultSet() == null;
9797
final String column = resultMapping.getColumn();
9898
if (column != null) {
9999
resultMap.mappedColumns.add(column.toUpperCase(Locale.ENGLISH));

src/main/java/org/apache/ibatis/parsing/PropertyParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private VariableTokenHandler(Properties variables) {
7070
}
7171

7272
private String getPropertyValue(String key, String defaultValue) {
73-
return (variables == null) ? defaultValue : variables.getProperty(key, defaultValue);
73+
return variables == null ? defaultValue : variables.getProperty(key, defaultValue);
7474
}
7575

7676
@Override

src/main/java/org/apache/ibatis/reflection/Reflector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ private void addFields(Class<?> clazz) {
243243
// modification of final fields through reflection (JSR-133). (JGB)
244244
// pr #16 - final static can only be set by the classloader
245245
int modifiers = field.getModifiers();
246-
if (!(Modifier.isFinal(modifiers) && Modifier.isStatic(modifiers))) {
246+
if ((!Modifier.isFinal(modifiers) || !Modifier.isStatic(modifiers))) {
247247
addSetField(field);
248248
}
249249
}
@@ -273,7 +273,7 @@ private void addGetField(Field field) {
273273
}
274274

275275
private boolean isValidPropertyName(String name) {
276-
return !(name.startsWith("$") || "serialVersionUID".equals(name) || "class".equals(name));
276+
return (!name.startsWith("$") && !"serialVersionUID".equals(name) && !"class".equals(name));
277277
}
278278

279279
/**

src/main/java/org/apache/ibatis/reflection/property/PropertyNamer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static String methodToProperty(String name) {
3838
"Error parsing property name '" + name + "'. Didn't start with 'is', 'get' or 'set'.");
3939
}
4040

41-
if (name.length() == 1 || (name.length() > 1 && !Character.isUpperCase(name.charAt(1)))) {
41+
if (name.length() == 1 || name.length() > 1 && !Character.isUpperCase(name.charAt(1))) {
4242
name = name.substring(0, 1).toLowerCase(Locale.ENGLISH) + name.substring(1);
4343
}
4444

@@ -50,7 +50,7 @@ public static boolean isProperty(String name) {
5050
}
5151

5252
public static boolean isGetter(String name) {
53-
return (name.startsWith("get") && name.length() > 3) || (name.startsWith("is") && name.length() > 2);
53+
return name.startsWith("get") && name.length() > 3 || name.startsWith("is") && name.length() > 2;
5454
}
5555

5656
public static boolean isSetter(String name) {

src/main/java/org/apache/ibatis/session/defaults/DefaultSqlSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ private <T> void registerCursor(Cursor<T> cursor) {
313313
}
314314

315315
private boolean isCommitOrRollbackRequired(boolean force) {
316-
return (!autoCommit && dirty) || force;
316+
return !autoCommit && dirty || force;
317317
}
318318

319319
private Object wrapCollection(final Object object) {

0 commit comments

Comments
 (0)