FieldDeclarationsShouldBeAtStartOfClass false positive on annotated fields
A source code analyzer
Brought to you by:
adangel,
juansotuyo
The FieldDeclarationsShouldBeAtStartOfClass triggers a false positive on annotated fields. Regardless if that annotated field is the first, last, or somewhere in the middle.
public class InterfaceImportHistory { public static final String MOST_RECENT_INTERFACE_IMPORT = "mostRecentInterfaceImport"; public static final String FORMATS_FOR_ADMIN = "formatTemplatesForAdmin"; public static final String FORMAT_COUNT_FOR_USER = "formatTemplateCountForUser"; public static final String FORMAT_COUNT_FOR_ADMIN = "formatTemplateCountForAdmin"; @Id @GeneratedValue private long id; // failure is listed for line above private String fileName; // rest of class }
This is a duplicate of [#1354]. This bug will be fixed with 5.3.2.
Related
Issues:
#1354Even with the fix of #1354 in version 5.3.2 this rule still triggers a false positive if a field has more than one annotation.
Somebody else also figured out the problem with multiple annotations: [#1364] - please use the lastest PMD version, it should be fixed already.
It should be fixed since PMD 5.3.3.
Thanks!
Related
Issues:
#1364