public record SomeDto(
// properties omitted
) {
@QueryProjection
public SomeDto {}
}
We use Querydsl and it generates a class by looking at QueryProjection annotation on the constructor. But Sonarcloud says the declaration of the constructor is redundant. In my opinion, even if the constructor is the same as the default one, it should be considered legitimate if it has annotations on it.
Thanks for the response I have one more thing to report. For the exact same code, Sonarcloud also says, by the rule java:S1186, the empty body of the default constructor needs a nested comment explaining why this method is empty. I think this is another case of being false-positive. What do you think, Angelo?
Regarding the rule java:S1186 it is generally a good practice to nest a comment and clarify what is the intent or give more context to avoid confusion; so I would still recommend adding a comment to help future readers, that are not familiar with the framework, to understand what is going on.