Nullability refinements in spring-webmvc

Includes revision of web.servlet.tags.form for non-null conventions.

Issue: SPR-15540

(cherry picked from commit f74a631ea1)
This commit is contained in:
Juergen Hoeller
2018-07-30 22:08:11 +02:00
parent 91fa2ed0d4
commit 2a32c6cf57
26 changed files with 315 additions and 136 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -51,7 +51,7 @@ public class ModelMap extends LinkedHashMap<String, Object> {
* under the supplied name.
* @see #addAttribute(String, Object)
*/
public ModelMap(String attributeName, Object attributeValue) {
public ModelMap(String attributeName, @Nullable Object attributeValue) {
addAttribute(attributeName, attributeValue);
}
@@ -80,10 +80,10 @@ public class ModelMap extends LinkedHashMap<String, Object> {
/**
* Add the supplied attribute to this {@code Map} using a
* {@link org.springframework.core.Conventions#getVariableName generated name}.
* <p><emphasis>Note: Empty {@link Collection Collections} are not added to
* <p><i>Note: Empty {@link Collection Collections} are not added to
* the model when using this method because we cannot correctly determine
* the true convention name. View code should check for {@code null} rather
* than for empty collections as is already done by JSTL tags.</emphasis>
* than for empty collections as is already done by JSTL tags.</i>
* @param attributeValue the model attribute value (never {@code null})
*/
public ModelMap addAttribute(Object attributeValue) {