diff --git a/spring-context/src/main/java/org/springframework/ui/ConcurrentModel.java b/spring-context/src/main/java/org/springframework/ui/ConcurrentModel.java index 8ab6387b5bd..22edddf0257 100644 --- a/spring-context/src/main/java/org/springframework/ui/ConcurrentModel.java +++ b/spring-context/src/main/java/org/springframework/ui/ConcurrentModel.java @@ -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. @@ -68,7 +68,8 @@ public class ConcurrentModel extends ConcurrentHashMap implement /** * Add the supplied attribute under the supplied name. * @param attributeName the name of the model attribute (never {@code null}) - * @param attributeValue the model attribute value (can be {@code null}) + * @param attributeValue the model attribute value (never {@code null} for {@code ConcurrentModel}, + * with the {@code Nullable} declaration inherited from {@link Model#addAttribute(String, Object)}) */ public ConcurrentModel addAttribute(String attributeName, @Nullable Object attributeValue) { Assert.notNull(attributeName, "Model attribute name must not be null"); @@ -80,14 +81,14 @@ public class ConcurrentModel extends ConcurrentHashMap implement /** * Add the supplied attribute to this {@code Map} using a * {@link org.springframework.core.Conventions#getVariableName generated name}. - *

Note: Empty {@link Collection Collections} are not added to + *

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. + * than for empty collections as is already done by JSTL tags. * @param attributeValue the model attribute value (never {@code null}) */ - public ConcurrentModel addAttribute(@Nullable Object attributeValue) { - Assert.notNull(attributeValue, "Model object must not be null"); + public ConcurrentModel addAttribute(Object attributeValue) { + Assert.notNull(attributeValue, "Model attribute value must not be null"); if (attributeValue instanceof Collection && ((Collection) attributeValue).isEmpty()) { return this; }