Hello,
I have recognized that S2637 finds protected no-arg constructors and marks it as violation of S2637.
We are using always a protected no-arg constructor in @Entity annotated classes for the JPA runtime.
Is there the possibility to ignore such constructors if there is a sufficient other constructor?
@Entity
public class User {
@Id
@NotNull
private int id;
@NotNull
@Column(name = "email", nullable = false)
private String eMail;
@NotNull
@Column(name = "username", nullable = false)
private String userName;
protected User() {
// For JPA ignore this constructor
}
public User(int id, String userName, String name, String password, String eMail) {
this.id = id;
this.eMail = eMail;
this.userName = userName;
this.name = name;
this.password = password;
}
Best Regards