Make inner classes static

This commit is contained in:
Mahmoud Ben Hassine
2023-07-04 21:03:36 +02:00
parent 167f3c427d
commit 5c8cb7663f
16 changed files with 33 additions and 27 deletions

View File

@@ -353,7 +353,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
* @author Dave Syer
*
*/
private final class JobInstanceRowMapper implements RowMapper<JobInstance> {
private static final class JobInstanceRowMapper implements RowMapper<JobInstance> {
public JobInstanceRowMapper() {
}

View File

@@ -694,7 +694,7 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
* must be handled in the implementation or the step will terminate
*
*/
private class TerminateOnExceptionChunkListenerDelegate implements ChunkListener {
private static class TerminateOnExceptionChunkListenerDelegate implements ChunkListener {
private ChunkListener chunkListener;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 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.
@@ -52,11 +52,12 @@ import java.util.List;
* other items in the same batch fail fatally first.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class BatchRetryTemplate implements RetryOperations {
private class BatchRetryState extends DefaultRetryState {
private static class BatchRetryState extends DefaultRetryState {
private final Collection<RetryState> keys;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -37,6 +37,7 @@ import org.springframework.core.Ordered;
/**
* @author Lucas Ward
* @author Mahmoud Ben Hassine
*
*/
class JobListenerFactoryBeanTests {
@@ -233,7 +234,7 @@ class JobListenerFactoryBeanTests {
assertThrows(IllegalArgumentException.class, factoryBean::getObject);
}
private class JobListenerWithInterface implements JobExecutionListener {
private static class JobListenerWithInterface implements JobExecutionListener {
boolean beforeJobCalled = false;
@@ -251,7 +252,7 @@ class JobListenerFactoryBeanTests {
}
private class AnnotatedTestClass {
private static class AnnotatedTestClass {
boolean beforeJobCalled = false;

View File

@@ -548,7 +548,7 @@ class MulticasterBatchListenerTests {
assertEquals("listener error", message, "Wrong message: " + message);
}
private final class AnnotationBasedStepListener {
private static final class AnnotationBasedStepListener {
private IllegalStateException exception = new IllegalStateException("listener error");

View File

@@ -363,7 +363,7 @@ class StepListenerFactoryBeanTests {
assertThrows(IllegalArgumentException.class, factoryBean::getObject);
}
private class MultipleAfterStep implements StepExecutionListener {
private static class MultipleAfterStep implements StepExecutionListener {
int callcount = 0;
@@ -384,7 +384,7 @@ class StepListenerFactoryBeanTests {
}
@SuppressWarnings("unused")
private class ThreeStepExecutionListener implements StepExecutionListener {
private static class ThreeStepExecutionListener implements StepExecutionListener {
int callcount = 0;
@@ -413,7 +413,7 @@ class StepListenerFactoryBeanTests {
}
@SuppressWarnings("unused")
private class TestListener implements SkipListener<String, Integer> {
private static class TestListener implements SkipListener<String, Integer> {
boolean beforeStepCalled = false;

View File

@@ -589,7 +589,7 @@ class FaultTolerantStepFactoryBeanRollbackTests {
return map;
}
class ExceptionThrowingChunkListener implements ChunkListener {
static class ExceptionThrowingChunkListener implements ChunkListener {
private int phase = -1;

View File

@@ -929,7 +929,7 @@ class TaskletStepTests {
}
private class MockRestartableItemReader extends AbstractItemStreamItemReader<String>
private static class MockRestartableItemReader extends AbstractItemStreamItemReader<String>
implements StepExecutionListener {
private boolean getExecutionAttributesCalled = false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-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.
@@ -199,7 +199,7 @@ class MappingLdifReaderBuilderTests {
}
public class TestMapper implements RecordMapper<LdapAttributes> {
public static class TestMapper implements RecordMapper<LdapAttributes> {
@Nullable
@Override

View File

@@ -260,7 +260,7 @@ class FaultTolerantStepIntegrationTests {
return stepExecution;
}
private class SkipIllegalArgumentExceptionSkipPolicy implements SkipPolicy {
private static class SkipIllegalArgumentExceptionSkipPolicy implements SkipPolicy {
@Override
public boolean shouldSkip(Throwable throwable, long skipCount) throws SkipLimitExceededException {

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.
@@ -31,6 +31,7 @@ import org.springframework.core.io.Resource;
* implementation.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.1
*/
public class SimpleBinaryBufferedReaderFactory implements BufferedReaderFactory {
@@ -61,7 +62,7 @@ public class SimpleBinaryBufferedReaderFactory implements BufferedReaderFactory
* @author Dave Syer
*
*/
private final class BinaryBufferedReader extends BufferedReader {
private static final class BinaryBufferedReader extends BufferedReader {
private final String ending;

View File

@@ -54,7 +54,7 @@ public class JdbcBatchItemWriterNamedParameterTests {
private final String sql = "update foo set bar = :bar where id = :id";
@SuppressWarnings("unused")
private class Foo {
private static class Foo {
private Long id;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -29,6 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Lucas Ward
* @author Mahmoud Ben Hassine
*
*/
class SimpleMethodInvokerTests {
@@ -106,7 +107,7 @@ class SimpleMethodInvokerTests {
}
@SuppressWarnings("unused")
private class TestClass {
private static class TestClass {
boolean beforeCalled = false;

View File

@@ -193,7 +193,7 @@ class AsyncItemWriterTests {
assertFalse(itemWriter.isClosed);
}
private class ListItemWriter implements ItemWriter<String> {
private static class ListItemWriter implements ItemWriter<String> {
protected List<String> items;
@@ -214,7 +214,7 @@ class AsyncItemWriterTests {
}
private class ListItemStreamWriter implements ItemStreamWriter<String> {
private static class ListItemStreamWriter implements ItemStreamWriter<String> {
public boolean isOpened = false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 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.
@@ -61,6 +61,7 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
*
* @author Dave Syer
* @author Jimmy Praet
* @author Mahmoud Ben Hassine
*/
public class JobScopeTestExecutionListener implements TestExecutionListener {
@@ -139,7 +140,7 @@ public class JobScopeTestExecutionListener implements TestExecutionListener {
* Look for a method returning the type provided, preferring one with the name
* provided.
*/
private final class ExtractorMethodCallback implements MethodCallback {
private static final class ExtractorMethodCallback implements MethodCallback {
private String preferredName;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 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.
@@ -62,6 +62,7 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
*
* @author Dave Syer
* @author Chris Schaefer
* @author Mahmoud Ben Hassine
*/
public class StepScopeTestExecutionListener implements TestExecutionListener {
@@ -142,7 +143,7 @@ public class StepScopeTestExecutionListener implements TestExecutionListener {
* Look for a method returning the type provided, preferring one with the name
* provided.
*/
private final class ExtractorMethodCallback implements MethodCallback {
private static final class ExtractorMethodCallback implements MethodCallback {
private String preferredName;