It seems to me that there is a similar bug related to issue [#1354].
The validation is successful when there is zero or one annotation, otherwise a false positive is displayed.
<test-code>
<description>FieldDeclarationsShouldBeAtStartOfClass false positive using multiple annotations</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class MyEntity {
private static final String MY_STRING = "STRING";
@Id
@Column
private Long id;
@NotNull
@ManyToOne
@JoinColumn
@Valid
private RelationEntity relation;
public MyEntity() {
}
}
]]></code>
</test-code>
This is impacting us as well, all the single annotations are fine but a double annotation causes a false positive
Yes, I should have thought about multiple annotations :) sorry!
This bug will be fixed with the next version (5.3.3).
Commit: https://github.com/pmd/pmd/commit/19a13c0ab90eee5160252ef3c0e9740cfdf7d86b