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

@@ -69,7 +69,7 @@ import org.springframework.lang.Nullable;
*/
public class JobLauncherTestUtils {
private SecureRandom secureRandom = new SecureRandom();
private final SecureRandom secureRandom = new SecureRandom();
/** Logger */
protected final Log logger = LogFactory.getLog(getClass());

View File

@@ -142,7 +142,7 @@ public class JobScopeTestExecutionListener implements TestExecutionListener {
*/
private static final class ExtractorMethodCallback implements MethodCallback {
private String preferredName;
private final String preferredName;
private final Class<?> preferredType;

View File

@@ -70,9 +70,9 @@ public class StepRunner {
/** Logger */
protected final Log logger = LogFactory.getLog(getClass());
private JobLauncher launcher;
private final JobLauncher launcher;
private JobRepository jobRepository;
private final JobRepository jobRepository;
public StepRunner(JobLauncher launcher, JobRepository jobRepository) {
this.launcher = launcher;

View File

@@ -145,7 +145,7 @@ public class StepScopeTestExecutionListener implements TestExecutionListener {
*/
private static final class ExtractorMethodCallback implements MethodCallback {
private String preferredName;
private final String preferredName;
private final Class<?> preferredType;

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.
@@ -25,10 +25,11 @@ import org.aspectj.lang.JoinPoint;
* representation of the object to the log.
*
* @author Lucas Ward
* @author Mahmoud Ben Hassine
*/
public class LogAdvice {
private static Log log = LogFactory.getLog(LogAdvice.class);
private static final Log log = LogFactory.getLog(LogAdvice.class);
/*
* Wraps original method and adds logging both before and after method

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2012 the original author or authors.
* Copyright 2008-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.
@@ -19,12 +19,13 @@ import org.springframework.context.ApplicationEvent;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
@SuppressWarnings("serial")
public class SimpleMessageApplicationEvent extends ApplicationEvent {
private String message;
private final String message;
public SimpleMessageApplicationEvent(Object source, String message) {
super(source);