Skip to content

Commit

Permalink
Merge pull request #2819 from hazendaz/copyright
Browse files Browse the repository at this point in the history
[ci] Add final where appropriate per open rewrite
  • Loading branch information
hazendaz authored Feb 20, 2023
2 parents 105914b + aa38fec commit 4f04806
Show file tree
Hide file tree
Showing 42 changed files with 82 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class UnpooledDataSource implements DataSource {

private ClassLoader driverClassLoader;
private Properties driverProperties;
private static Map<String, Driver> registeredDrivers = new ConcurrentHashMap<>();
private static final Map<String, Driver> registeredDrivers = new ConcurrentHashMap<>();

private String driver;
private String url;
Expand Down Expand Up @@ -263,7 +263,7 @@ private void configureConnection(Connection conn) throws SQLException {
}

private static class DriverProxy implements Driver {
private Driver driver;
private final Driver driver;

DriverProxy(Driver d) {
this.driver = d;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static class LoadPair implements Serializable {
/**
* Name of the unread property.
*/
private String property;
private final String property;
/**
* ID of SQL statement which loads the property.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/ibatis/io/ResolverUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public interface Test {
public static class IsA implements Test {

/** The parent. */
private Class<?> parent;
private final Class<?> parent;

/**
* Constructs an IsA test using the supplied Class as the parent class/interface.
Expand Down Expand Up @@ -118,7 +118,7 @@ public String toString() {
public static class AnnotatedWith implements Test {

/** The annotation. */
private Class<? extends Annotation> annotation;
private final Class<? extends Annotation> annotation;

/**
* Constructs an AnnotatedWith test for the specified annotation type.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/ibatis/io/Resources.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
public class Resources {

private static ClassLoaderWrapper classLoaderWrapper = new ClassLoaderWrapper();
private static final ClassLoaderWrapper classLoaderWrapper = new ClassLoaderWrapper();

/**
* Charset to use when calling getResourceAsReader. null means use the system default.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/ibatis/mapping/Discriminator.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class Discriminator {
}

public static class Builder {
private Discriminator discriminator = new Discriminator();
private final Discriminator discriminator = new Discriminator();

public Builder(Configuration configuration, ResultMapping resultMapping, Map<String, String> discriminatorMap) {
discriminator.resultMapping = resultMapping;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public final class MappedStatement {
}

public static class Builder {
private MappedStatement mappedStatement = new MappedStatement();
private final MappedStatement mappedStatement = new MappedStatement();

public Builder(Configuration configuration, String id, SqlSource sqlSource, SqlCommandType sqlCommandType) {
mappedStatement.configuration = configuration;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/ibatis/mapping/ParameterMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private ParameterMap() {
}

public static class Builder {
private ParameterMap parameterMap = new ParameterMap();
private final ParameterMap parameterMap = new ParameterMap();

public Builder(Configuration configuration, String id, Class<?> type, List<ParameterMapping> parameterMappings) {
parameterMap.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private ParameterMapping() {
}

public static class Builder {
private ParameterMapping parameterMapping = new ParameterMapping();
private final ParameterMapping parameterMapping = new ParameterMapping();

public Builder(Configuration configuration, String property, TypeHandler<?> typeHandler) {
parameterMapping.configuration = configuration;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/ibatis/mapping/ResultMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private ResultMap() {
public static class Builder {
private static final Log log = LogFactory.getLog(Builder.class);

private ResultMap resultMap = new ResultMap();
private final ResultMap resultMap = new ResultMap();

public Builder(Configuration configuration, String id, Class<?> type, List<ResultMapping> resultMappings) {
this(configuration, id, type, resultMappings, null);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/ibatis/mapping/ResultMapping.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class ResultMapping {
}

public static class Builder {
private ResultMapping resultMapping = new ResultMapping();
private final ResultMapping resultMapping = new ResultMapping();

public Builder(Configuration configuration, String property, String column, TypeHandler<?> typeHandler) {
this(configuration, property);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/ibatis/reflection/Reflector.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class Reflector {
private final Map<String, Class<?>> getTypes = new HashMap<>();
private Constructor<?> defaultConstructor;

private Map<String, String> caseInsensitivePropertyMap = new HashMap<>();
private final Map<String, String> caseInsensitivePropertyMap = new HashMap<>();

public Reflector(Class<?> clazz) {
type = clazz;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ private TypeParameterResolver() {
}

static class ParameterizedTypeImpl implements ParameterizedType {
private Class<?> rawType;
private final Class<?> rawType;

private Type ownerType;
private final Type ownerType;

private Type[] actualTypeArguments;
private final Type[] actualTypeArguments;

public ParameterizedTypeImpl(Class<?> rawType, Type ownerType, Type[] actualTypeArguments) {
super();
Expand Down Expand Up @@ -282,9 +282,9 @@ public String toString() {
}

static class WildcardTypeImpl implements WildcardType {
private Type[] lowerBounds;
private final Type[] lowerBounds;

private Type[] upperBounds;
private final Type[] upperBounds;

WildcardTypeImpl(Type[] lowerBounds, Type[] upperBounds) {
super();
Expand All @@ -304,7 +304,7 @@ public Type[] getUpperBounds() {
}

static class GenericArrayTypeImpl implements GenericArrayType {
private Type genericComponentType;
private final Type genericComponentType;

GenericArrayTypeImpl(Type genericComponentType) {
super();
Expand Down
Original file line number Diff line number Diff line change
@@ -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 @@ -58,8 +58,8 @@ private GenericTokenParser createParser(TokenHandler handler) {

private static class BindingTokenParser implements TokenHandler {

private DynamicContext context;
private Pattern injectionFilter;
private final DynamicContext context;
private final Pattern injectionFilter;

public BindingTokenParser(DynamicContext context, Pattern injectionFilter) {
this.context = context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private static List<String> parseOverrides(String overrides) {
}

private class FilteredDynamicContext extends DynamicContext {
private DynamicContext delegate;
private final DynamicContext delegate;
private boolean prefixApplied;
private boolean suffixApplied;
private StringBuilder sqlBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
public class WhereSqlNode extends TrimSqlNode {

private static List<String> prefixList = Arrays.asList("AND ", "OR ", "AND\n", "OR\n", "AND\r", "OR\r", "AND\t",
private static final List<String> prefixList = Arrays.asList("AND ", "OR ", "AND\n", "OR\n", "AND\r", "OR\r", "AND\t",
"OR\t");

public WhereSqlNode(Configuration configuration, SqlNode contents) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/ibatis/type/JdbcType.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public enum JdbcType {
TIMESTAMP_WITH_TIMEZONE(Types.TIMESTAMP_WITH_TIMEZONE); // JDBC 4.2 JDK8

public final int TYPE_CODE;
private static Map<Integer, JdbcType> codeLookup = new HashMap<>();
private static final Map<Integer, JdbcType> codeLookup = new HashMap<>();

static {
for (JdbcType type : JdbcType.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class ExpressionEvaluatorTest {

private ExpressionEvaluator evaluator = new ExpressionEvaluator();
private final ExpressionEvaluator evaluator = new ExpressionEvaluator();

@Test
void shouldCompareStringsReturnTrue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public Context getInitialContext(Hashtable<?, ?> environment) throws NamingExcep
}

public static class MockContext extends InitialContext {
private static Map<String, Object> bindings = new HashMap<>();
private static final Map<String, Object> bindings = new HashMap<>();

MockContext(boolean lazy) throws NamingException {
super(lazy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
class LanguageDriverRegistryTest {

private LanguageDriverRegistry registry = new LanguageDriverRegistry();
private final LanguageDriverRegistry registry = new LanguageDriverRegistry();

@Test
void registerByType() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 @@ -17,8 +17,8 @@

public class User {

private Integer id;
private String name;
private final Integer id;
private final String name;
private Long team;

public User(Integer id, String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 @@ -19,8 +19,8 @@

public class User2 {

private Integer userId;
private String name;
private final Integer userId;
private final String name;

public User2(Integer userId, @Param("userName") String name) {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class SimpleChildObject {

private String id;
private final String id;
private SimpleObject parentSimpleObject;

public SimpleChildObject(String id) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 @@ -20,8 +20,8 @@

public class SimpleObject {

private String id;
private List<SimpleChildObject> simpleChildObjects;
private final String id;
private final List<SimpleChildObject> simpleChildObjects;

public SimpleObject(String id) {
this.id = id;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 @@ -17,13 +17,13 @@

public class Article {

private EntityKey id;
private final EntityKey id;

private String name;
private final String name;

private Author author;
private final Author author;

private Author coauthor;
private final Author coauthor;

public Article(EntityKey id, String name, Author author, Author coauthor) {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

public class CustomCollection<T> {

private List<T> data = new ArrayList<>();
private final List<T> data = new ArrayList<>();

public <K> K[] toArray(K[] a) {
return data.toArray(a);
Expand Down
Original file line number Diff line number Diff line change
@@ -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,7 @@

public class CustomObjectWrapper implements org.apache.ibatis.reflection.wrapper.ObjectWrapper {

private CustomCollection collection;
private final CustomCollection collection;

public CustomObjectWrapper(CustomCollection collection) {
this.collection = collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void initDatabase() throws Exception {
void testDeferLoadAfterResultHandler() {
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
class MyResultHandler implements ResultHandler {
private List<Child> children = new ArrayList<>();
private final List<Child> children = new ArrayList<>();

@Override
public void handleResult(ResultContext context) {
Expand Down Expand Up @@ -90,7 +90,7 @@ public void handleResult(ResultContext context) {
void testDeferLoadAfterResultHandlerWithLazyLoad() {
try (SqlSession sqlSession = lazyLoadSqlSessionFactory.openSession()) {
class MyResultHandler implements ResultHandler {
private List<Child> children = new ArrayList<>();
private final List<Child> children = new ArrayList<>();

@Override
public void handleResult(ResultContext context) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 @@ -29,6 +29,6 @@ public Boolean getB() {
return b;
}

private Integer a;
private Boolean b;
private final Integer a;
private final Boolean b;
}
Original file line number Diff line number Diff line change
@@ -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 @@ -1017,7 +1017,7 @@ public class Code {
public static final Code _999 = new Code("999");
public static final Code _1000 = new Code("1000");

private String value;
private final String value;

public Code(String aValue) {
value = aValue;
Expand Down
Loading

0 comments on commit 4f04806

Please sign in to comment.