I just made a simple sample to reproduce this. Pls take a look. I found the rule id is s2583.
package test;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
public class MyBean {
public String name = null;
public static void main(String[] args) {
MyBean myBean = new MyBean();
if (myBean.getName() != null){
System.out.println("I am not null");
}else {
System.out.println("I am null");
}
}
@NotNull
@Valid
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Actually we can use this Bean inside our code to get/set without validation or use validation if it is needed, that’s depends on use cases.
Thanks.