Skip to content

Commit

Permalink
Merge pull request #2826 from hazendaz/copyright
Browse files Browse the repository at this point in the history
More Eclipse based cleanups
  • Loading branch information
hazendaz committed Feb 21, 2023
2 parents 501db6e + 6c5c478 commit b175c22
Show file tree
Hide file tree
Showing 47 changed files with 52 additions and 87 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,6 @@ public class BindingException extends PersistenceException {
private static final long serialVersionUID = 4300802238789381562L;

public BindingException() {
super();
}

public BindingException(String message) {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/apache/ibatis/binding/MapperProxy.java
Expand Up @@ -134,7 +134,6 @@ private static class PlainMethodInvoker implements MapperMethodInvoker {
private final MapperMethod mapperMethod;

public PlainMethodInvoker(MapperMethod mapperMethod) {
super();
this.mapperMethod = mapperMethod;
}

Expand All @@ -148,7 +147,6 @@ private static class DefaultMethodInvoker implements MapperMethodInvoker {
private final MethodHandle methodHandle;

public DefaultMethodInvoker(MethodHandle methodHandle) {
super();
this.methodHandle = methodHandle;
}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,6 @@ public class BuilderException extends PersistenceException {
private static final long serialVersionUID = -3885164021020443281L;

public BuilderException() {
super();
}

public BuilderException(String message) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,6 @@ public class IncompleteElementException extends BuilderException {
private static final long serialVersionUID = -3697292286890900315L;

public IncompleteElementException() {
super();
}

public IncompleteElementException(String message, Throwable cause) {
Expand Down
Expand Up @@ -215,7 +215,7 @@ private void parseCacheRef() {
if (refType != void.class && !refName.isEmpty()) {
throw new BuilderException("Cannot use both value() and name() attribute in the @CacheNamespaceRef");
}
String namespace = (refType != void.class) ? refType.getName() : refName;
String namespace = refType != void.class ? refType.getName() : refName;
try {
assistant.useCacheRef(namespace);
} catch (IncompleteElementException e) {
Expand Down Expand Up @@ -462,8 +462,8 @@ private void applyResults(Result[] results, Class<?> resultType, List<ResultMapp
flags.add(ResultFlag.ID);
}
@SuppressWarnings("unchecked")
Class<? extends TypeHandler<?>> typeHandler = (Class<? extends TypeHandler<?>>) ((result
.typeHandler() == UnknownTypeHandler.class) ? null : result.typeHandler());
Class<? extends TypeHandler<?>> typeHandler = (Class<? extends TypeHandler<?>>) (result
.typeHandler() == UnknownTypeHandler.class ? null : result.typeHandler());
boolean hasNestedResultMap = hasNestedResultMap(result);
ResultMapping resultMapping = assistant.buildResultMapping(resultType, nullOrEmpty(result.property()),
nullOrEmpty(result.column()), result.javaType() == void.class ? null : result.javaType(),
Expand Down Expand Up @@ -657,14 +657,13 @@ public static Class<?> getMethodReturnType(String mapperFqn, String localStateme
return null;
}

private class AnnotationWrapper {
private static class AnnotationWrapper {
private final Annotation annotation;
private final String databaseId;
private final SqlCommandType sqlCommandType;
private boolean dirtySelect;

AnnotationWrapper(Annotation annotation) {
super();
this.annotation = annotation;
if (annotation instanceof Select) {
databaseId = ((Select) annotation).databaseId();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/apache/ibatis/cache/CacheException.java
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,6 @@ public class CacheException extends PersistenceException {
private static final long serialVersionUID = -193202262468464650L;

public CacheException() {
super();
}

public CacheException(String message) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/apache/ibatis/cache/CacheKey.java
Expand Up @@ -31,6 +31,8 @@ public class CacheKey implements Cloneable, Serializable {

public static final CacheKey NULL_CACHE_KEY = new CacheKey() {

private static final long serialVersionUID = 1L;

@Override
public void update(Object object) {
throw new CacheException("Not allowed to update a null cache key instance.");
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/apache/ibatis/cache/NullCacheKey.java
Expand Up @@ -26,7 +26,6 @@ public final class NullCacheKey extends CacheKey {
private static final long serialVersionUID = 3704229911977019465L;

public NullCacheKey() {
super();
}

@Override
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,6 @@ public class DataSourceException extends PersistenceException {
private static final long serialVersionUID = -5251396250407091334L;

public DataSourceException() {
super();
}

public DataSourceException(String message) {
Expand Down
Expand Up @@ -29,7 +29,7 @@
class PooledConnection implements InvocationHandler {

private static final String CLOSE = "close";
private static final Class<?>[] IFACES = new Class<?>[] { Connection.class };
private static final Class<?>[] IFACES = { Connection.class };

private final int hashCode;
private final PooledDataSource dataSource;
Expand Down
Expand Up @@ -523,7 +523,7 @@ private PooledConnection popConnection(String username, String password) throws
state.badConnectionCount++;
localBadConnectionCount++;
conn = null;
if (localBadConnectionCount > (poolMaximumIdleConnections + poolMaximumLocalBadConnectionTolerance)) {
if (localBadConnectionCount > poolMaximumIdleConnections + poolMaximumLocalBadConnectionTolerance) {
if (log.isDebugEnabled()) {
log.debug("PooledDataSource: Could not get a good connection to the database.");
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,6 @@ public class IbatisException extends RuntimeException {
private static final long serialVersionUID = 3880206998166270511L;

public IbatisException() {
super();
}

public IbatisException(String message) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,6 @@ public class PersistenceException extends IbatisException {
private static final long serialVersionUID = -7537395265357977271L;

public PersistenceException() {
super();
}

public PersistenceException(String message) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,6 @@ public class TooManyResultsException extends PersistenceException {
private static final long serialVersionUID = 8935197089745865786L;

public TooManyResultsException() {
super();
}

public TooManyResultsException(String message) {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/apache/ibatis/executor/BatchResult.java
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,7 +32,6 @@ public class BatchResult {
private int[] updateCounts;

public BatchResult(MappedStatement mappedStatement, String sql) {
super();
this.mappedStatement = mappedStatement;
this.sql = sql;
this.parameterObjects = new ArrayList<>();
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,6 @@ public class ExecutorException extends PersistenceException {
private static final long serialVersionUID = 4060977051977364820L;

public ExecutorException() {
super();
}

public ExecutorException(String message) {
Expand Down
Expand Up @@ -229,7 +229,7 @@ private static Collection<?> collectionize(Object param) {
}
}

private class KeyAssigner {
private static class KeyAssigner {
private final Configuration configuration;
private final ResultSetMetaData rsmd;
private final TypeHandlerRegistry typeHandlerRegistry;
Expand All @@ -240,7 +240,6 @@ private class KeyAssigner {

protected KeyAssigner(Configuration configuration, ResultSetMetaData rsmd, int columnPosition, String paramName,
String propertyName) {
super();
this.configuration = configuration;
this.rsmd = rsmd;
this.typeHandlerRegistry = configuration.getTypeHandlerRegistry();
Expand Down
Expand Up @@ -42,7 +42,7 @@ public abstract class AbstractSerialStateHolder implements Externalizable {

private static final long serialVersionUID = 8940388717901644661L;
private static final ThreadLocal<ObjectOutputStream> stream = new ThreadLocal<>();
private byte[] userBeanBytes = new byte[0];
private byte[] userBeanBytes = {};
private Object userBean;
private Map<String, ResultLoaderMap.LoadPair> unloadedProperties;
private ObjectFactory objectFactory;
Expand Down
Expand Up @@ -486,7 +486,7 @@ private boolean applyPropertyMappings(ResultSetWrapper rsw, ResultMap resultMap,
column = null;
}
if (propertyMapping.isCompositeResult()
|| (column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH)))
|| column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH))
|| propertyMapping.getResultSet() != null) {
Object value = getPropertyMappingValue(rsw.getResultSet(), metaObject, propertyMapping, lazyLoader,
columnPrefix);
Expand All @@ -503,7 +503,7 @@ private boolean applyPropertyMappings(ResultSetWrapper rsw, ResultMap resultMap,
foundValues = true;
}
if (value != null
|| (configuration.isCallSettersOnNulls() && !metaObject.getSetterType(property).isPrimitive())) {
|| configuration.isCallSettersOnNulls() && !metaObject.getSetterType(property).isPrimitive()) {
// gcode issue #377, call setter on nulls (value is not 'found')
metaObject.setValue(property, value);
}
Expand Down Expand Up @@ -565,7 +565,7 @@ private List<UnMappedColumnAutoMapping> createAutomaticMappings(ResultSetWrapper
}
} else {
configuration.getAutoMappingUnknownColumnBehavior().doAction(mappedStatement, columnName,
(property != null) ? property : propertyName, null);
property != null ? property : propertyName, null);
}
}
autoMappingsCache.put(mapKey, autoMapping);
Expand All @@ -583,7 +583,7 @@ private boolean applyAutomaticMappings(ResultSetWrapper rsw, ResultMap resultMap
if (value != null) {
foundValues = true;
}
if (value != null || (configuration.isCallSettersOnNulls() && !mapping.primitive)) {
if (value != null || configuration.isCallSettersOnNulls() && !mapping.primitive) {
// gcode issue #377, call setter on nulls (value is not 'found')
metaObject.setValue(mapping.property, value);
}
Expand Down Expand Up @@ -764,8 +764,8 @@ private Object applyConstructorAutomapping(ResultSetWrapper rsw, ResultMap resul
throws SQLException {
boolean foundValues = false;
if (configuration.isArgNameBasedConstructorAutoMapping()) {
foundValues = applyArgNameBasedConstructorAutoMapping(rsw, resultMap, columnPrefix, resultType,
constructorArgTypes, constructorArgs, constructor, foundValues);
foundValues = applyArgNameBasedConstructorAutoMapping(rsw, resultMap, columnPrefix, constructorArgTypes,
constructorArgs, constructor, foundValues);
} else {
foundValues = applyColumnOrderBasedConstructorAutomapping(rsw, constructorArgTypes, constructorArgs, constructor,
foundValues);
Expand All @@ -789,8 +789,8 @@ private boolean applyColumnOrderBasedConstructorAutomapping(ResultSetWrapper rsw
}

private boolean applyArgNameBasedConstructorAutoMapping(ResultSetWrapper rsw, ResultMap resultMap,
String columnPrefix, Class<?> resultType, List<Class<?>> constructorArgTypes, List<Object> constructorArgs,
Constructor<?> constructor, boolean foundValues) throws SQLException {
String columnPrefix, List<Class<?>> constructorArgTypes, List<Object> constructorArgs, Constructor<?> constructor,
boolean foundValues) throws SQLException {
List<String> missingArgs = null;
Parameter[] params = constructor.getParameters();
for (Parameter param : params) {
Expand Down
Expand Up @@ -51,7 +51,6 @@ public class ResultSetWrapper {
private final Map<String, List<String>> unMappedColumnNamesMap = new HashMap<>();

public ResultSetWrapper(ResultSet rs, Configuration configuration) throws SQLException {
super();
this.typeHandlerRegistry = configuration.getTypeHandlerRegistry();
this.resultSet = rs;
final ResultSetMetaData metaData = rs.getMetaData();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/apache/ibatis/io/VFS.java
Expand Up @@ -50,8 +50,7 @@ private static class VFSHolder {
@SuppressWarnings("unchecked")
static VFS createVFS() {
// Try the user implementations first, then the built-ins
List<Class<? extends VFS>> impls = new ArrayList<>();
impls.addAll(USER_IMPLEMENTATIONS);
List<Class<? extends VFS>> impls = new ArrayList<>(USER_IMPLEMENTATIONS);
impls.addAll(Arrays.asList((Class<? extends VFS>[]) IMPLEMENTATIONS));

// Try each implementation class until a valid one is found
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/apache/ibatis/jdbc/AbstractSQL.java
Expand Up @@ -538,7 +538,6 @@ private static class SafeAppendable {
private boolean empty = true;

public SafeAppendable(Appendable a) {
super();
this.appendable = a;
}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,6 @@ public class RuntimeSqlException extends RuntimeException {
private static final long serialVersionUID = 5224696788505678598L;

public RuntimeSqlException() {
super();
}

public RuntimeSqlException(String message) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/ibatis/jdbc/ScriptRunner.java
Expand Up @@ -248,7 +248,7 @@ private void executeStatement(String command) throws SQLException {
}
try {
boolean hasResults = statement.execute(sql);
while (!(!hasResults && statement.getUpdateCount() == -1)) {
while ((hasResults || (statement.getUpdateCount() != -1))) {
checkWarnings(statement);
printResults(statement, hasResults);
hasResults = statement.getMoreResults();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/apache/ibatis/logging/LogException.java
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,6 @@ public class LogException extends PersistenceException {
private static final long serialVersionUID = 1022924004852350942L;

public LogException() {
super();
}

public LogException(String message) {
Expand Down

0 comments on commit b175c22

Please sign in to comment.