Clean up warnings

This commit is contained in:
Sam Brannen
2019-10-30 19:14:58 +01:00
parent 3c17178b16
commit 9f00eb68e9
19 changed files with 20 additions and 13 deletions

View File

@@ -34,6 +34,7 @@ import org.springframework.lang.Nullable;
* @see BeanDefinition#getPropertyValues()
* @see org.springframework.beans.factory.support.BeanDefinitionBuilder#addAutowiredProperty
*/
@SuppressWarnings("serial")
public final class AutowiredPropertyMarker implements Serializable {
/**

View File

@@ -244,6 +244,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
logger.trace("Loading Groovy bean definitions from " + encodedResource);
}
@SuppressWarnings("serial")
Closure beans = new Closure(this) {
@Override
public Object call(Object... args) {

View File

@@ -30,6 +30,7 @@ import org.springframework.lang.NonNull;
* @see DefaultListableBeanFactory#setAllowBeanDefinitionOverriding
* @see DefaultListableBeanFactory#registerBeanDefinition
*/
@SuppressWarnings("serial")
public class BeanDefinitionOverrideException extends BeanDefinitionStoreException {
private final BeanDefinition beanDefinition;

View File

@@ -41,7 +41,6 @@ public class DirectFieldAccessorTests extends AbstractPropertyAccessorTests {
public void withShadowedField() {
final StringBuilder sb = new StringBuilder();
@SuppressWarnings("serial")
TestBean target = new TestBean() {
@SuppressWarnings("unused")
StringBuilder name = sb;

View File

@@ -20,7 +20,6 @@ package org.springframework.tests.sample.beans;
* @author Rob Harrop
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class Colour {
public static final Colour RED = new Colour("RED");

View File

@@ -118,7 +118,7 @@ public class SpringValidatorAdapter implements SmartValidator, javax.validation.
}
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void validateValue(
Class<?> targetType, String fieldName, @Nullable Object value, Errors errors, Object... validationHints) {

View File

@@ -95,7 +95,7 @@ public class MethodLocatingFactoryBeanTests {
}
@Test
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testSunnyDayPath() throws Exception {
given(beanFactory.getType(BEAN_NAME)).willReturn((Class)String.class);
factory.setTargetBeanName(BEAN_NAME);
@@ -110,7 +110,7 @@ public class MethodLocatingFactoryBeanTests {
}
@Test
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testWhereMethodCannotBeResolved() {
given(beanFactory.getType(BEAN_NAME)).willReturn((Class)String.class);
factory.setTargetBeanName(BEAN_NAME);

View File

@@ -1356,6 +1356,7 @@ public class ConfigurationClassPostProcessorTests {
@Configuration
public static class RawFactoryMethodRepositoryConfiguration {
@SuppressWarnings("rawtypes") // intentionally a raw type
@Bean
public Repository stringRepo() {
return new Repository<String>() {

View File

@@ -305,6 +305,7 @@ public class PropertySourceAnnotationTests {
@Inject Environment env;
@SuppressWarnings("rawtypes")
@Bean
public FactoryBean testBean() {
final String name = env.getProperty("testbean.name");

View File

@@ -578,6 +578,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@SuppressWarnings("rawtypes")
public static class MyPayloadListener implements ApplicationListener<PayloadApplicationEvent> {
public final Set<Object> seenPayloads = new HashSet<>();

View File

@@ -34,6 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class PayloadApplicationEventTests {
@Test
@SuppressWarnings({ "rawtypes", "resource" })
public void testEventClassWithInterface() {
ApplicationContext ac = new AnnotationConfigApplicationContext(AuditableListener.class);
AuditablePayloadEvent event = new AuditablePayloadEvent<>(this, "xyz");

View File

@@ -149,6 +149,7 @@ class GenericTypeResolverTests {
}
@Test // SPR-11044
@SuppressWarnings("deprecation")
void getGenericsOnArrayFromParamCannotBeResolved() throws Exception {
MethodParameter methodParameter = MethodParameter.forExecutable(
WithArrayBase.class.getDeclaredMethod("array", Object[].class), 0);

View File

@@ -243,6 +243,7 @@ class ResolvableTypeTests {
}
@Test
@SuppressWarnings("deprecation")
void forMethodParameterWithNesting() throws Exception {
Method method = Methods.class.getMethod("nested", Map.class);
MethodParameter methodParameter = MethodParameter.forExecutable(method, 0);
@@ -254,6 +255,7 @@ class ResolvableTypeTests {
}
@Test
@SuppressWarnings("deprecation")
void forMethodParameterWithNestingAndLevels() throws Exception {
Method method = Methods.class.getMethod("nested", Map.class);
MethodParameter methodParameter = MethodParameter.forExecutable(method, 0);
@@ -820,6 +822,7 @@ class ResolvableTypeTests {
}
@Test
@SuppressWarnings("deprecation")
void resolveTypeVariableFromMethodParameterTypeWithImplementsClass() throws Exception {
Method method = Methods.class.getMethod("typedParameter", Object.class);
MethodParameter methodParameter = MethodParameter.forExecutable(method, 0);

View File

@@ -357,7 +357,7 @@ public abstract class AbstractAdaptableMessageListener
throws JMSException {
if (result instanceof JmsResponse) {
JmsResponse<?> jmsResponse = (JmsResponse) result;
JmsResponse<?> jmsResponse = (JmsResponse<?>) result;
Destination destination = jmsResponse.resolveDestination(getDestinationResolver(), session);
if (destination != null) {
return destination;
@@ -538,6 +538,7 @@ public abstract class AbstractAdaptableMessageListener
* this case, its payload is returned.
* @return the payload of the message
*/
@SuppressWarnings("rawtypes")
private Object unwrapPayload() throws JMSException {
Object payload = extractPayload(this.message);
if (payload instanceof org.springframework.messaging.Message) {

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.messaging.rsocket;
import java.util.function.Consumer;
@@ -109,8 +110,8 @@ class DefaultRSocketStrategiesTests {
@Test
@SuppressWarnings("unchecked")
void applyMetadataExtractors() {
Consumer<MetadataExtractorRegistry> consumer = (Consumer<MetadataExtractorRegistry>) mock(Consumer.class);
RSocketStrategies strategies = RSocketStrategies.builder().metadataExtractorRegistry(consumer).build();
Consumer<MetadataExtractorRegistry> consumer = mock(Consumer.class);
RSocketStrategies.builder().metadataExtractorRegistry(consumer).build();
verify(consumer, times(1)).accept(any());
}

View File

@@ -39,7 +39,6 @@ import org.springframework.util.Assert;
* @see #execute
* @see ReactiveTransactionManager
*/
@SuppressWarnings("serial")
final class TransactionalOperatorImpl implements TransactionalOperator {
private static final Log logger = LogFactory.getLog(TransactionalOperatorImpl.class);

View File

@@ -55,7 +55,6 @@ import org.springframework.util.Assert;
* @since 5.0
* @see org.springframework.web.server.adapter.AbstractReactiveWebInitializer
*/
@SuppressWarnings("serial")
public class ServletHttpHandlerAdapter implements Servlet {
private static final Log logger = HttpLogging.forLogName(ServletHttpHandlerAdapter.class);

View File

@@ -406,7 +406,6 @@ public class CommonsMultipartResolverTests {
}
@SuppressWarnings("serial")
private static class MockFileItem implements FileItem {
private String fieldName;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2019 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,6 @@ public class Jackson2SockJsMessageCodec extends AbstractSockJsMessageCodec {
}
@Override
@SuppressWarnings("deprecation")
protected char[] applyJsonQuoting(String content) {
return JsonStringEncoder.getInstance().quoteAsString(content);
}