Add missing @Nullable annotations on parameters

Issue: SPR-15540
This commit is contained in:
Sebastien Deleuze
2017-05-31 12:37:54 +02:00
parent ad2c0f8410
commit b47d713e14
380 changed files with 1085 additions and 732 deletions

View File

@@ -49,6 +49,7 @@ import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.lang.Nullable;
import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;
import org.springframework.tests.sample.beans.BooleanTestBean;
@@ -461,7 +462,7 @@ public abstract class AbstractPropertyAccessorTests {
AbstractPropertyAccessor accessor = createAccessor(target);
accessor.setConversionService(new GenericConversionService() {
@Override
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
public Object convert(@Nullable Object source, @Nullable TypeDescriptor sourceType, TypeDescriptor targetType) {
throw new ConversionFailedException(sourceType, targetType, source, null);
}
});

View File

@@ -83,6 +83,7 @@ import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.lang.Nullable;
import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;
import org.springframework.tests.sample.beans.DependenciesBean;
@@ -3120,7 +3121,7 @@ public class DefaultListableBeanFactoryTests {
@Override
@SuppressWarnings("unchecked")
public Object convertIfNecessary(Object value, Class requiredType) {
public Object convertIfNecessary(Object value, @Nullable Class requiredType) {
if (value instanceof String && Float.class.isAssignableFrom(requiredType)) {
try {
return new Float(this.numberFormat.parse((String) value).floatValue());
@@ -3139,13 +3140,13 @@ public class DefaultListableBeanFactoryTests {
@Override
@SuppressWarnings("unchecked")
public Object convertIfNecessary(Object value, Class requiredType, MethodParameter methodParam) {
public Object convertIfNecessary(Object value, @Nullable Class requiredType, @Nullable MethodParameter methodParam) {
return convertIfNecessary(value, requiredType);
}
@Override
@SuppressWarnings("unchecked")
public Object convertIfNecessary(Object value, Class requiredType, Field field) {
public Object convertIfNecessary(Object value, @Nullable Class requiredType, @Nullable Field field) {
return convertIfNecessary(value, requiredType);
}
}