How to disable automatic null checks for constructor parameters of a specific data class?
I have an endpoint in my Spring Boot app, e.g.
data class SomeRequest(
@field:NotNull
val someField: String?
)
@RestController
class SomeController {
@PostMapping(value = ["/something"])
fun something(@RequestBody @Valid someRequest: SomeRequest) {
someRequest.someField!!
}
}
And while I can be sure someField will never be null, I still need to add !! every time it is used.
Unfortunately, I cannot change the type of this field to String because then Kotlin will...