Skip to content

JSpecify null validation when mapping to non-null fields in MappingMongoConverter #5167

@nealeu

Description

@nealeu

Since Spring Boot 4 et al, adopted JSpecify, we've been trying to null-safe our code. However, at the boundaries, nulls sneak in, and in MongoDB projections in-particular, we can end up with a null value in a non-null field JSpecify @NullMarked class or record.

Could the mapping infrastructure help us out here, rather than having a big debug session on our hands, by asserting nullness (configurable as assert x != null; (for those that want to use -ea in dev/CI/QA but not prod) or Objects.requireNonNull(x)?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions