Ankur Pathak opened SPR-16923 and commented

class Name : Serializable

{ @NotBlank var value: String? = null }

class Names

{ @NotEmpty var names: MutableList<@Valid @NotNull Name>? = null }

Bean Validation 2 constrains @Valid @NotNull does not work on Generics  Type Param in Kotlin with Spring Web MVC.

But if you replace kotlin Names class with java version of same it works.

public class Names {

@NotEmpty private List<@NotNull @Valid Name> names;

public List\ getNames() { return names; }

public void setNames(List\ names) { this.names = names; } }

But Bean Validation 2 constrains @Valid @NotNull  work on Generics  Type Param in Java with Spring Web MVC.


Affects: 5.0.1

Comment From: spring-projects-issues

Sébastien Deleuze commented

I have been able to reproduce this issue.

Comment From: spring-projects-issues

Sébastien Deleuze commented

I have raised KT-25158 on Kotlin side.

Comment From: spring-projects-issues

Ankur Pathak commented

The issue registered with Kotlin taking into account:

var names: List\  ---1

But this is not the way we use collections in Kotlin. We use something like:

var names: MutableList\ --2

Even if we get it fixed for case 1 from Kotlin , they how it will work for case 2.

Comment From: sdeleuze

Looks like blocked on https://youtrack.jetbrains.com/issue/KT-13228.

@ankurpathak Could you please provide a repro for the 2nd use case?

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.