Mark fields as final where appropriate

This commit is contained in:
Mahmoud Ben Hassine
2023-07-04 21:45:20 +02:00
parent 241e37e672
commit 0a1cdb095f
166 changed files with 411 additions and 365 deletions

View File

@@ -17,11 +17,12 @@ import org.springframework.util.Assert;
* case the <code>receive()</code> can join a transaction which was started by the caller.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class MessageSourcePollerInterceptor implements ChannelInterceptor, InitializingBean {
private static Log logger = LogFactory.getLog(MessageSourcePollerInterceptor.class);
private static final Log logger = LogFactory.getLog(MessageSourcePollerInterceptor.class);
private MessageSource<?> source;

View File

@@ -51,7 +51,7 @@ import org.springframework.util.ReflectionUtils;
*/
public class RemoteChunkHandlerFactoryBean<T> implements FactoryBean<ChunkHandler<T>> {
private static Log logger = LogFactory.getLog(RemoteChunkHandlerFactoryBean.class);
private static final Log logger = LogFactory.getLog(RemoteChunkHandlerFactoryBean.class);
private TaskletStep step;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2022 the original author or authors.
* Copyright 2019-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.
@@ -27,9 +27,9 @@ import org.springframework.transaction.PlatformTransactionManager;
*/
public class RemoteChunkingManagerStepBuilderFactory {
private JobRepository jobRepository;
private final JobRepository jobRepository;
private PlatformTransactionManager transactionManager;
private final PlatformTransactionManager transactionManager;
/**
* Create a new {@link RemoteChunkingManagerStepBuilderFactory}.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2022 the original author or authors.
* Copyright 2018-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.
@@ -36,11 +36,11 @@ import org.springframework.transaction.PlatformTransactionManager;
@Configuration(proxyBeanMethods = false)
public class BatchIntegrationConfiguration implements InitializingBean {
private JobExplorer jobExplorer;
private final JobExplorer jobExplorer;
private JobRepository jobRepository;
private final JobRepository jobRepository;
private PlatformTransactionManager transactionManager;
private final PlatformTransactionManager transactionManager;
private RemoteChunkingManagerStepBuilderFactory remoteChunkingManagerStepBuilderFactory;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-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.
@@ -114,7 +114,7 @@ public class RemoteChunkingWorkerParser extends AbstractBeanDefinitionParser {
private static final String CHUNK_PROCESSOR_CHUNK_HANDLER_BEAN_NAME_PREFIX = "chunkProcessorChunkHandler_";
private String id;
private final String id;
public ServiceActivatorParser(String id) {
this.id = id;

View File

@@ -88,7 +88,7 @@ import org.springframework.util.CollectionUtils;
@MessageEndpoint
public class MessageChannelPartitionHandler extends AbstractPartitionHandler implements InitializingBean {
private static Log logger = LogFactory.getLog(MessageChannelPartitionHandler.class);
private static final Log logger = LogFactory.getLog(MessageChannelPartitionHandler.class);
private MessagingTemplate messagingGateway;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-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.
@@ -21,11 +21,12 @@ import org.springframework.batch.core.StepExecution;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class StepSupport implements Step {
private String name;
private final String name;
private int startLimit = 1;

View File

@@ -254,7 +254,7 @@ class RemoteChunkingManagerStepBuilderTests {
int count = 0;
List<String> items = Arrays.asList("a", "b", "c", "d", "d", "e", "f", "g", "h", "i");
final List<String> items = Arrays.asList("a", "b", "c", "d", "d", "e", "f", "g", "h", "i");
@Nullable
@Override

View File

@@ -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.
@@ -47,7 +47,7 @@ class BeanFactoryStepLocatorTests {
private static final class StubStep implements Step {
private String name;
private final String name;
public StubStep(String name) {
this.name = name;

View File

@@ -13,9 +13,9 @@ import org.springframework.lang.Nullable;
*/
public class ExampleItemReader implements ItemReader<String>, ItemStream {
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private String[] input = { "Hello", "world!", "Go", "on", "punk", "make", "my", "day!" };
private final String[] input = { "Hello", "world!", "Go", "on", "punk", "make", "my", "day!" };
private int index = 0;

View File

@@ -9,11 +9,12 @@ import org.springframework.retry.interceptor.MethodInvocationRecoverer;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public final class SimpleRecoverer implements MethodInvocationRecoverer<String> {
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private final List<String> recovered = new ArrayList<>();

View File

@@ -13,13 +13,13 @@ import org.springframework.integration.annotation.ServiceActivator;
@MessageEndpoint
public class SimpleService implements Service {
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private List<String> processed = new CopyOnWriteArrayList<>();
private final List<String> processed = new CopyOnWriteArrayList<>();
private List<String> expected = new ArrayList<>();
private AtomicInteger count = new AtomicInteger(0);
private final AtomicInteger count = new AtomicInteger(0);
public void setExpected(List<String> expected) {
this.expected = expected;