Skip to content

Commit f15edd4

Browse files
marschallfmbenhassine
authored andcommitted
Fix some raw types
1 parent c9e06b2 commit f15edd4

File tree

12 files changed

+39
-22
lines changed

12 files changed

+39
-22
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator;
4949
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
5050
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;
51+
import com.fasterxml.jackson.databind.jsontype.impl.StdTypeResolverBuilder;
5152
import com.fasterxml.jackson.databind.module.SimpleModule;
5253

5354
import org.springframework.batch.core.JobParameter;
@@ -209,7 +210,7 @@ public JobParameter deserialize(JsonParser parser, DeserializationContext contex
209210
* @param trustedClassNames array of fully qualified trusted class names
210211
*/
211212
private static TypeResolverBuilder<? extends TypeResolverBuilder> createTrustedDefaultTyping(String[] trustedClassNames) {
212-
TypeResolverBuilder<? extends TypeResolverBuilder> result = new TrustedTypeResolverBuilder(ObjectMapper.DefaultTyping.NON_FINAL, trustedClassNames);
213+
TypeResolverBuilder<StdTypeResolverBuilder> result = new TrustedTypeResolverBuilder(ObjectMapper.DefaultTyping.NON_FINAL, trustedClassNames);
213214
result = result.init(JsonTypeInfo.Id.CLASS, null);
214215
result = result.inclusion(JsonTypeInfo.As.PROPERTY);
215216
return result;
@@ -253,7 +254,7 @@ protected TypeIdResolver idResolver(MapperConfig<?> config,
253254
* mappings.
254255
*/
255256
static class TrustedTypeIdResolver implements TypeIdResolver {
256-
private static final Set<String> TRUSTED_CLASS_NAMES = Collections.unmodifiableSet(new HashSet(Arrays.asList(
257+
private static final Set<String> TRUSTED_CLASS_NAMES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
257258
"java.util.ArrayList",
258259
"java.util.Arrays$ArrayList",
259260
"java.util.LinkedList",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ protected Tasklet createTasklet() {
195195
* @return this for fluent chaining
196196
*/
197197
@Override
198-
@SuppressWarnings("unchecked")
198+
@SuppressWarnings({ "unchecked", "rawtypes" })
199199
public SimpleStepBuilder<I, O> listener(Object listener) {
200200
super.listener(listener);
201201

spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/DefaultJobLoaderTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2019 the original author or authors.
2+
* Copyright 2006-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -66,11 +66,11 @@ public void testClear() throws Exception {
6666
GenericApplicationContextFactory factory = new GenericApplicationContextFactory(new ByteArrayResource(
6767
JOB_XML.getBytes()));
6868
jobLoader.load(factory);
69-
assertEquals(1, ((Map) ReflectionTestUtils.getField(jobLoader, "contexts")).size());
70-
assertEquals(1, ((Map) ReflectionTestUtils.getField(jobLoader, "contextToJobNames")).size());
69+
assertEquals(1, ((Map<?, ?>) ReflectionTestUtils.getField(jobLoader, "contexts")).size());
70+
assertEquals(1, ((Map<?, ?>) ReflectionTestUtils.getField(jobLoader, "contextToJobNames")).size());
7171
jobLoader.clear();
72-
assertEquals(0, ((Map) ReflectionTestUtils.getField(jobLoader, "contexts")).size());
73-
assertEquals(0, ((Map) ReflectionTestUtils.getField(jobLoader, "contextToJobNames")).size());
72+
assertEquals(0, ((Map<?, ?>) ReflectionTestUtils.getField(jobLoader, "contexts")).size());
73+
assertEquals(0, ((Map<?, ?>) ReflectionTestUtils.getField(jobLoader, "contextToJobNames")).size());
7474
}
7575

7676
@Test

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public void setUp() throws Exception {
8787
* Check items causing errors are skipped as expected.
8888
*/
8989
@Test
90-
@SuppressWarnings("rawtypes")
9190
public void testSkip() throws Exception {
9291
@SuppressWarnings("unchecked")
9392
SkipListener<Integer, String> skipListener = mock(SkipListener.class);

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/ExtendedConnectionDataSourceProxy.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -237,7 +237,6 @@ public void setLoginTimeout(int seconds) throws SQLException {
237237
* @param target the original Connection to wrap
238238
* @return the wrapped Connection
239239
*/
240-
@SuppressWarnings("rawtypes")
241240
protected Connection getCloseSuppressingConnectionProxy(Connection target) {
242241
return (Connection) Proxy.newProxyInstance(ConnectionProxy.class.getClassLoader(),
243242
new Class[] { ConnectionProxy.class }, new CloseSuppressingInvocationHandler(target, this));

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcBatchItemWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2019 the original author or authors.
2+
* Copyright 2006-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -158,7 +158,7 @@ public void afterPropertiesSet() {
158158
/* (non-Javadoc)
159159
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
160160
*/
161-
@SuppressWarnings({"unchecked", "rawtypes"})
161+
@SuppressWarnings("unchecked")
162162
@Override
163163
public void write(final List<? extends T> items) throws Exception {
164164

spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/builder/AvroItemWriterBuilderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void shouldFailWitNoOutput() {
114114
@Test(expected = IllegalArgumentException.class)
115115
public void shouldFailWitNoType() {
116116

117-
new AvroItemWriterBuilder()
117+
new AvroItemWriterBuilder<>()
118118
.resource(output)
119119
.schema(schemaResource)
120120
.build();

spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/MongoItemWriterTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
4343
import org.springframework.data.mongodb.core.convert.MongoConverter;
4444
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
45+
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
46+
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
4547
import org.springframework.data.mongodb.core.query.Query;
4648
import org.springframework.transaction.PlatformTransactionManager;
4749
import org.springframework.transaction.support.TransactionCallback;
@@ -79,7 +81,7 @@ public void setUp() throws Exception {
7981
when(this.template.bulkOps(any(), anyString())).thenReturn(this.bulkOperations);
8082
when(this.template.bulkOps(any(), any(Class.class))).thenReturn(this.bulkOperations);
8183

82-
MappingContext mappingContext = new MongoMappingContext();
84+
MappingContext<MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext = new MongoMappingContext();
8385
MappingMongoConverter mongoConverter = spy(new MappingMongoConverter(this.dbRefResolver, mappingContext));
8486
when(this.template.getConverter()).thenReturn(mongoConverter);
8587

@@ -305,7 +307,6 @@ public void testRemoveNoTransactionWithCollection() throws Exception {
305307
@Test
306308
public void testResourceKeyCollision() throws Exception {
307309
final int limit = 5000;
308-
@SuppressWarnings("unchecked")
309310
List<MongoItemWriter<String>> writers = new ArrayList<>(limit);
310311
final String[] documents = new String[limit];
311312
final String[] results = new String[limit];

spring-batch-infrastructure/src/test/java/org/springframework/batch/item/data/builder/MongoItemWriterBuilderTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
4040
import org.springframework.data.mongodb.core.convert.MongoConverter;
4141
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
42+
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
43+
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
4244
import org.springframework.data.mongodb.core.query.Query;
4345

4446
import static org.junit.Assert.assertEquals;
@@ -72,7 +74,7 @@ public void setUp() throws Exception {
7274
when(this.template.bulkOps(any(), anyString())).thenReturn(this.bulkOperations);
7375
when(this.template.bulkOps(any(), any(Class.class))).thenReturn(this.bulkOperations);
7476

75-
MappingContext mappingContext = new MongoMappingContext();
77+
MappingContext<MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext = new MongoMappingContext();
7678
mongoConverter = spy(new MappingMongoConverter(this.dbRefResolver, mappingContext));
7779
when(this.template.getConverter()).thenReturn(mongoConverter);
7880

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2008 the original author or authors.
2+
* Copyright 2006-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -152,7 +152,7 @@ public void testWriteAndFlushMap() throws Exception {
152152
assertEquals("bar", results.get("foo"));
153153
}
154154

155-
@SuppressWarnings({ "rawtypes", "serial", "unchecked" })
155+
@SuppressWarnings( "serial" )
156156
@Test
157157
public void testWriteAndFlushMapWithItemSqlParameterSourceProvider() throws Exception {
158158
JdbcBatchItemWriter<Map<String, Object>> mapWriter = new JdbcBatchItemWriter<>();

spring-batch-infrastructure/src/test/java/org/springframework/batch/item/kafka/KafkaItemReaderTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ public void testReadFromSinglePartitionAfterRestart() throws ExecutionException,
377377

378378
@Test
379379
public void testReadFromMultiplePartitionsAfterRestart() throws ExecutionException, InterruptedException {
380-
List<ListenableFuture> futures = new ArrayList<>();
380+
List<ListenableFuture<SendResult<String, String>>> futures = new ArrayList<>();
381381
futures.add(this.template.send("topic4", 0, null, "val0"));
382382
futures.add(this.template.send("topic4", 0, null, "val2"));
383383
futures.add(this.template.send("topic4", 0, null, "val4"));
@@ -387,7 +387,7 @@ public void testReadFromMultiplePartitionsAfterRestart() throws ExecutionExcepti
387387
futures.add(this.template.send("topic4", 1, null, "val5"));
388388
futures.add(this.template.send("topic4", 1, null, "val7"));
389389

390-
for (ListenableFuture future : futures) {
390+
for (ListenableFuture<?> future : futures) {
391391
future.get();
392392
}
393393

spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/MessageChannelPartitionHandlerTests.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2020-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.springframework.batch.integration.partition;
218

319
import java.util.Collection;
@@ -34,7 +50,6 @@
3450
* @author Michael Minella
3551
*
3652
*/
37-
@SuppressWarnings("raw")
3853
public class MessageChannelPartitionHandlerTests {
3954

4055
private MessageChannelPartitionHandler messageChannelPartitionHandler;

0 commit comments

Comments
 (0)