Fix some raw types
This commit is contained in:
committed by
Mahmoud Ben Hassine
parent
c9e06b2a7f
commit
f15edd414a
@@ -48,6 +48,7 @@ import com.fasterxml.jackson.databind.jsontype.NamedType;
|
||||
import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator;
|
||||
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
|
||||
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;
|
||||
import com.fasterxml.jackson.databind.jsontype.impl.StdTypeResolverBuilder;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
|
||||
import org.springframework.batch.core.JobParameter;
|
||||
@@ -209,7 +210,7 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex
|
||||
* @param trustedClassNames array of fully qualified trusted class names
|
||||
*/
|
||||
private static TypeResolverBuilder<? extends TypeResolverBuilder> createTrustedDefaultTyping(String[] trustedClassNames) {
|
||||
TypeResolverBuilder<? extends TypeResolverBuilder> result = new TrustedTypeResolverBuilder(ObjectMapper.DefaultTyping.NON_FINAL, trustedClassNames);
|
||||
TypeResolverBuilder<StdTypeResolverBuilder> result = new TrustedTypeResolverBuilder(ObjectMapper.DefaultTyping.NON_FINAL, trustedClassNames);
|
||||
result = result.init(JsonTypeInfo.Id.CLASS, null);
|
||||
result = result.inclusion(JsonTypeInfo.As.PROPERTY);
|
||||
return result;
|
||||
@@ -253,7 +254,7 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex
|
||||
* mappings.
|
||||
*/
|
||||
static class TrustedTypeIdResolver implements TypeIdResolver {
|
||||
private static final Set<String> TRUSTED_CLASS_NAMES = Collections.unmodifiableSet(new HashSet(Arrays.asList(
|
||||
private static final Set<String> TRUSTED_CLASS_NAMES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
|
||||
"java.util.ArrayList",
|
||||
"java.util.Arrays$ArrayList",
|
||||
"java.util.LinkedList",
|
||||
|
||||
@@ -195,7 +195,7 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
|
||||
* @return this for fluent chaining
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public SimpleStepBuilder<I, O> listener(Object listener) {
|
||||
super.listener(listener);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2019 the original author or authors.
|
||||
* Copyright 2006-2021 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.
|
||||
@@ -66,11 +66,11 @@ public class DefaultJobLoaderTests {
|
||||
GenericApplicationContextFactory factory = new GenericApplicationContextFactory(new ByteArrayResource(
|
||||
JOB_XML.getBytes()));
|
||||
jobLoader.load(factory);
|
||||
assertEquals(1, ((Map) ReflectionTestUtils.getField(jobLoader, "contexts")).size());
|
||||
assertEquals(1, ((Map) ReflectionTestUtils.getField(jobLoader, "contextToJobNames")).size());
|
||||
assertEquals(1, ((Map<?, ?>) ReflectionTestUtils.getField(jobLoader, "contexts")).size());
|
||||
assertEquals(1, ((Map<?, ?>) ReflectionTestUtils.getField(jobLoader, "contextToJobNames")).size());
|
||||
jobLoader.clear();
|
||||
assertEquals(0, ((Map) ReflectionTestUtils.getField(jobLoader, "contexts")).size());
|
||||
assertEquals(0, ((Map) ReflectionTestUtils.getField(jobLoader, "contextToJobNames")).size());
|
||||
assertEquals(0, ((Map<?, ?>) ReflectionTestUtils.getField(jobLoader, "contexts")).size());
|
||||
assertEquals(0, ((Map<?, ?>) ReflectionTestUtils.getField(jobLoader, "contextToJobNames")).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -87,7 +87,6 @@ public class FaultTolerantStepFactoryBeanNonBufferingTests {
|
||||
* Check items causing errors are skipped as expected.
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void testSkip() throws Exception {
|
||||
@SuppressWarnings("unchecked")
|
||||
SkipListener<Integer, String> skipListener = mock(SkipListener.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -237,7 +237,6 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
|
||||
* @param target the original Connection to wrap
|
||||
* @return the wrapped Connection
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected Connection getCloseSuppressingConnectionProxy(Connection target) {
|
||||
return (Connection) Proxy.newProxyInstance(ConnectionProxy.class.getClassLoader(),
|
||||
new Class[] { ConnectionProxy.class }, new CloseSuppressingInvocationHandler(target, this));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2019 the original author or authors.
|
||||
* Copyright 2006-2021 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.
|
||||
@@ -158,7 +158,7 @@ public class JdbcBatchItemWriter<T> implements ItemWriter<T>, InitializingBean {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void write(final List<? extends T> items) throws Exception {
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ public class AvroItemWriterBuilderTests extends AvroItemWriterTestSupport {
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void shouldFailWitNoType() {
|
||||
|
||||
new AvroItemWriterBuilder()
|
||||
new AvroItemWriterBuilder<>()
|
||||
.resource(output)
|
||||
.schema(schemaResource)
|
||||
.build();
|
||||
|
||||
@@ -42,6 +42,8 @@ import org.springframework.data.mongodb.core.convert.DbRefResolver;
|
||||
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
|
||||
import org.springframework.data.mongodb.core.convert.MongoConverter;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.support.TransactionCallback;
|
||||
@@ -79,7 +81,7 @@ public class MongoItemWriterTests {
|
||||
when(this.template.bulkOps(any(), anyString())).thenReturn(this.bulkOperations);
|
||||
when(this.template.bulkOps(any(), any(Class.class))).thenReturn(this.bulkOperations);
|
||||
|
||||
MappingContext mappingContext = new MongoMappingContext();
|
||||
MappingContext<MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext = new MongoMappingContext();
|
||||
MappingMongoConverter mongoConverter = spy(new MappingMongoConverter(this.dbRefResolver, mappingContext));
|
||||
when(this.template.getConverter()).thenReturn(mongoConverter);
|
||||
|
||||
@@ -305,7 +307,6 @@ public class MongoItemWriterTests {
|
||||
@Test
|
||||
public void testResourceKeyCollision() throws Exception {
|
||||
final int limit = 5000;
|
||||
@SuppressWarnings("unchecked")
|
||||
List<MongoItemWriter<String>> writers = new ArrayList<>(limit);
|
||||
final String[] documents = new String[limit];
|
||||
final String[] results = new String[limit];
|
||||
|
||||
@@ -39,6 +39,8 @@ import org.springframework.data.mongodb.core.convert.DbRefResolver;
|
||||
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
|
||||
import org.springframework.data.mongodb.core.convert.MongoConverter;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -72,7 +74,7 @@ public class MongoItemWriterBuilderTests {
|
||||
when(this.template.bulkOps(any(), anyString())).thenReturn(this.bulkOperations);
|
||||
when(this.template.bulkOps(any(), any(Class.class))).thenReturn(this.bulkOperations);
|
||||
|
||||
MappingContext mappingContext = new MongoMappingContext();
|
||||
MappingContext<MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext = new MongoMappingContext();
|
||||
mongoConverter = spy(new MappingMongoConverter(this.dbRefResolver, mappingContext));
|
||||
when(this.template.getConverter()).thenReturn(mongoConverter);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2008 the original author or authors.
|
||||
* Copyright 2006-2021 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.
|
||||
@@ -152,7 +152,7 @@ public class JdbcBatchItemWriterNamedParameterTests {
|
||||
assertEquals("bar", results.get("foo"));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "serial", "unchecked" })
|
||||
@SuppressWarnings( "serial" )
|
||||
@Test
|
||||
public void testWriteAndFlushMapWithItemSqlParameterSourceProvider() throws Exception {
|
||||
JdbcBatchItemWriter<Map<String, Object>> mapWriter = new JdbcBatchItemWriter<>();
|
||||
|
||||
@@ -377,7 +377,7 @@ public class KafkaItemReaderTests {
|
||||
|
||||
@Test
|
||||
public void testReadFromMultiplePartitionsAfterRestart() throws ExecutionException, InterruptedException {
|
||||
List<ListenableFuture> futures = new ArrayList<>();
|
||||
List<ListenableFuture<SendResult<String, String>>> futures = new ArrayList<>();
|
||||
futures.add(this.template.send("topic4", 0, null, "val0"));
|
||||
futures.add(this.template.send("topic4", 0, null, "val2"));
|
||||
futures.add(this.template.send("topic4", 0, null, "val4"));
|
||||
@@ -387,7 +387,7 @@ public class KafkaItemReaderTests {
|
||||
futures.add(this.template.send("topic4", 1, null, "val5"));
|
||||
futures.add(this.template.send("topic4", 1, null, "val7"));
|
||||
|
||||
for (ListenableFuture future : futures) {
|
||||
for (ListenableFuture<?> future : futures) {
|
||||
future.get();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2020-2021 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.integration.partition;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -34,7 +50,6 @@ import static org.mockito.Mockito.when;
|
||||
* @author Michael Minella
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("raw")
|
||||
public class MessageChannelPartitionHandlerTests {
|
||||
|
||||
private MessageChannelPartitionHandler messageChannelPartitionHandler;
|
||||
|
||||
Reference in New Issue
Block a user