diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java index 790afb728..5ffe0c36d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java @@ -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. @@ -38,6 +38,7 @@ import org.springframework.core.task.TaskRejectedException; * subflows. * * @author Dave Syer + * @author Mahmoud Ben Hassine * @since 2.0 */ public class SplitState extends AbstractState implements FlowHolder { @@ -88,7 +89,7 @@ public class SplitState extends AbstractState implements FlowHolder { for (final Flow flow : flows) { - final FutureTask task = new FutureTask<>(new Callable() { + final FutureTask task = new FutureTask<>(new Callable<>() { @Override public FlowExecution call() throws Exception { return flow.start(executor); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandler.java index de5207ccf..53d43835f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandler.java @@ -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. @@ -43,6 +43,7 @@ import org.springframework.util.Assert; * * @author Sebastien Gerard * @author Dave Syer + * @author Mahmoud Ben Hassine * @since 2.0 */ public class TaskExecutorPartitionHandler extends AbstractPartitionHandler implements StepHolder, InitializingBean { @@ -128,7 +129,7 @@ public class TaskExecutorPartitionHandler extends AbstractPartitionHandler imple * @return the task executing the given step */ protected FutureTask createTask(final Step step, final StepExecution stepExecution) { - return new FutureTask<>(new Callable() { + return new FutureTask<>(new Callable<>() { @Override public StepExecution call() throws Exception { step.execute(stepExecution); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/Jackson2ExecutionContextStringSerializer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/Jackson2ExecutionContextStringSerializer.java index e0488f59a..34489d14b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/Jackson2ExecutionContextStringSerializer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/Jackson2ExecutionContextStringSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -142,7 +142,7 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex public Map deserialize(InputStream in) throws IOException { - TypeReference> typeRef = new TypeReference>() { + TypeReference> typeRef = new TypeReference<>() { }; return objectMapper.readValue(in, typeRef); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java index 3a9a627c3..7b924b2d8 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java @@ -221,7 +221,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements */ @Override public List getJobNames() { - return getJdbcTemplate().query(getQuery(FIND_JOB_NAMES), new RowMapper() { + return getJdbcTemplate().query(getQuery(FIND_JOB_NAMES), new RowMapper<>() { @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(1); @@ -238,7 +238,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements @Override public List getJobInstances(String jobName, final int start, final int count) { - ResultSetExtractor> extractor = new ResultSetExtractor>() { + ResultSetExtractor> extractor = new ResultSetExtractor<>() { private List list = new ArrayList<>(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java index 8e234046a..0471cb414 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2021 the original author or authors. + * Copyright 2013-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. @@ -33,7 +33,7 @@ import org.springframework.lang.Nullable; */ public class JobSynchronizationManager { - private static final SynchronizationManagerSupport manager = new SynchronizationManagerSupport() { + private static final SynchronizationManagerSupport manager = new SynchronizationManagerSupport<>() { @Override protected JobContext createNewContext(JobExecution execution) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.java index 9565d9cd2..9fbf4ef85 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.java @@ -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. @@ -33,7 +33,7 @@ import org.springframework.lang.Nullable; */ public class StepSynchronizationManager { - private static final SynchronizationManagerSupport manager = new SynchronizationManagerSupport() { + private static final SynchronizationManagerSupport manager = new SynchronizationManagerSupport<>() { @Override protected StepContext createNewContext(StepExecution execution) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessor.java index 0a7727119..12add7895 100755 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -215,7 +215,7 @@ public class FaultTolerantChunkProcessor extends SimpleChunkProcessor retryCallback = new RetryCallback() { + RetryCallback retryCallback = new RetryCallback<>() { @Override public O doWithRetry(RetryContext context) throws Exception { @@ -274,7 +274,7 @@ public class FaultTolerantChunkProcessor extends SimpleChunkProcessor recoveryCallback = new RecoveryCallback() { + RecoveryCallback recoveryCallback = new RecoveryCallback<>() { @Override public O recover(RetryContext context) throws Exception { @@ -328,7 +328,7 @@ public class FaultTolerantChunkProcessor extends SimpleChunkProcessor data = (UserData) inputs.getUserData(); final AtomicReference contextHolder = new AtomicReference<>(); - RetryCallback retryCallback = new RetryCallback() { + RetryCallback retryCallback = new RetryCallback<>() { @Override public Object doWithRetry(RetryContext context) throws Exception { contextHolder.set(context); @@ -368,7 +368,7 @@ public class FaultTolerantChunkProcessor extends SimpleChunkProcessor batchRecoveryCallback = new RecoveryCallback() { + RecoveryCallback batchRecoveryCallback = new RecoveryCallback<>() { @Override public Object recover(RetryContext context) throws Exception { @@ -406,7 +406,7 @@ public class FaultTolerantChunkProcessor extends SimpleChunkProcessor recoveryCallback = new RecoveryCallback() { + RecoveryCallback recoveryCallback = new RecoveryCallback<>() { @Override public Object recover(RetryContext context) throws Exception { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/SystemCommandTasklet.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/SystemCommandTasklet.java index 3cbaaa913..dbac634cd 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/SystemCommandTasklet.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/SystemCommandTasklet.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -100,7 +100,7 @@ public class SystemCommandTasklet implements StepExecutionListener, StoppableTas @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { - FutureTask systemCommandTask = new FutureTask<>(new Callable() { + FutureTask systemCommandTask = new FutureTask<>(new Callable<>() { @Override public Integer call() throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemReadListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemReadListenerTests.java index 4eac6ade0..f559b8a3c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemReadListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemReadListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -26,6 +26,7 @@ import org.springframework.batch.core.ItemReadListener; /** * @author Lucas Ward * @author Will Schipp + * @author Mahmoud Ben Hassine * */ class CompositeItemReadListenerTests { @@ -66,7 +67,7 @@ class CompositeItemReadListenerTests { @Test void testSetListeners() { - compositeListener.setListeners(new ArrayList>() { + compositeListener.setListeners(new ArrayList<>() { { add(listener); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemWriteListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemWriteListenerTests.java index 650716b32..714f48bc3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemWriteListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemWriteListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -69,7 +69,7 @@ class CompositeItemWriteListenerTests { @Test void testSetListeners() { - compositeListener.setListeners(new ArrayList>() { + compositeListener.setListeners(new ArrayList<>() { { add(listener); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java index a4427c4af..fb08d4fee 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -345,7 +345,7 @@ class MulticasterBatchListenerTests { */ @Test void testOnSkipInRead() { - multicast.register(new SkipListener() { + multicast.register(new SkipListener<>() { @Override public void onSkipInRead(Throwable t) { count++; @@ -362,7 +362,7 @@ class MulticasterBatchListenerTests { */ @Test void testOnSkipInReadFails() { - multicast.register(new SkipListener() { + multicast.register(new SkipListener<>() { @Override public void onSkipInRead(Throwable t) { count++; @@ -383,7 +383,7 @@ class MulticasterBatchListenerTests { */ @Test void testOnSkipInWrite() { - multicast.register(new SkipListener() { + multicast.register(new SkipListener<>() { @Override public void onSkipInWrite(Object item, Throwable t) { count++; @@ -400,7 +400,7 @@ class MulticasterBatchListenerTests { */ @Test void testOnSkipInWriteFails() { - multicast.register(new SkipListener() { + multicast.register(new SkipListener<>() { @Override public void onSkipInWrite(Object item, Throwable t) { count++; @@ -421,7 +421,7 @@ class MulticasterBatchListenerTests { */ @Test void testOnSkipInProcess() { - multicast.register(new SkipListener() { + multicast.register(new SkipListener<>() { @Override public void onSkipInProcess(Object item, Throwable t) { count++; @@ -438,7 +438,7 @@ class MulticasterBatchListenerTests { */ @Test void testOnSkipInProcessFails() { - multicast.register(new SkipListener() { + multicast.register(new SkipListener<>() { @Override public void onSkipInProcess(Object item, Throwable t) { count++; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncJobScopeIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncJobScopeIntegrationTests.java index 86e418508..fddd692d7 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncJobScopeIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncJobScopeIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2022 the original author or authors. + * Copyright 2013-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. @@ -91,7 +91,7 @@ public class AsyncJobScopeIntegrationTests implements BeanFactoryAware { for (int i = 0; i < 12; i++) { final String value = "foo" + i; final Long id = 123L + i; - FutureTask task = new FutureTask<>(new Callable() { + FutureTask task = new FutureTask<>(new Callable<>() { @Override public String call() throws Exception { JobExecution jobExecution = new JobExecution(id); @@ -131,7 +131,7 @@ public class AsyncJobScopeIntegrationTests implements BeanFactoryAware { for (int i = 0; i < 12; i++) { final String value = "foo" + i; - FutureTask task = new FutureTask<>(new Callable() { + FutureTask task = new FutureTask<>(new Callable<>() { @Override public String call() throws Exception { ExecutionContext executionContext = jobExecution.getExecutionContext(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests.java index 23f1b22ed..c83247bcd 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -92,7 +92,7 @@ public class AsyncStepScopeIntegrationTests implements BeanFactoryAware { for (int i = 0; i < 12; i++) { final String value = "foo" + i; final Long id = 123L + i; - FutureTask task = new FutureTask<>(new Callable() { + FutureTask task = new FutureTask<>(new Callable<>() { @Override public String call() throws Exception { StepExecution stepExecution = new StepExecution(value, new JobExecution(0L), id); @@ -132,7 +132,7 @@ public class AsyncStepScopeIntegrationTests implements BeanFactoryAware { for (int i = 0; i < 12; i++) { final String value = "foo" + i; - FutureTask task = new FutureTask<>(new Callable() { + FutureTask task = new FutureTask<>(new Callable<>() { @Override public String call() throws Exception { ExecutionContext executionContext = stepExecution.getExecutionContext(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeTests.java index 4e9ec22c7..7c3d901ab 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/StepScopeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -38,6 +38,7 @@ import org.springframework.context.support.StaticApplicationContext; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ class StepScopeTests { @@ -63,7 +64,7 @@ class StepScopeTests { void testGetWithNoContext() { final String foo = "bar"; StepSynchronizationManager.close(); - assertThrows(IllegalStateException.class, () -> scope.get("foo", new ObjectFactory() { + assertThrows(IllegalStateException.class, () -> scope.get("foo", new ObjectFactory<>() { @Override public Object getObject() throws BeansException { return foo; @@ -74,7 +75,7 @@ class StepScopeTests { @Test void testGetWithNothingAlreadyThere() { final String foo = "bar"; - Object value = scope.get("foo", new ObjectFactory() { + Object value = scope.get("foo", new ObjectFactory<>() { @Override public Object getObject() throws BeansException { return foo; @@ -87,7 +88,7 @@ class StepScopeTests { @Test void testGetWithSomethingAlreadyThere() { context.setAttribute("foo", "bar"); - Object value = scope.get("foo", new ObjectFactory() { + Object value = scope.get("foo", new ObjectFactory<>() { @Override public Object getObject() throws BeansException { return null; @@ -101,7 +102,7 @@ class StepScopeTests { void testGetWithSomethingAlreadyInParentContext() { context.setAttribute("foo", "bar"); StepContext context = StepSynchronizationManager.register(new StepExecution("bar", new JobExecution(0L))); - Object value = scope.get("foo", new ObjectFactory() { + Object value = scope.get("foo", new ObjectFactory<>() { @Override public Object getObject() throws BeansException { return "spam"; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobSynchronizationManagerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobSynchronizationManagerTests.java index 628482835..9243030f2 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobSynchronizationManagerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/JobSynchronizationManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2022 the original author or authors. + * Copyright 2013-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. @@ -75,7 +75,7 @@ class JobSynchronizationManagerTests { void testMultithreaded() throws Exception { JobContext context = JobSynchronizationManager.register(jobExecution); ExecutorService executorService = Executors.newFixedThreadPool(2); - FutureTask task = new FutureTask<>(new Callable() { + FutureTask task = new FutureTask<>(new Callable<>() { @Override public JobContext call() throws Exception { try { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepSynchronizationManagerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepSynchronizationManagerTests.java index 98657de74..54fb67f55 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepSynchronizationManagerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepSynchronizationManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2022 the original author or authors. + * Copyright 2013-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. @@ -71,7 +71,7 @@ class StepSynchronizationManagerTests { void testMultithreaded() throws Exception { StepContext context = StepSynchronizationManager.register(stepExecution); ExecutorService executorService = Executors.newFixedThreadPool(2); - FutureTask task = new FutureTask<>(new Callable() { + FutureTask task = new FutureTask<>(new Callable<>() { @Override public StepContext call() throws Exception { try { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java index af4d23e1b..aaeb0f877 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2022 the original author or authors. + * Copyright 2013-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. @@ -144,7 +144,7 @@ class RegisterMultiListenerTests { @Bean public ItemReader reader() { - return new ItemReader() { + return new ItemReader<>() { private int count = 0; @@ -167,7 +167,7 @@ class RegisterMultiListenerTests { @Bean public ItemWriter writer() { - return new ItemWriter() { + return new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/BatchRetryTemplateTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/BatchRetryTemplateTests.java index 2cecc24da..e8526d750 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/BatchRetryTemplateTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/BatchRetryTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -70,7 +70,7 @@ class BatchRetryTemplateTests { BatchRetryTemplate template = new BatchRetryTemplate(); - RetryCallback retryCallback = new RetryCallback() { + RetryCallback retryCallback = new RetryCallback<>() { @Override public String[] doWithRetry(RetryContext context) throws Exception { assertEquals(count, context.getRetryCount()); @@ -97,7 +97,7 @@ class BatchRetryTemplateTests { template.setRetryPolicy(new SimpleRetryPolicy(1, Collections., Boolean>singletonMap(Exception.class, true))); - RetryCallback retryCallback = new RetryCallback() { + RetryCallback retryCallback = new RetryCallback<>() { @Override public String[] doWithRetry(RetryContext context) throws Exception { if (count++ < 2) { @@ -123,7 +123,7 @@ class BatchRetryTemplateTests { template.setRetryPolicy(new SimpleRetryPolicy(1, Collections., Boolean>singletonMap(Exception.class, true))); - RetryCallback retryCallback = new RetryCallback() { + RetryCallback retryCallback = new RetryCallback<>() { @Override public String[] doWithRetry(RetryContext context) throws Exception { if (count++ < 1) { @@ -166,7 +166,7 @@ class BatchRetryTemplateTests { template.setRetryPolicy(new SimpleRetryPolicy(1, Collections., Boolean>singletonMap(Exception.class, true))); - RetryCallback retryCallback = new RetryCallback() { + RetryCallback retryCallback = new RetryCallback<>() { @Override public String[] doWithRetry(RetryContext context) throws Exception { if (count++ < 2) { @@ -176,7 +176,7 @@ class BatchRetryTemplateTests { } }; - RecoveryCallback recoveryCallback = new RecoveryCallback() { + RecoveryCallback recoveryCallback = new RecoveryCallback<>() { @Override public String[] recover(RetryContext context) throws Exception { List recovered = new ArrayList<>(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkOrientedTaskletTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkOrientedTaskletTests.java index fefd08c95..3b4eed858 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkOrientedTaskletTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkOrientedTaskletTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -40,7 +40,7 @@ class ChunkOrientedTaskletTests { @Test void testHandle() throws Exception { - ChunkOrientedTasklet handler = new ChunkOrientedTasklet<>(new ChunkProvider() { + ChunkOrientedTasklet handler = new ChunkOrientedTasklet<>(new ChunkProvider<>() { @Override public Chunk provide(StepContribution contribution) throws Exception { contribution.incrementReadCount(); @@ -52,7 +52,7 @@ class ChunkOrientedTaskletTests { @Override public void postProcess(StepContribution contribution, Chunk chunk) { } - }, new ChunkProcessor() { + }, new ChunkProcessor<>() { @Override public void process(StepContribution contribution, Chunk chunk) { contribution.incrementWriteCount(1); @@ -68,7 +68,7 @@ class ChunkOrientedTaskletTests { @Test void testFail() { - ChunkOrientedTasklet handler = new ChunkOrientedTasklet<>(new ChunkProvider() { + ChunkOrientedTasklet handler = new ChunkOrientedTasklet<>(new ChunkProvider<>() { @Override public Chunk provide(StepContribution contribution) throws Exception { throw new RuntimeException("Foo!"); @@ -77,7 +77,7 @@ class ChunkOrientedTaskletTests { @Override public void postProcess(StepContribution contribution, Chunk chunk) { } - }, new ChunkProcessor() { + }, new ChunkProcessor<>() { @Override public void process(StepContribution contribution, Chunk chunk) { fail("Not expecting to get this far"); @@ -92,7 +92,7 @@ class ChunkOrientedTaskletTests { @Test void testExitCode() throws Exception { - ChunkOrientedTasklet handler = new ChunkOrientedTasklet<>(new ChunkProvider() { + ChunkOrientedTasklet handler = new ChunkOrientedTasklet<>(new ChunkProvider<>() { @Override public Chunk provide(StepContribution contribution) throws Exception { contribution.incrementReadCount(); @@ -105,7 +105,7 @@ class ChunkOrientedTaskletTests { @Override public void postProcess(StepContribution contribution, Chunk chunk) { } - }, new ChunkProcessor() { + }, new ChunkProcessor<>() { @Override public void process(StepContribution contribution, Chunk chunk) { contribution.incrementWriteCount(1); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessorTests.java index 2dc0b42a0..cdc824b7b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessorTests.java @@ -67,7 +67,7 @@ class FaultTolerantChunkProcessorTests { @BeforeEach void setUp() { batchRetryTemplate = new BatchRetryTemplate(); - processor = new FaultTolerantChunkProcessor<>(new PassThroughItemProcessor<>(), new ItemWriter() { + processor = new FaultTolerantChunkProcessor<>(new PassThroughItemProcessor<>(), new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { if (chunk.getItems().contains("fail")) { @@ -88,7 +88,7 @@ class FaultTolerantChunkProcessorTests { @Test void testTransform() throws Exception { - processor.setItemProcessor(new ItemProcessor() { + processor.setItemProcessor(new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { @@ -104,7 +104,7 @@ class FaultTolerantChunkProcessorTests { @Test void testFilterCountOnSkip() throws Exception { processor.setProcessSkipPolicy(new AlwaysSkipItemSkipPolicy()); - processor.setItemProcessor(new ItemProcessor() { + processor.setItemProcessor(new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { @@ -130,7 +130,7 @@ class FaultTolerantChunkProcessorTests { // BATCH-2663 void testFilterCountOnSkipInWriteWithoutRetry() throws Exception { processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy()); - processor.setItemProcessor(new ItemProcessor() { + processor.setItemProcessor(new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { @@ -161,7 +161,7 @@ class FaultTolerantChunkProcessorTests { retryPolicy.setMaxAttempts(3); batchRetryTemplate.setRetryPolicy(retryPolicy); processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy()); - processor.setItemProcessor(new ItemProcessor() { + processor.setItemProcessor(new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { @@ -194,7 +194,7 @@ class FaultTolerantChunkProcessorTests { @Test void testWriteSkipOnError() throws Exception { processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy()); - processor.setItemWriter(new ItemWriter() { + processor.setItemWriter(new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { if (chunk.getItems().contains("fail")) { @@ -211,7 +211,7 @@ class FaultTolerantChunkProcessorTests { @Test void testWriteSkipOnException() throws Exception { processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy()); - processor.setItemWriter(new ItemWriter() { + processor.setItemWriter(new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { if (chunk.getItems().contains("fail")) { @@ -233,7 +233,7 @@ class FaultTolerantChunkProcessorTests { @Test void testWriteSkipOnExceptionWithTrivialChunk() throws Exception { processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy()); - processor.setItemWriter(new ItemWriter() { + processor.setItemWriter(new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { if (chunk.getItems().contains("fail")) { @@ -256,7 +256,7 @@ class FaultTolerantChunkProcessorTests { @Test void testTransformWithExceptionAndNoRollback() throws Exception { - processor.setItemProcessor(new ItemProcessor() { + processor.setItemProcessor(new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { @@ -302,7 +302,7 @@ class FaultTolerantChunkProcessorTests { @Test void testAfterWriteAllPassedInRecovery() throws Exception { Chunk chunk = new Chunk<>(Arrays.asList("foo", "bar")); - processor = new FaultTolerantChunkProcessor<>(new PassThroughItemProcessor<>(), new ItemWriter() { + processor = new FaultTolerantChunkProcessor<>(new PassThroughItemProcessor<>(), new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { // Fail if there is more than one item @@ -349,7 +349,7 @@ class FaultTolerantChunkProcessorTests { @Test void testOnErrorInWriteAllItemsFail() throws Exception { Chunk chunk = new Chunk<>(Arrays.asList("foo", "bar")); - processor = new FaultTolerantChunkProcessor<>(new PassThroughItemProcessor<>(), new ItemWriter() { + processor = new FaultTolerantChunkProcessor<>(new PassThroughItemProcessor<>(), new ItemWriter<>() { @Override public void write(Chunk items) throws Exception { // Always fail in writer @@ -377,7 +377,7 @@ class FaultTolerantChunkProcessorTests { retryPolicy.setMaxAttempts(2); batchRetryTemplate.setRetryPolicy(retryPolicy); processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy()); - processor.setItemWriter(new ItemWriter() { + processor.setItemWriter(new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { if (chunk.getItems().contains("fail")) { @@ -410,7 +410,7 @@ class FaultTolerantChunkProcessorTests { retryPolicy.setMaxAttempts(2); batchRetryTemplate.setRetryPolicy(retryPolicy); processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy()); - processor.setItemWriter(new ItemWriter() { + processor.setItemWriter(new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { if (chunk.getItems().contains("fail")) { @@ -447,7 +447,7 @@ class FaultTolerantChunkProcessorTests { batchRetryTemplate.setRetryPolicy(retryPolicy); processor.setWriteSkipPolicy(new LimitCheckingItemSkipPolicy(1, Collections., Boolean>singletonMap(IllegalArgumentException.class, true))); - processor.setItemWriter(new ItemWriter() { + processor.setItemWriter(new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { if (chunk.getItems().contains("fail")) { @@ -485,7 +485,7 @@ class FaultTolerantChunkProcessorTests { final List processedItems = new ArrayList<>(); processor.setProcessorTransactional(false); processor.setProcessSkipPolicy(new AlwaysSkipItemSkipPolicy()); - processor.setItemProcessor(new ItemProcessor() { + processor.setItemProcessor(new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { @@ -521,7 +521,7 @@ class FaultTolerantChunkProcessorTests { final List processedItems = new ArrayList<>(); processor.setProcessorTransactional(false); processor.setProcessSkipPolicy(new AlwaysSkipItemSkipPolicy()); - processor.setItemProcessor(new ItemProcessor() { + processor.setItemProcessor(new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProviderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProviderTests.java index b0f87b7ed..a1b45c1fe 100755 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProviderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantChunkProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 the original author or authors. + * Copyright 2010-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. @@ -54,7 +54,7 @@ class FaultTolerantChunkProviderTests { @Test void testProvideWithOverflow() throws Exception { - provider = new FaultTolerantChunkProvider<>(new ItemReader() { + provider = new FaultTolerantChunkProvider<>(new ItemReader<>() { @Nullable @Override public String read() throws Exception, UnexpectedInputException, ParseException { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java index b135a8a3a..8f6c16582 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -90,7 +90,7 @@ class FaultTolerantStepFactoryBeanRetryTests { JobExecution jobExecution; - private ItemWriter writer = new ItemWriter() { + private ItemWriter writer = new ItemWriter<>() { @Override public void write(Chunk data) throws Exception { processed.addAll(data.getItems()); @@ -153,7 +153,7 @@ class FaultTolerantStepFactoryBeanRetryTests { factory.setJobRepository(repository); factory.setTransactionManager(new ResourcelessTransactionManager()); - ItemWriter failingWriter = new ItemWriter() { + ItemWriter failingWriter = new ItemWriter<>() { @Override public void write(Chunk data) throws Exception { int count = 0; @@ -166,7 +166,7 @@ class FaultTolerantStepFactoryBeanRetryTests { } }; - ItemProcessor processor = new ItemProcessor() { + ItemProcessor processor = new ItemProcessor<>() { @Nullable @Override public Integer process(String item) throws Exception { @@ -203,7 +203,7 @@ class FaultTolerantStepFactoryBeanRetryTests { void testProcessAllItemsWhenErrorInWriter() throws Exception { final int RETRY_LIMIT = 3; final List ITEM_LIST = Arrays.asList("a", "b", "c"); - ItemWriter failingWriter = new ItemWriter() { + ItemWriter failingWriter = new ItemWriter<>() { @Override public void write(Chunk data) throws Exception { int count = 0; @@ -216,7 +216,7 @@ class FaultTolerantStepFactoryBeanRetryTests { } }; - ItemProcessor processor = new ItemProcessor() { + ItemProcessor processor = new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { @@ -249,7 +249,7 @@ class FaultTolerantStepFactoryBeanRetryTests { @Test void testNoItemsReprocessedWhenErrorInWriterAndProcessorNotTransactional() throws Exception { - ItemWriter failingWriter = new ItemWriter() { + ItemWriter failingWriter = new ItemWriter<>() { @Override public void write(Chunk data) throws Exception { int count = 0; @@ -262,7 +262,7 @@ class FaultTolerantStepFactoryBeanRetryTests { } }; - ItemProcessor processor = new ItemProcessor() { + ItemProcessor processor = new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { @@ -295,7 +295,7 @@ class FaultTolerantStepFactoryBeanRetryTests { @SuppressWarnings("unchecked") @Test void testSuccessfulRetryWithReadFailure() throws Exception { - ItemReader provider = new ListItemReader(Arrays.asList("a", "b", "c")) { + ItemReader provider = new ListItemReader<>(Arrays.asList("a", "b", "c")) { @Nullable @Override public String read() { @@ -334,7 +334,7 @@ class FaultTolerantStepFactoryBeanRetryTests { factory.setSkipLimit(0); factory.setCommitInterval(3); - AbstractItemCountingItemStreamItemReader reader = new AbstractItemCountingItemStreamItemReader() { + AbstractItemCountingItemStreamItemReader reader = new AbstractItemCountingItemStreamItemReader<>() { private ItemReader reader; @@ -359,7 +359,7 @@ class FaultTolerantStepFactoryBeanRetryTests { reader.setName("foo"); factory.setItemReader(reader); factory.setStreams(new ItemStream[] { reader }); - factory.setItemWriter(new ItemWriter() { + factory.setItemWriter(new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { if (fail && chunk.getItems().contains("e")) { @@ -396,7 +396,7 @@ class FaultTolerantStepFactoryBeanRetryTests { void testSkipAndRetry() throws Exception { factory.setSkipLimit(2); - ItemReader provider = new ListItemReader(Arrays.asList("a", "b", "c", "d", "e", "f")) { + ItemReader provider = new ListItemReader<>(Arrays.asList("a", "b", "c", "d", "e", "f")) { @Nullable @Override public String read() { @@ -434,7 +434,7 @@ class FaultTolerantStepFactoryBeanRetryTests { } } }); factory.setSkipLimit(2); - ItemReader provider = new ListItemReader(Arrays.asList("a", "b", "c", "d", "e", "f")) { + ItemReader provider = new ListItemReader<>(Arrays.asList("a", "b", "c", "d", "e", "f")) { @Nullable @Override public String read() { @@ -446,7 +446,7 @@ class FaultTolerantStepFactoryBeanRetryTests { } }; - ItemWriter itemWriter = new ItemWriter() { + ItemWriter itemWriter = new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { logger.debug("Write Called! Item: [" + chunk.getItems() + "]"); @@ -492,7 +492,7 @@ class FaultTolerantStepFactoryBeanRetryTests { } } }); factory.setSkipLimit(2); - ItemReader provider = new ListItemReader(Arrays.asList("a", "b", "c", "d", "e", "f")) { + ItemReader provider = new ListItemReader<>(Arrays.asList("a", "b", "c", "d", "e", "f")) { @Nullable @Override public String read() { @@ -504,7 +504,7 @@ class FaultTolerantStepFactoryBeanRetryTests { } }; - ItemWriter itemWriter = new ItemWriter() { + ItemWriter itemWriter = new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { logger.debug("Write Called! Item: [" + chunk + "]"); @@ -547,7 +547,7 @@ class FaultTolerantStepFactoryBeanRetryTests { factory.setRetryLimit(4); factory.setSkipLimit(0); - ItemReader provider = new ListItemReader(Arrays.asList("b")) { + ItemReader provider = new ListItemReader<>(Arrays.asList("b")) { @Nullable @Override public String read() { @@ -557,7 +557,7 @@ class FaultTolerantStepFactoryBeanRetryTests { return item; } }; - ItemWriter itemWriter = new ItemWriter() { + ItemWriter itemWriter = new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { processed.addAll(chunk.getItems()); @@ -599,7 +599,7 @@ class FaultTolerantStepFactoryBeanRetryTests { factory.setRetryableExceptionClasses(getExceptionMap()); factory.setSkipLimit(1); - ItemReader provider = new ListItemReader(Arrays.asList("b")) { + ItemReader provider = new ListItemReader<>(Arrays.asList("b")) { @Nullable @Override public String read() { @@ -609,7 +609,7 @@ class FaultTolerantStepFactoryBeanRetryTests { return item; } }; - ItemWriter itemWriter = new ItemWriter() { + ItemWriter itemWriter = new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { processed.addAll(chunk.getItems()); @@ -646,7 +646,7 @@ class FaultTolerantStepFactoryBeanRetryTests { factory.setRetryPolicy(new SimpleRetryPolicy(4, Collections., Boolean>singletonMap(Exception.class, true))); factory.setSkipLimit(0); - ItemReader provider = new ListItemReader(Arrays.asList("b")) { + ItemReader provider = new ListItemReader<>(Arrays.asList("b")) { @Nullable @Override public String read() { @@ -656,7 +656,7 @@ class FaultTolerantStepFactoryBeanRetryTests { return item; } }; - ItemWriter itemWriter = new ItemWriter() { + ItemWriter itemWriter = new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { processed.addAll(chunk.getItems()); @@ -694,7 +694,7 @@ class FaultTolerantStepFactoryBeanRetryTests { factory.setSkipLimit(10); // set the cache limit stupidly low factory.setRetryContextCache(new MapRetryContextCache(0)); - ItemReader provider = new ItemReader() { + ItemReader provider = new ItemReader<>() { @Nullable @Override public String read() { @@ -708,7 +708,7 @@ class FaultTolerantStepFactoryBeanRetryTests { return item; } }; - ItemWriter itemWriter = new ItemWriter() { + ItemWriter itemWriter = new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { processed.addAll(chunk.getItems()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java index 050700e4b..cdb7e649f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -451,7 +451,7 @@ public class FaultTolerantStepFactoryBeanTests { map.put(SkippableRuntimeException.class, true); map.put(FatalRuntimeException.class, false); factory.setSkippableExceptionClasses(map); - factory.setItemWriter(new ItemWriter() { + factory.setItemWriter(new ItemWriter<>() { @Override public void write(Chunk items) { throw new FatalRuntimeException("Ouch!"); @@ -860,7 +860,7 @@ public class FaultTolerantStepFactoryBeanTests { void testItemStreamOpenedEvenWithTaskExecutor() throws Exception { writer.setFailures("4"); - ItemReader reader = new AbstractItemStreamItemReader() { + ItemReader reader = new AbstractItemStreamItemReader<>() { @Override public void close() { super.close(); @@ -899,7 +899,7 @@ public class FaultTolerantStepFactoryBeanTests { void testNestedItemStreamOpened() throws Exception { writer.setFailures("4"); - ItemStreamReader reader = new ItemStreamReader() { + ItemStreamReader reader = new ItemStreamReader<>() { @Override public void close() throws ItemStreamException { } @@ -919,7 +919,7 @@ public class FaultTolerantStepFactoryBeanTests { } }; - ItemStreamReader stream = new ItemStreamReader() { + ItemStreamReader stream = new ItemStreamReader<>() { @Override public void close() throws ItemStreamException { closed = true; @@ -961,7 +961,7 @@ public class FaultTolerantStepFactoryBeanTests { void testProxiedItemStreamOpened() throws Exception { writer.setFailures("4"); - ItemStreamReader reader = new ItemStreamReader() { + ItemStreamReader reader = new ItemStreamReader<>() { @Override public void close() throws ItemStreamException { closed = true; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProcessorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProcessorTests.java index 85b92b857..e9a7e0e67 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProcessorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -35,25 +35,24 @@ import org.springframework.lang.Nullable; class SimpleChunkProcessorTests { - private final SimpleChunkProcessor processor = new SimpleChunkProcessor<>( - new ItemProcessor() { - @Nullable - @Override - public String process(String item) throws Exception { - if (item.equals("err")) { - return null; - } - return item; - } - }, new ItemWriter() { - @Override - public void write(Chunk chunk) throws Exception { - if (chunk.getItems().contains("fail")) { - throw new RuntimeException("Planned failure!"); - } - list.addAll(chunk.getItems()); - } - }); + private final SimpleChunkProcessor processor = new SimpleChunkProcessor<>(new ItemProcessor<>() { + @Nullable + @Override + public String process(String item) throws Exception { + if (item.equals("err")) { + return null; + } + return item; + } + }, new ItemWriter<>() { + @Override + public void write(Chunk chunk) throws Exception { + if (chunk.getItems().contains("fail")) { + throw new RuntimeException("Planned failure!"); + } + list.addAll(chunk.getItems()); + } + }); private final StepContribution contribution = new StepContribution( new StepExecution("foo", new JobExecution(new JobInstance(123L, "job"), new JobParameters()))); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProviderTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProviderTests.java index eb5f4196d..0525a0cb4 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProviderTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleChunkProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -47,8 +47,7 @@ class SimpleChunkProviderTests { @Test void testProvideWithOverflow() throws Exception { - provider = new SimpleChunkProvider(new ListItemReader<>(Arrays.asList("foo", "bar")), - new RepeatTemplate()) { + provider = new SimpleChunkProvider<>(new ListItemReader<>(Arrays.asList("foo", "bar")), new RepeatTemplate()) { @Override protected String read(StepContribution contribution, Chunk chunk) throws SkipOverflowException, Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java index 310bca445..3ac0ad8f2 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -71,7 +71,7 @@ class SimpleStepFactoryBeanTests { private final List written = new ArrayList<>(); - private final ItemWriter writer = new ItemWriter() { + private final ItemWriter writer = new ItemWriter<>() { @Override public void write(Chunk data) throws Exception { written.addAll(data.getItems()); @@ -175,7 +175,7 @@ class SimpleStepFactoryBeanTests { SimpleStepFactoryBean factory = getStepFactory(new String[] { "foo", "bar", "spam" }); - factory.setItemWriter(new ItemWriter() { + factory.setItemWriter(new ItemWriter<>() { @Override public void write(Chunk data) throws Exception { throw new RuntimeException("Error!"); @@ -213,7 +213,7 @@ class SimpleStepFactoryBeanTests { void testExceptionTerminates() throws Exception { SimpleStepFactoryBean factory = getStepFactory(new String[] { "foo", "bar", "spam" }); factory.setBeanName("exceptionStep"); - factory.setItemWriter(new ItemWriter() { + factory.setItemWriter(new ItemWriter<>() { @Override public void write(Chunk data) throws Exception { throw new RuntimeException("Foo"); @@ -236,7 +236,7 @@ class SimpleStepFactoryBeanTests { SimpleLimitExceptionHandler exceptionHandler = new SimpleLimitExceptionHandler(1); exceptionHandler.afterPropertiesSet(); factory.setExceptionHandler(exceptionHandler); - factory.setItemWriter(new ItemWriter() { + factory.setItemWriter(new ItemWriter<>() { int count = 0; @Override diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/job/DefaultJobParametersExtractorJobParametersTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/job/DefaultJobParametersExtractorJobParametersTests.java index 4a5634170..81303fc99 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/job/DefaultJobParametersExtractorJobParametersTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/job/DefaultJobParametersExtractorJobParametersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -47,7 +47,7 @@ class DefaultJobParametersExtractorJobParametersTests { @BeforeEach void setUp() { DefaultConversionService conversionService = new DefaultConversionService(); - conversionService.addConverter(String.class, LocalDate.class, new Converter() { + conversionService.addConverter(String.class, LocalDate.class, new Converter<>() { @Override public LocalDate convert(String source) { return LocalDate.parse(source); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/AsyncChunkOrientedStepIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/AsyncChunkOrientedStepIntegrationTests.java index 537a02dd6..1bb858700 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/AsyncChunkOrientedStepIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/AsyncChunkOrientedStepIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -125,7 +125,7 @@ class AsyncChunkOrientedStepIntegrationTests { step.setTasklet(new TestingChunkOrientedTasklet<>( getReader(new String[] { "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c" }), - new ItemWriter() { + new ItemWriter<>() { @Override public void write(Chunk data) throws Exception { written.addAll(data.getItems()); @@ -142,7 +142,7 @@ class AsyncChunkOrientedStepIntegrationTests { // Need a transaction so one connection is enough to get job execution and its // parameters StepExecution lastStepExecution = new TransactionTemplate(transactionManager) - .execute(new TransactionCallback() { + .execute(new TransactionCallback<>() { @Override public StepExecution doInTransaction(TransactionStatus status) { return jobRepository.getLastStepExecution(jobExecution.getJobInstance(), step.getName()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/AsyncTaskletStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/AsyncTaskletStepTests.java index c3dc0984a..29a352580 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/AsyncTaskletStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/AsyncTaskletStepTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -58,7 +58,7 @@ class AsyncTaskletStepTests { private int throttleLimit = 20; - ItemWriter itemWriter = new ItemWriter() { + ItemWriter itemWriter = new ItemWriter<>() { @Override public void write(Chunk data) throws Exception { // Thread.sleep(100L); @@ -176,7 +176,7 @@ class AsyncTaskletStepTests { throttleLimit = 1; concurrencyLimit = 1; items = Arrays.asList("one", "barf", "three", "four"); - itemProcessor = new ItemProcessor() { + itemProcessor = new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/CallableTaskletAdapterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/CallableTaskletAdapterTests.java index 3792b17a3..d157ca134 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/CallableTaskletAdapterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/CallableTaskletAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -29,7 +29,7 @@ class CallableTaskletAdapterTests { @Test void testHandle() throws Exception { - adapter.setCallable(new Callable() { + adapter.setCallable(new Callable<>() { @Override public RepeatStatus call() throws Exception { return RepeatStatus.FINISHED; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/ConfigurableSystemProcessExitCodeMapperTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/ConfigurableSystemProcessExitCodeMapperTests.java index b2ee8dd85..7e23e13df 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/ConfigurableSystemProcessExitCodeMapperTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/ConfigurableSystemProcessExitCodeMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -36,7 +36,7 @@ class ConfigurableSystemProcessExitCodeMapperTests { */ @Test void testMapping() { - Map mappings = new HashMap() { + Map mappings = new HashMap<>() { { put(0, ExitStatus.COMPLETED); put(1, ExitStatus.FAILED); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/StepExecutorInterruptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/StepExecutorInterruptionTests.java index e8af3330d..604d623ea 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/StepExecutorInterruptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/StepExecutorInterruptionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -89,7 +89,7 @@ class StepExecutorInterruptionTests { jobExecution = jobRepository.createJobExecution(job.getName(), new JobParameters()); step.setJobRepository(jobRepository); step.setTransactionManager(this.transactionManager); - itemWriter = new ItemWriter() { + itemWriter = new ItemWriter<>() { @Override public void write(Chunk item) throws Exception { } @@ -107,7 +107,7 @@ class StepExecutorInterruptionTests { RepeatTemplate template = new RepeatTemplate(); // N.B, If we don't set the completion policy it might run forever template.setCompletionPolicy(new SimpleCompletionPolicy(2)); - step.setTasklet(new TestingChunkOrientedTasklet<>(new ItemReader() { + step.setTasklet(new TestingChunkOrientedTasklet<>(new ItemReader<>() { @Nullable @Override public Object read() throws Exception { @@ -170,7 +170,7 @@ class StepExecutorInterruptionTests { Thread processingThread = createThread(stepExecution); - step.setTasklet(new TestingChunkOrientedTasklet<>(new ItemReader() { + step.setTasklet(new TestingChunkOrientedTasklet<>(new ItemReader<>() { @Nullable @Override public Object read() throws Exception { @@ -216,7 +216,7 @@ class StepExecutorInterruptionTests { } }); - step.setTasklet(new TestingChunkOrientedTasklet<>(new ItemReader() { + step.setTasklet(new TestingChunkOrientedTasklet<>(new ItemReader<>() { @Nullable @Override public Object read() throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java index 8eec8e814..0d3593ebe 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java @@ -74,7 +74,7 @@ class TaskletStepTests { private final List list = new ArrayList<>(); - ItemWriter itemWriter = new ItemWriter() { + ItemWriter itemWriter = new ItemWriter<>() { @Override public void write(Chunk data) throws Exception { processed.addAll(data.getItems()); @@ -248,7 +248,7 @@ class TaskletStepTests { @Test void testIncrementRollbackCount() { - ItemReader itemReader = new ItemReader() { + ItemReader itemReader = new ItemReader<>() { @Nullable @Override @@ -274,7 +274,7 @@ class TaskletStepTests { @Test void testExitCodeDefaultClassification() { - ItemReader itemReader = new ItemReader() { + ItemReader itemReader = new ItemReader<>() { @Nullable @Override @@ -301,7 +301,7 @@ class TaskletStepTests { @Test void testExitCodeCustomClassification() { - ItemReader itemReader = new ItemReader() { + ItemReader itemReader = new ItemReader<>() { @Nullable @Override @@ -413,7 +413,7 @@ class TaskletStepTests { */ @Test void testRestartJobOnNonRestartableTasklet() throws Exception { - step.setTasklet(new TestingChunkOrientedTasklet<>(new ItemReader() { + step.setTasklet(new TestingChunkOrientedTasklet<>(new ItemReader<>() { @Nullable @Override public String read() throws Exception { @@ -609,7 +609,7 @@ class TaskletStepTests { step.setInterruptionPolicy(interruptionPolicy); - ItemReader itemReader = new ItemReader() { + ItemReader itemReader = new ItemReader<>() { @Nullable @Override @@ -637,7 +637,7 @@ class TaskletStepTests { @Test void testStatusForNormalFailure() throws Exception { - ItemReader itemReader = new ItemReader() { + ItemReader itemReader = new ItemReader<>() { @Nullable @Override public String read() throws Exception { @@ -662,7 +662,7 @@ class TaskletStepTests { @Test void testStatusForErrorFailure() throws Exception { - ItemReader itemReader = new ItemReader() { + ItemReader itemReader = new ItemReader<>() { @Nullable @Override public String read() throws Exception { @@ -688,7 +688,7 @@ class TaskletStepTests { @Test void testStatusForResetFailedException() throws Exception { - ItemReader itemReader = new ItemReader() { + ItemReader itemReader = new ItemReader<>() { @Nullable @Override public String read() throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/HANAJobRepositoryIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/HANAJobRepositoryIntegrationTests.java index cb6260b67..6928d35f3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/HANAJobRepositoryIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/HANAJobRepositoryIntegrationTests.java @@ -160,7 +160,7 @@ class HANAJobRepositoryIntegrationTests { Ulimit[] ulimits = new Ulimit[] { new Ulimit("nofile", 1048576L, 1048576L) }; // create sysctls Map. - Map sysctls = new HashMap(); + Map sysctls = new HashMap<>(); sysctls.put("kernel.shmmax", "1073741824"); sysctls.put("net.ipv4.ip_local_port_range", "40000 60999"); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/MySQLJdbcJobRepositoryIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/MySQLJdbcJobRepositoryIntegrationTests.java index 5b1df2047..e4c9f2198 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/MySQLJdbcJobRepositoryIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/MySQLJdbcJobRepositoryIntegrationTests.java @@ -174,7 +174,7 @@ class MySQLJdbcJobRepositoryIntegrationTests { public ConfigurableConversionService conversionService() { DefaultConversionService conversionService = new DefaultConversionService(); final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); - conversionService.addConverter(String.class, Date.class, new Converter() { + conversionService.addConverter(String.class, Date.class, new Converter<>() { @Override public Date convert(String source) { try { @@ -185,7 +185,7 @@ class MySQLJdbcJobRepositoryIntegrationTests { } } }); - conversionService.addConverter(Date.class, String.class, new Converter() { + conversionService.addConverter(Date.class, String.class, new Converter<>() { @Override public String convert(Date source) { return dateFormat.format(source); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java index bb48968e6..f26312775 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 the original author or authors. + * Copyright 2010-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. @@ -213,13 +213,12 @@ class FaultTolerantStepFactoryBeanIntegrationTests { } public List getCommitted() { - return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='written'", - new RowMapper() { - @Override - public String mapRow(ResultSet rs, int rowNum) throws SQLException { - return rs.getString(1); - } - }); + return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='written'", new RowMapper<>() { + @Override + public String mapRow(ResultSet rs, int rowNum) throws SQLException { + return rs.getString(1); + } + }); } public void clear() { @@ -260,13 +259,12 @@ class FaultTolerantStepFactoryBeanIntegrationTests { } public List getCommitted() { - return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='processed'", - new RowMapper() { - @Override - public String mapRow(ResultSet rs, int rowNum) throws SQLException { - return rs.getString(1); - } - }); + return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='processed'", new RowMapper<>() { + @Override + public String mapRow(ResultSet rs, int rowNum) throws SQLException { + return rs.getString(1); + } + }); } public void clear() { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java index 080d6e053..fc3f69c5c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 the original author or authors. + * Copyright 2010-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. @@ -239,13 +239,12 @@ class FaultTolerantStepFactoryBeanRollbackIntegrationTests { } public List getCommitted() { - return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='written'", - new RowMapper() { - @Override - public String mapRow(ResultSet rs, int rowNum) throws SQLException { - return rs.getString(1); - } - }); + return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='written'", new RowMapper<>() { + @Override + public String mapRow(ResultSet rs, int rowNum) throws SQLException { + return rs.getString(1); + } + }); } public void clear() { @@ -293,13 +292,12 @@ class FaultTolerantStepFactoryBeanRollbackIntegrationTests { } public List getCommitted() { - return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='processed'", - new RowMapper() { - @Override - public String mapRow(ResultSet rs, int rowNum) throws SQLException { - return rs.getString(1); - } - }); + return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='processed'", new RowMapper<>() { + @Override + public String mapRow(ResultSet rs, int rowNum) throws SQLException { + return rs.getString(1); + } + }); } public void clear() { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepIntegrationTests.java index e31f6c76d..00d07953c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 the original author or authors. + * Copyright 2010-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. @@ -156,7 +156,7 @@ class FaultTolerantStepIntegrationTests { // Given ListItemReader itemReader = new ListItemReader<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7)); - ItemProcessor itemProcessor = new ItemProcessor() { + ItemProcessor itemProcessor = new ItemProcessor<>() { private int cpt; @Nullable @@ -164,14 +164,14 @@ class FaultTolerantStepIntegrationTests { public Integer process(Integer item) throws Exception { cpt++; if (cpt == 7) { // item 2 succeeds the first time but fails during the - // scan + // scan throw new Exception("Error during process"); } return item; } }; - ItemWriter itemWriter = new ItemWriter() { + ItemWriter itemWriter = new ItemWriter<>() { private int cpt; @Override @@ -209,7 +209,7 @@ class FaultTolerantStepIntegrationTests { // Given ListItemReader itemReader = new ListItemReader<>(Arrays.asList(1, 2, 3)); - ItemProcessor itemProcessor = new ItemProcessor() { + ItemProcessor itemProcessor = new ItemProcessor<>() { @Override public Integer process(Integer item) throws Exception { if (item.equals(2)) { @@ -219,7 +219,7 @@ class FaultTolerantStepIntegrationTests { } }; - ItemWriter itemWriter = new ItemWriter() { + ItemWriter itemWriter = new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { if (chunk.getItems().contains(3)) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcBatchItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcBatchItemWriter.java index 467072dc4..439de1531 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcBatchItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcBatchItemWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -192,7 +192,7 @@ public class JdbcBatchItemWriter implements ItemWriter, InitializingBean { } else { updateCounts = namedParameterJdbcTemplate.getJdbcOperations() - .execute(sql, new PreparedStatementCallback() { + .execute(sql, new PreparedStatementCallback<>() { @Override public int[] doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemReader.java index 913d1e80e..c985498c8 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemReader.java @@ -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. @@ -74,7 +74,7 @@ public class MultiResourceItemReader extends AbstractItemStreamItemReader this.strict = strict; } - private Comparator comparator = new Comparator() { + private Comparator comparator = new Comparator<>() { /** * Compares resource filenames. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditor.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditor.java index 51b0a0961..b0289b573 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditor.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditor.java @@ -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. @@ -46,6 +46,7 @@ import java.util.Comparator; * is turned off. * * @author peter.zozom + * @author Mahmoud Ben Hassine */ public class RangeArrayPropertyEditor extends PropertyEditorSupport { @@ -119,7 +120,7 @@ public class RangeArrayPropertyEditor extends PropertyEditorSupport { } // sort array of Ranges - Arrays.sort(c, new Comparator() { + Arrays.sort(c, new Comparator<>() { @Override public int compare(Integer r1, Integer r2) { return ranges[r1].getMin() - ranges[r2].getMin(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerIntegrationTests.java index b818897a4..4e0070b7a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -138,7 +138,7 @@ class BatchMessageListenerContainerIntegrationTests { @Override public void onMessage(final Message msg) { try { - RetryCallback callback = new RetryCallback() { + RetryCallback callback = new RetryCallback<>() { @Override public Message doWithRetry(RetryContext context) throws Exception { try { @@ -150,7 +150,7 @@ class BatchMessageListenerContainerIntegrationTests { throw new RuntimeException("planned failure: " + msg); } }; - RecoveryCallback recoveryCallback = new RecoveryCallback() { + RecoveryCallback recoveryCallback = new RecoveryCallback<>() { @Override public Message recover(RetryContext context) { try { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/example/User.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/example/User.java index 1e75dafac..45d2eab6e 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/example/User.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/example/User.java @@ -42,9 +42,9 @@ public class User extends org.apache.avro.specific.SpecificRecordBase private static SpecificData MODEL$ = new SpecificData(); - private static final BinaryMessageEncoder ENCODER = new BinaryMessageEncoder(MODEL$, SCHEMA$); + private static final BinaryMessageEncoder ENCODER = new BinaryMessageEncoder<>(MODEL$, SCHEMA$); - private static final BinaryMessageDecoder DECODER = new BinaryMessageDecoder(MODEL$, SCHEMA$); + private static final BinaryMessageDecoder DECODER = new BinaryMessageDecoder<>(MODEL$, SCHEMA$); /** * Return the BinaryMessageEncoder instance used by this class. @@ -70,7 +70,7 @@ public class User extends org.apache.avro.specific.SpecificRecordBase * SchemaStore */ public static BinaryMessageDecoder createDecoder(SchemaStore resolver) { - return new BinaryMessageDecoder(MODEL$, SCHEMA$, resolver); + return new BinaryMessageDecoder<>(MODEL$, SCHEMA$, resolver); } /** diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/CompositeKeyFooDao.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/CompositeKeyFooDao.java index 0a86c97c0..90be8d34a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/CompositeKeyFooDao.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/CompositeKeyFooDao.java @@ -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. @@ -47,7 +47,7 @@ public class CompositeKeyFooDao extends JdbcDaoSupport implements FooDao { Map keys = (Map) key; Object[] args = keys.values().toArray(); - RowMapper fooMapper = new RowMapper() { + RowMapper fooMapper = new RowMapper<>() { @Override public Foo mapRow(ResultSet rs, int rowNum) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterClassicTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterClassicTests.java index 5e6f00fcf..9a40e785f 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterClassicTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterClassicTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -70,7 +70,7 @@ class JdbcBatchItemWriterClassicTests { }; writer.setSql("SQL"); writer.setJdbcTemplate(new NamedParameterJdbcTemplate(jdbcTemplate)); - writer.setItemPreparedStatementSetter(new ItemPreparedStatementSetter() { + writer.setItemPreparedStatementSetter(new ItemPreparedStatementSetter<>() { @Override public void setValues(String item, PreparedStatement ps) throws SQLException { list.add(item); @@ -128,7 +128,7 @@ class JdbcBatchItemWriterClassicTests { @Test void testWriteAndFlushWithFailure() throws Exception { final RuntimeException ex = new RuntimeException("bar"); - writer.setItemPreparedStatementSetter(new ItemPreparedStatementSetter() { + writer.setItemPreparedStatementSetter(new ItemPreparedStatementSetter<>() { @Override public void setValues(String item, PreparedStatement ps) throws SQLException { list.add(item); @@ -140,7 +140,7 @@ class JdbcBatchItemWriterClassicTests { Exception exception = assertThrows(RuntimeException.class, () -> writer.write(Chunk.of("foo"))); assertEquals("bar", exception.getMessage()); assertEquals(2, list.size()); - writer.setItemPreparedStatementSetter(new ItemPreparedStatementSetter() { + writer.setItemPreparedStatementSetter(new ItemPreparedStatementSetter<>() { @Override public void setValues(String item, PreparedStatement ps) throws SQLException { list.add(item); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java index 8f5c11d35..1b628d673 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -148,7 +148,7 @@ public class JdbcBatchItemWriterNamedParameterTests { mapWriter.setSql(sql); mapWriter.setJdbcTemplate(namedParameterJdbcOperations); - mapWriter.setItemSqlParameterSourceProvider(new ItemSqlParameterSourceProvider>() { + mapWriter.setItemSqlParameterSourceProvider(new ItemSqlParameterSourceProvider<>() { @Override public SqlParameterSource createSqlParameterSource(Map item) { return new MapSqlParameterSource(item); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java index c59399961..b13865d79 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java @@ -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. @@ -119,7 +119,7 @@ class JdbcPagingItemReaderAsyncTests { CompletionService> completionService = new ExecutorCompletionService<>( Executors.newFixedThreadPool(THREAD_COUNT)); for (int i = 0; i < THREAD_COUNT; i++) { - completionService.submit(new Callable>() { + completionService.submit(new Callable<>() { @Override public List call() throws Exception { List list = new ArrayList<>(); @@ -162,7 +162,7 @@ class JdbcPagingItemReaderAsyncTests { sortKeys.put("ID", Order.ASCENDING); queryProvider.setSortKeys(sortKeys); reader.setQueryProvider(queryProvider); - reader.setRowMapper(new RowMapper() { + reader.setRowMapper(new RowMapper<>() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderClassicParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderClassicParameterTests.java index 37da9320f..2ebe7c224 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderClassicParameterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderClassicParameterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-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. @@ -30,6 +30,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; * @author Dave Syer * @author Thomas Risberg * @author Michael Minella + * @author Mahmoud Ben Hassine * */ @SpringJUnitConfig( @@ -49,7 +50,7 @@ class JdbcPagingItemReaderClassicParameterTests extends AbstractJdbcPagingItemRe queryProvider.setSortKeys(sortKeys); reader.setParameterValues(Collections.singletonMap("limit", 2)); reader.setQueryProvider(queryProvider); - reader.setRowMapper(new RowMapper() { + reader.setRowMapper(new RowMapper<>() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderCommonTests.java index a7f979d5f..7669aed0b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderCommonTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-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. @@ -35,6 +35,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; * @author Dave Syer * @author Thomas Risberg * @author Michael Minella + * @author Mahmoud Ben Hassine */ @SpringJUnitConfig public class JdbcPagingItemReaderCommonTests extends AbstractItemStreamItemReaderTests { @@ -54,7 +55,7 @@ public class JdbcPagingItemReaderCommonTests extends AbstractItemStreamItemReade sortKeys.put("ID", Order.ASCENDING); queryProvider.setSortKeys(sortKeys); reader.setQueryProvider(queryProvider); - reader.setRowMapper(new RowMapper() { + reader.setRowMapper(new RowMapper<>() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderIntegrationTests.java index 1e5c6ef5e..61959e46e 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * Copyright 2012-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. @@ -30,6 +30,7 @@ import org.springframework.jdbc.core.RowMapper; * * @author Thomas Risberg * @author Michael Minella + * @author Mahmoud Ben Hassine */ public class JdbcPagingItemReaderIntegrationTests extends AbstractGenericDataSourceItemReaderIntegrationTests { @@ -45,7 +46,7 @@ public class JdbcPagingItemReaderIntegrationTests extends AbstractGenericDataSou sortKeys.put("ID", Order.ASCENDING); queryProvider.setSortKeys(sortKeys); inputSource.setQueryProvider(queryProvider); - inputSource.setRowMapper(new RowMapper() { + inputSource.setRowMapper(new RowMapper<>() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderNamedParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderNamedParameterTests.java index c94517a51..ddcab7383 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderNamedParameterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderNamedParameterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-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. @@ -32,6 +32,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; * @author Dave Syer * @author Thomas Risberg * @author Michael Minella + * @author Mahmoud Ben Hassine */ @SpringJUnitConfig( locations = "/org/springframework/batch/item/database/JdbcPagingItemReaderParameterTests-context.xml") @@ -54,7 +55,7 @@ class JdbcPagingItemReaderNamedParameterTests extends AbstractJdbcPagingItemRead queryProvider.setSortKeys(sortKeys); reader.setParameterValues(Collections.singletonMap("limit", 2)); reader.setQueryProvider(queryProvider); - reader.setRowMapper(new RowMapper() { + reader.setRowMapper(new RowMapper<>() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderOrderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderOrderIntegrationTests.java index a27fc81b7..32e8f6d08 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderOrderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderOrderIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * Copyright 2012-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. @@ -30,6 +30,7 @@ import org.springframework.jdbc.core.RowMapper; * * @author Thomas Risberg * @author Michael Minella + * @author Mahmoud Ben Hassine */ public class JdbcPagingItemReaderOrderIntegrationTests extends AbstractGenericDataSourceItemReaderIntegrationTests { @@ -46,7 +47,7 @@ public class JdbcPagingItemReaderOrderIntegrationTests extends AbstractGenericDa sortKeys.put("NAME", Order.DESCENDING); queryProvider.setSortKeys(sortKeys); inputSource.setQueryProvider(queryProvider); - inputSource.setRowMapper(new RowMapper() { + inputSource.setRowMapper(new RowMapper<>() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingRestartIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingRestartIntegrationTests.java index 742197a91..d974ad67c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingRestartIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcPagingRestartIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -49,6 +49,7 @@ import org.springframework.test.jdbc.JdbcTestUtils; /** * @author Dave Syer * @author Michael Minella + * @author Mahmoud Ben Hassine * @since 2.1 */ @SpringJUnitConfig(locations = "JdbcPagingItemReaderCommonTests-context.xml") @@ -156,7 +157,7 @@ class JdbcPagingRestartIntegrationTests { sortKeys.put("VALUE", Order.ASCENDING); factory.setSortKeys(sortKeys); reader.setQueryProvider(factory.getObject()); - reader.setRowMapper(new RowMapper() { + reader.setRowMapper(new RowMapper<>() { @Override public Foo mapRow(ResultSet rs, int i) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java index 7247ff205..ddbf53d77 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JpaPagingItemReaderAsyncTests.java @@ -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. @@ -110,7 +110,7 @@ class JpaPagingItemReaderAsyncTests { CompletionService> completionService = new ExecutorCompletionService<>( Executors.newFixedThreadPool(THREAD_COUNT)); for (int i = 0; i < THREAD_COUNT; i++) { - completionService.submit(new Callable>() { + completionService.submit(new Callable<>() { @Override public List call() throws Exception { List list = new ArrayList<>(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/SingleKeyFooDao.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/SingleKeyFooDao.java index b31603bf4..53c3441da 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/SingleKeyFooDao.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/SingleKeyFooDao.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2021 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. @@ -27,7 +27,7 @@ public class SingleKeyFooDao extends JdbcDaoSupport implements FooDao { @Override public Foo getFoo(Object key) { - RowMapper fooMapper = new RowMapper() { + RowMapper fooMapper = new RowMapper<>() { @Override public Foo mapRow(ResultSet rs, int rowNum) throws SQLException { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaPagingItemReaderBuilderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaPagingItemReaderBuilderTests.java index 35c891d6d..f41949f2f 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaPagingItemReaderBuilderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaPagingItemReaderBuilderTests.java @@ -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. @@ -208,7 +208,7 @@ class JpaPagingItemReaderBuilderTests { Exception exception = assertThrows(IllegalArgumentException.class, builder::build); assertEquals("pageSize must be greater than zero", exception.getMessage()); - builder = new JpaPagingItemReaderBuilder(); + builder = new JpaPagingItemReaderBuilder<>(); exception = assertThrows(IllegalArgumentException.class, builder::build); assertEquals("An EntityManagerFactory is required", exception.getMessage()); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderCommonTests.java index 6f9571145..5c2d1f589 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderCommonTests.java @@ -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. @@ -34,7 +34,7 @@ public class FlatFileItemReaderCommonTests extends AbstractItemStreamItemReaderT FlatFileItemReader tested = new FlatFileItemReader<>(); Resource resource = new ByteArrayResource(FOOS.getBytes()); tested.setResource(resource); - tested.setLineMapper(new LineMapper() { + tested.setLineMapper(new LineMapper<>() { @Override public Foo mapLine(String line, int lineNumber) { Foo foo = new Foo(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderTests.java index a4ee5b8ad..48cc7ece2 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -213,7 +213,7 @@ class FlatFileItemReaderTests { @Test void testCustomCommentDetectionLogic() throws Exception { - reader = new FlatFileItemReader() { + reader = new FlatFileItemReader<>() { @Override protected boolean isComment(String line) { return super.isComment(line) || line.endsWith("2"); @@ -440,7 +440,7 @@ class FlatFileItemReaderTests { */ @Test void testMappingExceptionWrapping() throws Exception { - LineMapper exceptionLineMapper = new LineMapper() { + LineMapper exceptionLineMapper = new LineMapper<>() { @Override public String mapLine(String line, int lineNumber) throws Exception { if (lineNumber == 2) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemWriterTests.java index 8be446964..51e0957ef 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/FlatFileItemWriterTests.java @@ -244,7 +244,7 @@ class FlatFileItemWriterTests { */ @Test void testWriteWithConverter() throws Exception { - writer.setLineAggregator(new LineAggregator() { + writer.setLineAggregator(new LineAggregator<>() { @Override public String aggregate(String item) { return "FOO:" + item; @@ -264,7 +264,7 @@ class FlatFileItemWriterTests { */ @Test void testWriteWithConverterAndString() throws Exception { - writer.setLineAggregator(new LineAggregator() { + writer.setLineAggregator(new LineAggregator<>() { @Override public String aggregate(String item) { return "FOO:" + item; @@ -783,7 +783,7 @@ class FlatFileItemWriterTests { */ void testLineAggregatorFailure() throws Exception { - writer.setLineAggregator(new LineAggregator() { + writer.setLineAggregator(new LineAggregator<>() { @Override public String aggregate(String item) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderFlatFileTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderFlatFileTests.java index 64ce334b4..116118635 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderFlatFileTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderFlatFileTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -32,7 +32,7 @@ class MultiResourceItemReaderFlatFileTests extends AbstractItemStreamItemReaderT MultiResourceItemReader multiReader = new MultiResourceItemReader<>(); FlatFileItemReader fileReader = new FlatFileItemReader<>(); - fileReader.setLineMapper(new LineMapper() { + fileReader.setLineMapper(new LineMapper<>() { @Override public Foo mapLine(String line, int lineNumber) throws Exception { @@ -53,7 +53,7 @@ class MultiResourceItemReaderFlatFileTests extends AbstractItemStreamItemReaderT multiReader.setResources(new Resource[] { r1, r2, r3, r4 }); multiReader.setSaveState(true); - multiReader.setComparator(new Comparator() { + multiReader.setComparator(new Comparator<>() { @Override public int compare(Resource arg0, Resource arg1) { return 0; // preserve original ordering diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderIntegrationTests.java index b1fef4c63..24c236f14 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -68,7 +68,7 @@ class MultiResourceItemReaderIntegrationTests { itemReader.setLineMapper(new PassThroughLineMapper()); tested.setDelegate(itemReader); - tested.setComparator(new Comparator() { + tested.setComparator(new Comparator<>() { @Override public int compare(Resource o1, Resource o2) { return 0; // do not change ordering @@ -212,7 +212,7 @@ class MultiResourceItemReaderIntegrationTests { Resource[] resources = new Resource[] { r1, r2, r3 }; - Comparator comp = new Comparator() { + Comparator comp = new Comparator<>() { /** * Reversed ordering by filename. diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderResourceAwareTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderResourceAwareTests.java index f5ace9b68..0841fc4a1 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderResourceAwareTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderResourceAwareTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-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. @@ -58,7 +58,7 @@ class MultiResourceItemReaderResourceAwareTests { itemReader.setLineMapper(new FooLineMapper()); tested.setDelegate(itemReader); - tested.setComparator(new Comparator() { + tested.setComparator(new Comparator<>() { @Override public int compare(Resource o1, Resource o2) { return 0; // do not change ordering diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java index f040cd831..230f7efc0 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -81,7 +81,7 @@ class MultiResourceItemReaderXmlTests extends AbstractItemStreamItemReaderTests multiReader.setDelegate(reader); multiReader.setResources(new Resource[] { r1, r2, r3, r4 }); multiReader.setSaveState(true); - multiReader.setComparator(new Comparator() { + multiReader.setComparator(new Comparator<>() { @Override public int compare(Resource arg0, Resource arg1) { return 0; // preserve original ordering diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperConcurrentTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperConcurrentTests.java index 2ea69b563..774a75400 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperConcurrentTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperConcurrentTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -44,7 +44,7 @@ class BeanWrapperFieldSetMapperConcurrentTests { ExecutorService executorService = Executors.newFixedThreadPool(5); Collection> results = new ArrayList<>(); for (int i = 0; i < 10; i++) { - Future result = executorService.submit(new Callable() { + Future result = executorService.submit(new Callable<>() { @Override public Boolean call() throws Exception { for (int i = 0; i < 10; i++) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperTests.java index c31f025bf..9802d8622 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapperTests.java @@ -327,7 +327,7 @@ class BeanWrapperFieldSetMapperTests { void testAutoPopulateNestedList() throws Exception { TestNestedList nestedList = new TestNestedList(); - BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper() { + BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper<>() { @Override protected void initBinder(DataBinder binder) { // Use reflection so it compiles (and fails) with Spring 2.5 @@ -492,7 +492,7 @@ class BeanWrapperFieldSetMapperTests { @Test void testFieldSpecificCustomEditor() throws Exception { - BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper() { + BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper<>() { @Override protected void initBinder(DataBinder binder) { binder.registerCustomEditor(Double.TYPE, "value", @@ -512,7 +512,7 @@ class BeanWrapperFieldSetMapperTests { @Test void testFieldSpecificCustomEditorWithRegistry() throws Exception { - BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper() { + BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper<>() { @Override public void registerCustomEditors(PropertyEditorRegistry registry) { super.registerCustomEditors(registry); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/PatternMatchingCompositeLineMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/PatternMatchingCompositeLineMapperTests.java index d3b49589f..3110f3f07 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/PatternMatchingCompositeLineMapperTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/PatternMatchingCompositeLineMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -34,6 +34,7 @@ import org.springframework.lang.Nullable; /** * @author Dan Garrette * @author Dave Syer + * @author Mahmoud Ben Hassine * @since 2.0 */ class PatternMatchingCompositeLineMapperTests { @@ -65,13 +66,13 @@ class PatternMatchingCompositeLineMapperTests { mapper.setTokenizers(tokenizers); Map> fieldSetMappers = new HashMap<>(); - fieldSetMappers.put("foo*", new FieldSetMapper() { + fieldSetMappers.put("foo*", new FieldSetMapper<>() { @Override public Name mapFieldSet(FieldSet fs) { return new Name(fs.readString(0), fs.readString(1), 0); } }); - fieldSetMappers.put("bar*", new FieldSetMapper() { + fieldSetMappers.put("bar*", new FieldSetMapper<>() { @Override public Name mapFieldSet(FieldSet fs) { return new Name(fs.readString(1), fs.readString(0), 0); @@ -101,7 +102,7 @@ class PatternMatchingCompositeLineMapperTests { mapper.setTokenizers(tokenizers); Map> fieldSetMappers = new HashMap<>(); - fieldSetMappers.put("foo*", new FieldSetMapper() { + fieldSetMappers.put("foo*", new FieldSetMapper<>() { @Override public Name mapFieldSet(FieldSet fs) { return new Name(fs.readString(0), fs.readString(1), 0); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/FormatterLineAggregatorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/FormatterLineAggregatorTests.java index ba8a2d0dd..b64af5cff 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/FormatterLineAggregatorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/FormatterLineAggregatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -32,7 +32,7 @@ class FormatterLineAggregatorTests { // object under test private FormatterLineAggregator aggregator; - private final FieldExtractor defaultFieldExtractor = new FieldExtractor() { + private final FieldExtractor defaultFieldExtractor = new FieldExtractor<>() { @Override public Object[] extract(String[] item) { return item; @@ -110,7 +110,7 @@ class FormatterLineAggregatorTests { aggregator.setMinimumLength(25); aggregator.setMaximumLength(25); - aggregator.setFieldExtractor(new FieldExtractor() { + aggregator.setFieldExtractor(new FieldExtractor<>() { private int[] widths = new int[] { 13, 12 }; @Override @@ -145,7 +145,7 @@ class FormatterLineAggregatorTests { aggregator.setMinimumLength(24); aggregator.setMaximumLength(24); - aggregator.setFieldExtractor(new FieldExtractor() { + aggregator.setFieldExtractor(new FieldExtractor<>() { private int[] widths = new int[] { 13, 11 }; @Override diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/RecursiveCollectionItemTransformerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/RecursiveCollectionItemTransformerTests.java index 80e5ed5d2..a9d8e099f 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/RecursiveCollectionItemTransformerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/RecursiveCollectionItemTransformerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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,6 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ class RecursiveCollectionItemTransformerTests { @@ -35,7 +36,7 @@ class RecursiveCollectionItemTransformerTests { @Test void testSetDelegateAndPassInString() { - aggregator.setDelegate(new LineAggregator() { + aggregator.setDelegate(new LineAggregator<>() { @Override public String aggregate(String item) { return "bar"; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/kafka/KafkaItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/kafka/KafkaItemWriterTests.java index 949715412..d980e4e2c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/kafka/KafkaItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/kafka/KafkaItemWriterTests.java @@ -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. @@ -108,7 +108,7 @@ class KafkaItemWriterTests { @Test void testKafkaTemplateCanBeReferencedFromSubclass() { - KafkaItemWriter kafkaItemWriter = new KafkaItemWriter() { + KafkaItemWriter kafkaItemWriter = new KafkaItemWriter<>() { @Override protected void writeKeyValue(String key, String value) { this.kafkaTemplate.sendDefault(key, value); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/AbstractSynchronizedItemStreamWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/AbstractSynchronizedItemStreamWriterTests.java index b998d1031..79eae3687 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/AbstractSynchronizedItemStreamWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/AbstractSynchronizedItemStreamWriterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 the original author or authors. + * Copyright 2020-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. @@ -43,7 +43,7 @@ public abstract class AbstractSynchronizedItemStreamWriterTests { private SynchronizedItemStreamWriter synchronizedItemStreamWriter; - private final Chunk testList = new Chunk(); + private final Chunk testList = new Chunk<>(); private final ExecutionContext testExecutionContext = new ExecutionContext(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ClassifierCompositeItemProcessorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ClassifierCompositeItemProcessorTests.java index 4cfce4309..e3c1099b8 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ClassifierCompositeItemProcessorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ClassifierCompositeItemProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 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. @@ -35,14 +35,14 @@ class ClassifierCompositeItemProcessorTests { void testBasicClassifierCompositeItemProcessor() throws Exception { ClassifierCompositeItemProcessor processor = new ClassifierCompositeItemProcessor<>(); - ItemProcessor fooProcessor = new ItemProcessor() { + ItemProcessor fooProcessor = new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { return "foo: " + item; } }; - ItemProcessor defaultProcessor = new ItemProcessor() { + ItemProcessor defaultProcessor = new ItemProcessor<>() { @Nullable @Override public String process(String item) throws Exception { @@ -68,21 +68,21 @@ class ClassifierCompositeItemProcessorTests { void testGenericsClassifierCompositeItemProcessor() throws Exception { ClassifierCompositeItemProcessor processor = new ClassifierCompositeItemProcessor<>(); - ItemProcessor intProcessor = new ItemProcessor() { + ItemProcessor intProcessor = new ItemProcessor<>() { @Nullable @Override public String process(Integer item) throws Exception { return "int: " + item; } }; - ItemProcessor longProcessor = new ItemProcessor() { + ItemProcessor longProcessor = new ItemProcessor<>() { @Nullable @Override public StringBuffer process(Long item) throws Exception { return new StringBuffer("long: " + item); } }; - ItemProcessor defaultProcessor = new ItemProcessor() { + ItemProcessor defaultProcessor = new ItemProcessor<>() { @Nullable @Override public StringBuilder process(Number item) throws Exception { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ClassifierCompositeItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ClassifierCompositeItemWriterTests.java index 0b97a5782..537d3a6d6 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ClassifierCompositeItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ClassifierCompositeItemWriterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -45,13 +45,13 @@ class ClassifierCompositeItemWriterTests { @Test void testWrite() throws Exception { Map> map = new HashMap<>(); - ItemWriter fooWriter = new ItemWriter() { + ItemWriter fooWriter = new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { foos.addAll(chunk.getItems()); } }; - ItemWriter defaultWriter = new ItemWriter() { + ItemWriter defaultWriter = new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { defaults.addAll(chunk.getItems()); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ScriptItemProcessorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ScriptItemProcessorTests.java index a577a0d12..bdbb6205c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ScriptItemProcessorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ScriptItemProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 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. @@ -38,6 +38,7 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue; *

* * @author Chris Schaefer + * @author Mahmoud Ben Hassine * @since 3.1 */ class ScriptItemProcessorTests { @@ -214,7 +215,7 @@ class ScriptItemProcessorTests { void testBshScriptEvaluator() throws Exception { assumeTrue(languageExists("bsh")); - ScriptItemProcessor scriptItemProcessor = new ScriptItemProcessor(); + ScriptItemProcessor scriptItemProcessor = new ScriptItemProcessor<>(); scriptItemProcessor.setScriptEvaluator(new BshScriptEvaluator()); scriptItemProcessor.setScriptSource("String process(String item) { return item.toUpperCase(); } process(item);", "bsh"); @@ -227,7 +228,7 @@ class ScriptItemProcessorTests { void testGroovyScriptEvaluator() throws Exception { assumeTrue(languageExists("groovy")); - ScriptItemProcessor scriptItemProcessor = new ScriptItemProcessor(); + ScriptItemProcessor scriptItemProcessor = new ScriptItemProcessor<>(); scriptItemProcessor.setScriptEvaluator(new GroovyScriptEvaluator()); scriptItemProcessor.setScriptSource("def process(item) { return item.toUpperCase() } \n process(item)", "groovy"); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/builder/ClassifierCompositeItemWriterBuilderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/builder/ClassifierCompositeItemWriterBuilderTests.java index 4ac76e052..08c323dd1 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/builder/ClassifierCompositeItemWriterBuilderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/builder/ClassifierCompositeItemWriterBuilderTests.java @@ -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. @@ -43,13 +43,13 @@ class ClassifierCompositeItemWriterBuilderTests { @Test void testWrite() throws Exception { Map> map = new HashMap<>(); - ItemWriter fooWriter = new ItemWriter() { + ItemWriter fooWriter = new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { foos.addAll(chunk.getItems()); } }; - ItemWriter defaultWriter = new ItemWriter() { + ItemWriter defaultWriter = new ItemWriter<>() { @Override public void write(Chunk chunk) throws Exception { defaults.addAll(chunk.getItems()); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/builder/StaxEventItemWriterBuilderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/builder/StaxEventItemWriterBuilderTests.java index 95a84ff56..a7ece8c94 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/builder/StaxEventItemWriterBuilderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/builder/StaxEventItemWriterBuilderTests.java @@ -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. @@ -104,7 +104,7 @@ class StaxEventItemWriterBuilderTests { staxEventItemWriter.afterPropertiesSet(); staxEventItemWriter.open(executionContext); - staxEventItemWriter.write(new Chunk()); + staxEventItemWriter.write(new Chunk<>()); staxEventItemWriter.update(executionContext); staxEventItemWriter.close(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/jms/ExternalRetryInBatchTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/jms/ExternalRetryInBatchTests.java index ece70fd5e..4f84f9425 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/jms/ExternalRetryInBatchTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/jms/ExternalRetryInBatchTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -74,7 +74,7 @@ class ExternalRetryInBatchTests { JdbcTestUtils.deleteFromTables(jdbcTemplate, "T_BARS"); jmsTemplate.convertAndSend("queue", "foo"); jmsTemplate.convertAndSend("queue", "bar"); - provider = new ItemReader() { + provider = new ItemReader<>() { @Nullable @Override public String read() { @@ -130,7 +130,7 @@ class ExternalRetryInBatchTests { return RepeatStatus.FINISHED; } - RetryCallback callback = new RetryCallback() { + RetryCallback callback = new RetryCallback<>() { @Override public String doWithRetry(RetryContext context) throws Exception { // No need for transaction here: the whole @@ -145,7 +145,7 @@ class ExternalRetryInBatchTests { } }; - RecoveryCallback recoveryCallback = new RecoveryCallback() { + RecoveryCallback recoveryCallback = new RecoveryCallback<>() { @Override public String recover(RetryContext context) { // aggressive commit on a recovery diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/poller/DirectPollerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/poller/DirectPollerTests.java index 25b3f73fe..8433ff5ea 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/poller/DirectPollerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/poller/DirectPollerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -38,7 +38,7 @@ class DirectPollerTests { @Test void testSimpleSingleThreaded() throws Exception { - Callable callback = new Callable() { + Callable callback = new Callable<>() { @Override public String call() throws Exception { @@ -63,7 +63,7 @@ class DirectPollerTests { @Test void testTimeUnit() throws Exception { - Callable callback = new Callable() { + Callable callback = new Callable<>() { @Override public String call() throws Exception { @@ -88,7 +88,7 @@ class DirectPollerTests { @Test void testWithError() { - Callable callback = new Callable() { + Callable callback = new Callable<>() { @Override public String call() throws Exception { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/LogOrRethrowExceptionHandlerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/LogOrRethrowExceptionHandlerTests.java index cd85df32b..458d03bbb 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/LogOrRethrowExceptionHandlerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/LogOrRethrowExceptionHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -74,7 +74,7 @@ class LogOrRethrowExceptionHandlerTests { @Test void testNotRethrownErrorLevel() throws Throwable { - handler.setExceptionClassifier(new ClassifierSupport(Level.RETHROW) { + handler.setExceptionClassifier(new ClassifierSupport<>(Level.RETHROW) { @Override public Level classify(Throwable throwable) { return Level.ERROR; @@ -87,7 +87,7 @@ class LogOrRethrowExceptionHandlerTests { @Test void testNotRethrownWarnLevel() throws Throwable { - handler.setExceptionClassifier(new ClassifierSupport(Level.RETHROW) { + handler.setExceptionClassifier(new ClassifierSupport<>(Level.RETHROW) { @Override public Level classify(Throwable throwable) { return Level.WARN; @@ -100,7 +100,7 @@ class LogOrRethrowExceptionHandlerTests { @Test void testNotRethrownDebugLevel() throws Throwable { - handler.setExceptionClassifier(new ClassifierSupport(Level.RETHROW) { + handler.setExceptionClassifier(new ClassifierSupport<>(Level.RETHROW) { @Override public Level classify(Throwable throwable) { return Level.DEBUG; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandlerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandlerTests.java index 4fee0da98..353e37c9b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandlerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -34,6 +34,7 @@ import org.springframework.batch.repeat.context.RepeatContextSupport; * * @author Robert Kasanicky * @author Dave Syer + * @author Mahmoud Ben Hassine */ class SimpleLimitExceptionHandlerTests { @@ -156,7 +157,7 @@ class SimpleLimitExceptionHandlerTests { handler.afterPropertiesSet(); @SuppressWarnings("serial") - List throwables = new ArrayList() { + List throwables = new ArrayList<>() { { for (int i = 0; i < (EXCEPTION_LIMIT); i++) { add(new RuntimeException("below exception limit")); @@ -184,7 +185,7 @@ class SimpleLimitExceptionHandlerTests { handler.afterPropertiesSet(); @SuppressWarnings("serial") - List throwables = new ArrayList() { + List throwables = new ArrayList<>() { { for (int i = 0; i < (EXCEPTION_LIMIT); i++) { add(new RuntimeException("below exception limit")); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/jms/AsynchronousTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/jms/AsynchronousTests.java index 3474eb5e6..72ed911c6 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/jms/AsynchronousTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/jms/AsynchronousTests.java @@ -97,7 +97,7 @@ class AsynchronousTests { assertInitialState(); - container.setMessageListener(new SessionAwareMessageListener() { + container.setMessageListener(new SessionAwareMessageListener<>() { @Override public void onMessage(Message message, Session session) throws JMSException { list.add(message.toString()); @@ -133,7 +133,7 @@ class AsynchronousTests { // Prevent us from being overwhelmed after rollback container.setRecoveryInterval(500); - container.setMessageListener(new SessionAwareMessageListener() { + container.setMessageListener(new SessionAwareMessageListener<>() { @Override public void onMessage(Message message, Session session) throws JMSException { list.add(message.toString()); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ChunkedRepeatTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ChunkedRepeatTests.java index ad558d519..c6c5e4c88 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ChunkedRepeatTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ChunkedRepeatTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -153,7 +153,7 @@ class ChunkedRepeatTests extends AbstractTradeBatchTests { while (!chunker.ready()) { - ItemReader truncated = new ItemReader() { + ItemReader truncated = new ItemReader<>() { int count = 0; @Nullable @@ -165,7 +165,7 @@ class ChunkedRepeatTests extends AbstractTradeBatchTests { } }; chunker.reset(); - template.iterate(new ItemReaderRepeatCallback(truncated, processor) { + template.iterate(new ItemReaderRepeatCallback<>(truncated, processor) { @Override public RepeatStatus doInIteration(RepeatContext context) throws Exception { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/SimpleRepeatTemplateTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/SimpleRepeatTemplateTests.java index 29d7dbd2d..1289f4202 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/SimpleRepeatTemplateTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/SimpleRepeatTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -191,7 +191,7 @@ class SimpleRepeatTemplateTests extends AbstractTradeBatchTests { @Test void testEarlyCompletionWithContext() { - RepeatStatus result = template.iterate(new ItemReaderRepeatCallback(provider, processor) { + RepeatStatus result = template.iterate(new ItemReaderRepeatCallback<>(provider, processor) { @Override public RepeatStatus doInIteration(RepeatContext context) throws Exception { @@ -219,7 +219,7 @@ class SimpleRepeatTemplateTests extends AbstractTradeBatchTests { @Test void testEarlyCompletionWithContextTerminated() { - RepeatStatus result = template.iterate(new ItemReaderRepeatCallback(provider, processor) { + RepeatStatus result = template.iterate(new ItemReaderRepeatCallback<>(provider, processor) { @Override public RepeatStatus doInIteration(RepeatContext context) throws Exception { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplateAsynchronousTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplateAsynchronousTests.java index b4093bc1d..718846d60 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplateAsynchronousTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplateAsynchronousTests.java @@ -223,7 +223,7 @@ class TaskExecutorRepeatTemplateAsynchronousTests extends AbstractTradeBatchTest final String threadName = Thread.currentThread().getName(); final Set threadNames = new HashSet<>(); - final RepeatCallback stepCallback = new ItemReaderRepeatCallback(provider, processor) { + final RepeatCallback stepCallback = new ItemReaderRepeatCallback<>(provider, processor) { @Override public RepeatStatus doInIteration(RepeatContext context) throws Exception { assertNotSame(threadName, Thread.currentThread().getName()); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/jms/ExternalRetryTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/jms/ExternalRetryTests.java index f4a1e242f..3b9cefcda 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/jms/ExternalRetryTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/jms/ExternalRetryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -65,7 +65,7 @@ class ExternalRetryTests { getMessages(); // drain queue JdbcTestUtils.deleteFromTables(jdbcTemplate, "T_BARS"); jmsTemplate.convertAndSend("queue", "foo"); - provider = new ItemReader() { + provider = new ItemReader<>() { @Nullable @Override public String read() { @@ -95,7 +95,7 @@ class ExternalRetryTests { assertInitialState(); - final ItemWriter writer = new ItemWriter() { + final ItemWriter writer = new ItemWriter<>() { @Override public void write(final Chunk texts) { @@ -130,12 +130,12 @@ class ExternalRetryTests { // Client of retry template has to take care of rollback. This would // be a message listener container in the MDP case. - new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + new TransactionTemplate(transactionManager).execute(new TransactionCallback<>() { @Override public Object doInTransaction(TransactionStatus status) { try { final String item = provider.read(); - RetryCallback callback = new RetryCallback() { + RetryCallback callback = new RetryCallback<>() { @Override public Object doWithRetry(RetryContext context) throws Exception { writer.write(Chunk.of(item)); @@ -169,7 +169,7 @@ class ExternalRetryTests { assertInitialState(); final String item = provider.read(); - final RetryCallback callback = new RetryCallback() { + final RetryCallback callback = new RetryCallback<>() { @Override public String doWithRetry(RetryContext context) throws Exception { jdbcTemplate.update("INSERT into T_BARS (id,name,foo_date) values (?,?,null)", list.size(), item); @@ -177,7 +177,7 @@ class ExternalRetryTests { } }; - final RecoveryCallback recoveryCallback = new RecoveryCallback() { + final RecoveryCallback recoveryCallback = new RecoveryCallback<>() { @Override public String recover(RetryContext context) { recovered.add(item); @@ -189,7 +189,7 @@ class ExternalRetryTests { for (int i = 0; i < 4; i++) { try { - result = new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + result = new TransactionTemplate(transactionManager).execute(new TransactionCallback<>() { @Override public String doInTransaction(TransactionStatus status) { try { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/jms/SynchronousTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/jms/SynchronousTests.java index b4a44588f..16b46dadd 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/jms/SynchronousTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/jms/SynchronousTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -115,7 +115,7 @@ public class SynchronousTests { TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); transactionTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_NESTED); - return transactionTemplate.execute(new TransactionCallback() { + return transactionTemplate.execute(new TransactionCallback<>() { @Override public String doInTransaction(TransactionStatus status) { @@ -169,7 +169,7 @@ public class SynchronousTests { TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); transactionTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_NESTED); - return transactionTemplate.execute(new TransactionCallback() { + return transactionTemplate.execute(new TransactionCallback<>() { @Override public String doInTransaction(TransactionStatus status) { @@ -234,7 +234,7 @@ public class SynchronousTests { TransactionTemplate nestedTxTemplate = new TransactionTemplate(transactionManager); nestedTxTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_NESTED); - return nestedTxTemplate.execute(new TransactionCallback() { + return nestedTxTemplate.execute(new TransactionCallback<>() { @Override public String doInTransaction(TransactionStatus nestedStatus) { @@ -294,7 +294,7 @@ public class SynchronousTests { // use REQUIRES_NEW so that the retry executes in its own transaction TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); transactionTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW); - return transactionTemplate.execute(new TransactionCallback() { + return transactionTemplate.execute(new TransactionCallback<>() { @Override public String doInTransaction(TransactionStatus status) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ConcurrentTransactionAwareProxyTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ConcurrentTransactionAwareProxyTests.java index db1bc3e9e..8fdb257f3 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ConcurrentTransactionAwareProxyTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/support/transaction/ConcurrentTransactionAwareProxyTests.java @@ -110,7 +110,7 @@ class ConcurrentTransactionAwareProxyTests { @Test void testTransactionalContains() { final Map> map = TransactionAwareProxyFactory.createAppendOnlyTransactionalMap(); - boolean result = new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + boolean result = new TransactionTemplate(transactionManager).execute(new TransactionCallback<>() { @Override public Boolean doInTransaction(TransactionStatus status) { return map.containsKey("foo"); @@ -124,7 +124,7 @@ class ConcurrentTransactionAwareProxyTests { for (int i = 0; i < outerMax; i++) { final int count = i; - completionService.submit(new Callable>() { + completionService.submit(new Callable<>() { @Override public List call() throws Exception { List list = new ArrayList<>(); @@ -152,7 +152,7 @@ class ConcurrentTransactionAwareProxyTests { for (int i = 0; i < outerMax; i++) { - completionService.submit(new Callable>() { + completionService.submit(new Callable<>() { @Override public List call() throws Exception { List result = new ArrayList<>(); @@ -192,7 +192,7 @@ class ConcurrentTransactionAwareProxyTests { for (int j = 0; j < numberOfKeys; j++) { final long id = j * 1000 + 123L + i; - completionService.submit(new Callable>() { + completionService.submit(new Callable<>() { @Override public List call() throws Exception { List list = new ArrayList<>(); diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/AsyncItemProcessor.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/AsyncItemProcessor.java index 97283df8e..ea9590ba2 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/AsyncItemProcessor.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/AsyncItemProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -43,6 +43,7 @@ import org.springframework.util.Assert; * will not be called. * * @author Dave Syer + * @author Mahmoud Ben Hassine * @param the input object type * @param the output object type (will be wrapped in a Future) * @see AsyncItemWriter @@ -89,7 +90,7 @@ public class AsyncItemProcessor implements ItemProcessor>, In @Nullable public Future process(final I item) throws Exception { final StepExecution stepExecution = getStepExecution(); - FutureTask task = new FutureTask<>(new Callable() { + FutureTask task = new FutureTask<>(new Callable<>() { public O call() throws Exception { if (stepExecution != null) { StepSynchronizationManager.register(stepExecution); diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkHandlerFactoryBean.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkHandlerFactoryBean.java index 538e9a60c..ba946a6f0 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkHandlerFactoryBean.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkHandlerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -171,17 +171,15 @@ public class RemoteChunkHandlerFactoryBean implements FactoryBean tasklet, ItemWriter chunkWriter, final StepContributionSource stepContributionSource) { - setField(tasklet, "chunkProcessor", - new SimpleChunkProcessor(new PassThroughItemProcessor<>(), chunkWriter) { - @Override - protected void write(StepContribution contribution, Chunk inputs, Chunk outputs) - throws Exception { - doWrite(outputs); - // Do not update the step contribution until the chunks are - // actually processed - updateStepContribution(contribution, stepContributionSource); - } - }); + setField(tasklet, "chunkProcessor", new SimpleChunkProcessor<>(new PassThroughItemProcessor<>(), chunkWriter) { + @Override + protected void write(StepContribution contribution, Chunk inputs, Chunk outputs) throws Exception { + doWrite(outputs); + // Do not update the step contribution until the chunks are + // actually processed + updateStepContribution(contribution, stepContributionSource); + } + }); } /** diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/partition/MessageChannelPartitionHandler.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/partition/MessageChannelPartitionHandler.java index 42885187a..528334bf9 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/partition/MessageChannelPartitionHandler.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/partition/MessageChannelPartitionHandler.java @@ -253,7 +253,7 @@ public class MessageChannelPartitionHandler extends AbstractPartitionHandler imp throws Exception { final Set result = new HashSet<>(split.size()); - Callable> callback = new Callable>() { + Callable> callback = new Callable<>() { @Override public Set call() throws Exception { Set currentStepExecutionIds = split.stream() diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/async/AsyncItemProcessorTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/async/AsyncItemProcessorTests.java index 6ad12bf2e..6f761e207 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/async/AsyncItemProcessorTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/async/AsyncItemProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -37,7 +37,7 @@ class AsyncItemProcessorTests { private final AsyncItemProcessor processor = new AsyncItemProcessor<>(); - private ItemProcessor delegate = new ItemProcessor() { + private ItemProcessor delegate = new ItemProcessor<>() { @Nullable public String process(String item) throws Exception { return item + item; @@ -58,7 +58,7 @@ class AsyncItemProcessorTests { @Test void testExecutionInStepScope() throws Exception { - delegate = new ItemProcessor() { + delegate = new ItemProcessor<>() { @Nullable public String process(String item) throws Exception { StepContext context = StepSynchronizationManager.getContext(); @@ -68,7 +68,7 @@ class AsyncItemProcessorTests { }; processor.setDelegate(delegate); Future result = StepScopeTestUtils.doInStepScope(MetaDataInstanceFactory.createStepExecution(), - new Callable>() { + new Callable<>() { public Future call() throws Exception { return processor.process("foo"); } diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/async/AsyncItemWriterTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/async/AsyncItemWriterTests.java index 26d47af67..9bf5c2f94 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/async/AsyncItemWriterTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/async/AsyncItemWriterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 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. @@ -64,14 +64,14 @@ class AsyncItemWriterTests { writer.setDelegate(new ListItemWriter(writtenItems)); Chunk> processedItems = new Chunk<>(); - processedItems.add(new FutureTask<>(new Callable() { + processedItems.add(new FutureTask<>(new Callable<>() { @Override public String call() throws Exception { return "foo"; } })); - processedItems.add(new FutureTask<>(new Callable() { + processedItems.add(new FutureTask<>(new Callable<>() { @Override public String call() throws Exception { return "bar"; @@ -94,14 +94,14 @@ class AsyncItemWriterTests { writer.setDelegate(new ListItemWriter(writtenItems)); Chunk> processedItems = new Chunk<>(); - processedItems.add(new FutureTask<>(new Callable() { + processedItems.add(new FutureTask<>(new Callable<>() { @Override public String call() throws Exception { return "foo"; } })); - processedItems.add(new FutureTask<>(new Callable() { + processedItems.add(new FutureTask<>(new Callable<>() { @Override public String call() throws Exception { return null; @@ -123,14 +123,14 @@ class AsyncItemWriterTests { writer.setDelegate(new ListItemWriter(writtenItems)); Chunk> processedItems = new Chunk<>(); - processedItems.add(new FutureTask<>(new Callable() { + processedItems.add(new FutureTask<>(new Callable<>() { @Override public String call() throws Exception { return "foo"; } })); - processedItems.add(new FutureTask<>(new Callable() { + processedItems.add(new FutureTask<>(new Callable<>() { @Override public String call() throws Exception { throw new RuntimeException("This was expected"); @@ -151,7 +151,7 @@ class AsyncItemWriterTests { writer.setDelegate(delegate); Chunk> processedItems = new Chunk<>(); - processedItems.add(new Future() { + processedItems.add(new Future<>() { @Override public boolean cancel(boolean mayInterruptIfRunning) { diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/ChunkProcessorChunkHandlerTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/ChunkProcessorChunkHandlerTests.java index b78d4201e..3326ba7be 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/ChunkProcessorChunkHandlerTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/ChunkProcessorChunkHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -34,7 +34,7 @@ class ChunkProcessorChunkHandlerTests { @Test void testVanillaHandleChunk() throws Exception { // given - handler.setChunkProcessor(new ChunkProcessor() { + handler.setChunkProcessor(new ChunkProcessor<>() { public void process(StepContribution contribution, Chunk chunk) throws Exception { count += chunk.size(); } diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderTests.java index c4749e8c8..f91e8396d 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderTests.java @@ -251,7 +251,7 @@ class RemoteChunkingManagerStepBuilderTests { } }; - ItemReader itemReader = new ItemReader() { + ItemReader itemReader = new ItemReader<>() { int count = 0; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java index 0569db711..5ca9ffd10 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java @@ -84,7 +84,7 @@ public class StagingItemReader "SELECT ID FROM BATCH_STAGING WHERE JOB_ID=? AND PROCESSED=? ORDER BY ID", - new RowMapper() { + new RowMapper<>() { @Override public Long mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getLong(1); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItem.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItem.java index 0318ee021..ab186a35d 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItem.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 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,12 +21,13 @@ package org.springframework.batch.sample.domain.multiline; * * @see AggregateItemReader * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class AggregateItem { @SuppressWarnings("rawtypes") - private static final AggregateItem FOOTER = new AggregateItem(false, true) { + private static final AggregateItem FOOTER = new AggregateItem<>(false, true) { @Override public Object getItem() { throw new IllegalStateException("Footer record has no item."); @@ -43,7 +44,7 @@ public class AggregateItem { } @SuppressWarnings("rawtypes") - private static final AggregateItem HEADER = new AggregateItem(true, false) { + private static final AggregateItem HEADER = new AggregateItem<>(true, false) { @Override public Object getItem() { throw new IllegalStateException("Header record has no item."); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringProcessSample.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringProcessSample.java index 74a0f3935..ead057bc2 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringProcessSample.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringProcessSample.java @@ -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. @@ -49,7 +49,7 @@ public class SkippableExceptionDuringProcessSample { @Bean public ItemReader itemReader() { - return new ListItemReader(Arrays.asList(1, 2, 3, 4, 5, 6)) { + return new ListItemReader<>(Arrays.asList(1, 2, 3, 4, 5, 6)) { @Override public Integer read() { Integer item = super.read(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringReadSample.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringReadSample.java index 871482dbb..d10a29a49 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringReadSample.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringReadSample.java @@ -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. @@ -49,7 +49,7 @@ public class SkippableExceptionDuringReadSample { @Bean public ItemReader itemReader() { - return new ListItemReader(Arrays.asList(1, 2, 3, 4, 5, 6)) { + return new ListItemReader<>(Arrays.asList(1, 2, 3, 4, 5, 6)) { @Override public Integer read() { Integer item = super.read(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringWriteSample.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringWriteSample.java index f8cea00fa..337735ab3 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringWriteSample.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/skip/SkippableExceptionDuringWriteSample.java @@ -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. @@ -49,7 +49,7 @@ public class SkippableExceptionDuringWriteSample { @Bean public ItemReader itemReader() { - return new ListItemReader(Arrays.asList(1, 2, 3, 4, 5, 6)) { + return new ListItemReader<>(Arrays.asList(1, 2, 3, 4, 5, 6)) { @Override public Integer read() { Integer item = super.read(); diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java index 041b1f1cc..b9704f14b 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java @@ -73,7 +73,7 @@ class CompositeItemWriterSampleFunctionalTests { } private void checkOutputTable(int before) { - final List trades = new ArrayList() { + final List trades = new ArrayList<>() { { add(new Trade("UK21341EAH41", 211, new BigDecimal("31.11"), "customer1")); add(new Trade("UK21341EAH42", 212, new BigDecimal("32.11"), "customer2")); diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/HibernateFailureJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/HibernateFailureJobFunctionalTests.java index b397608ca..40f158d36 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/HibernateFailureJobFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/HibernateFailureJobFunctionalTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2007-2022 the original author or authors. + * Copyright 2007-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. @@ -123,18 +123,17 @@ class HibernateFailureJobFunctionalTests { */ protected void validatePreConditions() { ensureState(); - creditsBeforeUpdate = new TransactionTemplate(transactionManager) - .execute(new TransactionCallback>() { - @Override - public List doInTransaction(TransactionStatus status) { - return jdbcTemplate.query(ALL_CUSTOMERS, new RowMapper() { - @Override - public BigDecimal mapRow(ResultSet rs, int rowNum) throws SQLException { - return rs.getBigDecimal(CREDIT_COLUMN); - } - }); - } - }); + creditsBeforeUpdate = new TransactionTemplate(transactionManager).execute(new TransactionCallback<>() { + @Override + public List doInTransaction(TransactionStatus status) { + return jdbcTemplate.query(ALL_CUSTOMERS, new RowMapper<>() { + @Override + public BigDecimal mapRow(ResultSet rs, int rowNum) throws SQLException { + return rs.getBigDecimal(CREDIT_COLUMN); + } + }); + } + }); } /* diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemReaderTests.java index 57f1e7a36..0d845f774 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemReaderTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/StagingItemReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -123,7 +123,7 @@ class StagingItemReaderTests { TransactionTemplate txTemplate = new TransactionTemplate(transactionManager); txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); - final Long idToUse = txTemplate.execute(new TransactionCallback() { + final Long idToUse = txTemplate.execute(new TransactionCallback<>() { @Override public Long doInTransaction(TransactionStatus transactionStatus) { diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapperTests.java index 7d2b0d887..a9409d378 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemFieldSetMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 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. @@ -57,7 +57,7 @@ class AggregateItemFieldSetMapperTests { @Test void testDelegate() throws Exception { - mapper.setDelegate(new FieldSetMapper() { + mapper.setDelegate(new FieldSetMapper<>() { @Override public String mapFieldSet(FieldSet fs) { return "foo"; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemReaderTests.java index c23992ee5..8bbdef2a6 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemReaderTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/multiline/AggregateItemReaderTests.java @@ -33,7 +33,7 @@ class AggregateItemReaderTests { @BeforeEach void setUp() { - input = new ItemReader>() { + input = new ItemReader<>() { private int count = 0; @Nullable diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesDelimitedFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesDelimitedFunctionalTests.java index f0df71098..2f40a6b01 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesDelimitedFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/TwoJobInstancesDelimitedFunctionalTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 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. @@ -79,7 +79,7 @@ class TwoJobInstancesDelimitedFunctionalTests { .toJobParameters(); StepExecution stepExecution = MetaDataInstanceFactory.createStepExecution(jobParameters); - int count = StepScopeTestUtils.doInStepScope(stepExecution, new Callable() { + int count = StepScopeTestUtils.doInStepScope(stepExecution, new Callable<>() { @Override public Integer call() throws Exception { int count = 0; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeAnnotatedListenerIntegrationTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeAnnotatedListenerIntegrationTests.java index 4d685cb66..f0e3ec469 100644 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeAnnotatedListenerIntegrationTests.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/StepScopeAnnotatedListenerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 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. @@ -149,7 +149,7 @@ class StepScopeAnnotatedListenerIntegrationTests { @Bean public ItemProcessor processor() { - return new ItemProcessor() { + return new ItemProcessor<>() { @Nullable @Override @@ -161,7 +161,7 @@ class StepScopeAnnotatedListenerIntegrationTests { @Bean public ItemWriter writer() { - return new ItemWriter() { + return new ItemWriter<>() { @Override public void write(Chunk items) throws Exception {