Skip to content

Allow JDK immutable collections in CoreJacksonModule - #20108

Open
rajeshvasa wants to merge 1 commit into
spring-projects:7.0.xfrom
rajeshvasa:gh-20084
Open

rajeshvasa wants to merge 1 commit into
spring-projects:7.0.xfrom
rajeshvasa:gh-20084

Conversation

@rajeshvasa

Copy link
Copy Markdown

CoreJacksonModule's allowlist includes the older java.util.Collections$Unmodifiable*, SingletonList and Arrays$ArrayList types but not the JDK 9+ java.util.ImmutableCollections implementations produced by List.of, Set.of, Map.of and Stream.toList(). Claims built that way are saved by JdbcOAuth2AuthorizationService but fail with InvalidTypeIdException when read back (e.g. on refresh).

This adds List12, ListN, Set12, SetN, Map1 and MapN to the allowlist.

Tests:

  • ImmutableCollectionsTests: round-trip for each type (all 8 fail without the change)
  • JdbcOAuth2AuthorizationServiceTests: save/load of access token claims containing immutable collections, reproducing the report

Closes #20084

Closes spring-projectsgh-20084

Signed-off-by: Rajesh Vasa <guptha.rh@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 13, 2026
@rajeshvasa rajeshvasa changed the title Allow JDK immutable collections in CoreJacksonModule. Allow JDK immutable collections in CoreJacksonModule Nov 13, 2026
@rajeshvasa
rajeshvasa changed the base branch from main to 7.0.x November 13, 2026 02:35

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JdbcOAuth2AuthorizationService: a token claim built with List.of(...) or Stream.toList() is saved but cannot be read back

2 participants