Fix AbstractJackson2HttpMessageConverter nullness

This commit makes AbstractJackson2HttpMessageConverter#getObjectMappersForType
return value non nullable as an empty map is returned in case of no
registrations.

Closes gh-34811
This commit is contained in:
Sébastien Deleuze 2025-04-24 10:37:30 +02:00
parent 5c5cf73e11
commit 56eb135608
1 changed files with 1 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@ -184,7 +184,6 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
* or empty if in case of no registrations for the given class.
* @since 5.3.4
*/
@Nullable
public Map<MediaType, ObjectMapper> getObjectMappersForType(Class<?> clazz) {
for (Map.Entry<Class<?>, Map<MediaType, ObjectMapper>> entry : getObjectMapperRegistrations().entrySet()) {
if (entry.getKey().isAssignableFrom(clazz)) {