Make getters and setters null-safety consistent
This commit ensure that null-safety is consistent between getters and setters in order to be able to provide beans with properties with a common type when type safety is taken in account like with Kotlin. It also add a few missing property level @Nullable annotations. Issue: SPR-15792
This commit is contained in:
@@ -56,7 +56,7 @@ public class ConvertingPropertyEditorAdapter extends PropertyEditorSupport {
|
||||
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
public void setAsText(@Nullable String text) throws IllegalArgumentException {
|
||||
setValue(this.conversionService.convert(text, TypeDescriptor.valueOf(String.class), this.targetDescriptor));
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implement
|
||||
* @see #setThreadNamePrefix
|
||||
* @see #setThreadPriority
|
||||
*/
|
||||
public void setThreadFactory(ThreadFactory threadFactory) {
|
||||
public void setThreadFactory(@Nullable ThreadFactory threadFactory) {
|
||||
this.threadFactory = threadFactory;
|
||||
}
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ public abstract class CollectionUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(K key, V value) {
|
||||
public void set(K key, @Nullable V value) {
|
||||
List<V> values = new LinkedList<>();
|
||||
values.add(value);
|
||||
this.map.put(key, values);
|
||||
|
||||
@@ -127,7 +127,7 @@ public class CustomizableThreadCreator implements Serializable {
|
||||
* Specify the thread group that threads should be created in.
|
||||
* @see #setThreadGroupName
|
||||
*/
|
||||
public void setThreadGroup(ThreadGroup threadGroup) {
|
||||
public void setThreadGroup(@Nullable ThreadGroup threadGroup) {
|
||||
this.threadGroup = threadGroup;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(K key, V value) {
|
||||
public void set(K key, @Nullable V value) {
|
||||
List<V> values = new LinkedList<>();
|
||||
values.add(value);
|
||||
this.targetMap.put(key, values);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class MethodInvoker {
|
||||
* @see #setTargetObject
|
||||
* @see #setTargetMethod
|
||||
*/
|
||||
public void setTargetClass(Class<?> targetClass) {
|
||||
public void setTargetClass(@Nullable Class<?> targetClass) {
|
||||
this.targetClass = targetClass;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public class MethodInvoker {
|
||||
* @see #setTargetClass
|
||||
* @see #setTargetObject
|
||||
*/
|
||||
public void setTargetMethod(String targetMethod) {
|
||||
public void setTargetMethod(@Nullable String targetMethod) {
|
||||
this.targetMethod = targetMethod;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public interface MultiValueMap<K, V> extends Map<K, List<V>> {
|
||||
* @param key the key
|
||||
* @param value the value to set
|
||||
*/
|
||||
void set(K key, V value);
|
||||
void set(K key, @Nullable V value);
|
||||
|
||||
/**
|
||||
* Set the given values under.
|
||||
|
||||
@@ -41,19 +41,24 @@ import org.springframework.lang.Nullable;
|
||||
*/
|
||||
abstract class AbstractXMLReader implements XMLReader {
|
||||
|
||||
@Nullable
|
||||
private DTDHandler dtdHandler;
|
||||
|
||||
@Nullable
|
||||
private ContentHandler contentHandler;
|
||||
|
||||
@Nullable
|
||||
private EntityResolver entityResolver;
|
||||
|
||||
@Nullable
|
||||
private ErrorHandler errorHandler;
|
||||
|
||||
@Nullable
|
||||
private LexicalHandler lexicalHandler;
|
||||
|
||||
|
||||
@Override
|
||||
public void setContentHandler(ContentHandler contentHandler) {
|
||||
public void setContentHandler(@Nullable ContentHandler contentHandler) {
|
||||
this.contentHandler = contentHandler;
|
||||
}
|
||||
|
||||
@@ -64,7 +69,7 @@ abstract class AbstractXMLReader implements XMLReader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDTDHandler(DTDHandler dtdHandler) {
|
||||
public void setDTDHandler(@Nullable DTDHandler dtdHandler) {
|
||||
this.dtdHandler = dtdHandler;
|
||||
}
|
||||
|
||||
@@ -75,7 +80,7 @@ abstract class AbstractXMLReader implements XMLReader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEntityResolver(EntityResolver entityResolver) {
|
||||
public void setEntityResolver(@Nullable EntityResolver entityResolver) {
|
||||
this.entityResolver = entityResolver;
|
||||
}
|
||||
|
||||
@@ -86,7 +91,7 @@ abstract class AbstractXMLReader implements XMLReader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorHandler(ErrorHandler errorHandler) {
|
||||
public void setErrorHandler(@Nullable ErrorHandler errorHandler) {
|
||||
this.errorHandler = errorHandler;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user