Skip to content

Commit 5c8cb76

Browse files
committed
Make inner classes static
1 parent 167f3c4 commit 5c8cb76

File tree

16 files changed

+33
-27
lines changed

16 files changed

+33
-27
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ public void afterPropertiesSet() throws Exception {
353353
* @author Dave Syer
354354
*
355355
*/
356-
private final class JobInstanceRowMapper implements RowMapper<JobInstance> {
356+
private static final class JobInstanceRowMapper implements RowMapper<JobInstance> {
357357

358358
public JobInstanceRowMapper() {
359359
}

spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/FaultTolerantStepBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ private void addNonRetryableExceptionIfMissing(Class<? extends Throwable>... cls
694694
* must be handled in the implementation or the step will terminate
695695
*
696696
*/
697-
private class TerminateOnExceptionChunkListenerDelegate implements ChunkListener {
697+
private static class TerminateOnExceptionChunkListenerDelegate implements ChunkListener {
698698

699699
private ChunkListener chunkListener;
700700

spring-batch-core/src/main/java/org/springframework/batch/core/step/item/BatchRetryTemplate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2013 the original author or authors.
2+
* Copyright 2006-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -52,11 +52,12 @@
5252
* other items in the same batch fail fatally first.
5353
*
5454
* @author Dave Syer
55+
* @author Mahmoud Ben Hassine
5556
*
5657
*/
5758
public class BatchRetryTemplate implements RetryOperations {
5859

59-
private class BatchRetryState extends DefaultRetryState {
60+
private static class BatchRetryState extends DefaultRetryState {
6061

6162
private final Collection<RetryState> keys;
6263

spring-batch-core/src/test/java/org/springframework/batch/core/listener/JobListenerFactoryBeanTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@
3737

3838
/**
3939
* @author Lucas Ward
40+
* @author Mahmoud Ben Hassine
4041
*
4142
*/
4243
class JobListenerFactoryBeanTests {
@@ -233,7 +234,7 @@ public void aMethod(Integer item) {
233234
assertThrows(IllegalArgumentException.class, factoryBean::getObject);
234235
}
235236

236-
private class JobListenerWithInterface implements JobExecutionListener {
237+
private static class JobListenerWithInterface implements JobExecutionListener {
237238

238239
boolean beforeJobCalled = false;
239240

@@ -251,7 +252,7 @@ public void beforeJob(JobExecution jobExecution) {
251252

252253
}
253254

254-
private class AnnotatedTestClass {
255+
private static class AnnotatedTestClass {
255256

256257
boolean beforeJobCalled = false;
257258

spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ void testAfterChunkFails_withAnnotatedListener() {
548548
assertEquals("listener error", message, "Wrong message: " + message);
549549
}
550550

551-
private final class AnnotationBasedStepListener {
551+
private static final class AnnotationBasedStepListener {
552552

553553
private IllegalStateException exception = new IllegalStateException("listener error");
554554

spring-batch-core/src/test/java/org/springframework/batch/core/listener/StepListenerFactoryBeanTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ public void aMethod(Integer item) {
363363
assertThrows(IllegalArgumentException.class, factoryBean::getObject);
364364
}
365365

366-
private class MultipleAfterStep implements StepExecutionListener {
366+
private static class MultipleAfterStep implements StepExecutionListener {
367367

368368
int callcount = 0;
369369

@@ -384,7 +384,7 @@ public void beforeStep(StepExecution stepExecution) {
384384
}
385385

386386
@SuppressWarnings("unused")
387-
private class ThreeStepExecutionListener implements StepExecutionListener {
387+
private static class ThreeStepExecutionListener implements StepExecutionListener {
388388

389389
int callcount = 0;
390390

@@ -413,7 +413,7 @@ public void after() {
413413
}
414414

415415
@SuppressWarnings("unused")
416-
private class TestListener implements SkipListener<String, Integer> {
416+
private static class TestListener implements SkipListener<String, Integer> {
417417

418418
boolean beforeStepCalled = false;
419419

spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRollbackTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ private Map<Class<? extends Throwable>, Boolean> getExceptionMap(Class<? extends
589589
return map;
590590
}
591591

592-
class ExceptionThrowingChunkListener implements ChunkListener {
592+
static class ExceptionThrowingChunkListener implements ChunkListener {
593593

594594
private int phase = -1;
595595

spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ public void update(StepExecution stepExecution) {
929929

930930
}
931931

932-
private class MockRestartableItemReader extends AbstractItemStreamItemReader<String>
932+
private static class MockRestartableItemReader extends AbstractItemStreamItemReader<String>
933933
implements StepExecutionListener {
934934

935935
private boolean getExecutionAttributesCalled = false;

spring-batch-core/src/test/java/org/springframework/batch/core/test/ldif/builder/MappingLdifReaderBuilderTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2022 the original author or authors.
2+
* Copyright 2017-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -199,7 +199,7 @@ public void handleRecord(LdapAttributes attributes) {
199199

200200
}
201201

202-
public class TestMapper implements RecordMapper<LdapAttributes> {
202+
public static class TestMapper implements RecordMapper<LdapAttributes> {
203203

204204
@Nullable
205205
@Override

spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ private StepExecution execute(Step step) throws Exception {
260260
return stepExecution;
261261
}
262262

263-
private class SkipIllegalArgumentExceptionSkipPolicy implements SkipPolicy {
263+
private static class SkipIllegalArgumentExceptionSkipPolicy implements SkipPolicy {
264264

265265
@Override
266266
public boolean shouldSkip(Throwable throwable, long skipCount) throws SkipLimitExceededException {

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/SimpleBinaryBufferedReaderFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2007 the original author or authors.
2+
* Copyright 2006-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@
3131
* implementation.
3232
*
3333
* @author Dave Syer
34+
* @author Mahmoud Ben Hassine
3435
* @since 2.1
3536
*/
3637
public class SimpleBinaryBufferedReaderFactory implements BufferedReaderFactory {
@@ -61,7 +62,7 @@ public BufferedReader create(Resource resource, String encoding) throws Unsuppor
6162
* @author Dave Syer
6263
*
6364
*/
64-
private final class BinaryBufferedReader extends BufferedReader {
65+
private static final class BinaryBufferedReader extends BufferedReader {
6566

6667
private final String ending;
6768

spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class JdbcBatchItemWriterNamedParameterTests {
5454
private final String sql = "update foo set bar = :bar where id = :id";
5555

5656
@SuppressWarnings("unused")
57-
private class Foo {
57+
private static class Foo {
5858

5959
private Long id;
6060

spring-batch-infrastructure/src/test/java/org/springframework/batch/support/SimpleMethodInvokerTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
2929

3030
/**
3131
* @author Lucas Ward
32+
* @author Mahmoud Ben Hassine
3233
*
3334
*/
3435
class SimpleMethodInvokerTests {
@@ -106,7 +107,7 @@ void testEquals() throws Exception {
106107
}
107108

108109
@SuppressWarnings("unused")
109-
private class TestClass {
110+
private static class TestClass {
110111

111112
boolean beforeCalled = false;
112113

spring-batch-integration/src/test/java/org/springframework/batch/integration/async/AsyncItemWriterTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ void testNonStreamDelegate() throws Exception {
193193
assertFalse(itemWriter.isClosed);
194194
}
195195

196-
private class ListItemWriter implements ItemWriter<String> {
196+
private static class ListItemWriter implements ItemWriter<String> {
197197

198198
protected List<String> items;
199199

@@ -214,7 +214,7 @@ public void write(Chunk<? extends String> chunk) throws Exception {
214214

215215
}
216216

217-
private class ListItemStreamWriter implements ItemStreamWriter<String> {
217+
private static class ListItemStreamWriter implements ItemStreamWriter<String> {
218218

219219
public boolean isOpened = false;
220220

spring-batch-test/src/main/java/org/springframework/batch/test/JobScopeTestExecutionListener.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -61,6 +61,7 @@
6161
*
6262
* @author Dave Syer
6363
* @author Jimmy Praet
64+
* @author Mahmoud Ben Hassine
6465
*/
6566
public class JobScopeTestExecutionListener implements TestExecutionListener {
6667

@@ -139,7 +140,7 @@ protected JobExecution getJobExecution(TestContext testContext) {
139140
* Look for a method returning the type provided, preferring one with the name
140141
* provided.
141142
*/
142-
private final class ExtractorMethodCallback implements MethodCallback {
143+
private static final class ExtractorMethodCallback implements MethodCallback {
143144

144145
private String preferredName;
145146

spring-batch-test/src/main/java/org/springframework/batch/test/StepScopeTestExecutionListener.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -62,6 +62,7 @@
6262
*
6363
* @author Dave Syer
6464
* @author Chris Schaefer
65+
* @author Mahmoud Ben Hassine
6566
*/
6667
public class StepScopeTestExecutionListener implements TestExecutionListener {
6768

@@ -142,7 +143,7 @@ protected StepExecution getStepExecution(TestContext testContext) {
142143
* Look for a method returning the type provided, preferring one with the name
143144
* provided.
144145
*/
145-
private final class ExtractorMethodCallback implements MethodCallback {
146+
private static final class ExtractorMethodCallback implements MethodCallback {
146147

147148
private String preferredName;
148149

0 commit comments

Comments
 (0)