Refine null-safety in the spring-webmvc module

Closes gh-34164
This commit is contained in:
Sébastien Deleuze
2024-12-26 19:23:33 +01:00
parent b332920b17
commit 6c86914709
6 changed files with 6 additions and 6 deletions

View File

@@ -65,7 +65,7 @@ public class ResourceChainRegistration {
this(cacheResources, (cacheResources ? new ConcurrentMapCache(DEFAULT_CACHE_NAME) : null));
}
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // Dataflow analysis limitation
public ResourceChainRegistration(boolean cacheResources, @Nullable Cache cache) {
Assert.isTrue(!cacheResources || cache != null, "'cache' is required when cacheResources=true");
if (cacheResources) {

View File

@@ -69,7 +69,7 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder {
}
@Override
@SuppressWarnings("NullAway") // TODO NullAway bug potentially due to the recursive generic type
@SuppressWarnings("NullAway") // https://github.com/uber/NullAway/issues/1113
public ServerResponse.BodyBuilder header(String headerName, @Nullable String... headerValues) {
Assert.notNull(headerName, "HeaderName must not be null");
for (String headerValue : headerValues) {

View File

@@ -436,7 +436,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
}
}
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // Dataflow analysis limitation
private void addMatchingMappings(Collection<T> mappings, List<Match> matches, HttpServletRequest request) {
for (T mapping : mappings) {
T match = getMatchingMapping(mapping, request);

View File

@@ -271,7 +271,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i
* @return a matching handler, or {@code null} if not found
* @since 5.3
*/
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // Dataflow analysis limitation
protected @Nullable Object lookupHandler(
RequestPath path, String lookupPath, HttpServletRequest request) throws Exception {

View File

@@ -233,7 +233,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
* @param lookupPath the lookup path to check
* @return the resolved public URL path, or {@code null} if unresolved
*/
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // Dataflow analysis limitation
public final @Nullable String getForLookupPath(String lookupPath) {
// Clean duplicate slashes or pathWithinPattern won't match lookupPath
String previous;

View File

@@ -301,7 +301,7 @@ public class MessageTag extends HtmlEscapingAwareTag implements ArgumentAware {
* Resolve the specified message into a concrete message String.
* The returned message String should be unescaped.
*/
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // Dataflow analysis limitation
protected String resolveMessage() throws JspException, NoSuchMessageException {
MessageSource messageSource = getMessageSource();