Menu

#1331 FieldDeclarationsShouldBeAtStartOfClass false positive on annotated fields

PMD-5.3.2
duplicate
None
PMD
3-Major
Bug
5.3.0
2015-10-25
2015-04-06
No

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 

}

Discussion

  • Andreas Dangel

    Andreas Dangel - 2015-05-15

    This is a duplicate of [#1354]. This bug will be fixed with 5.3.2.

     

    Related

    Issues: #1354

  • Andreas Dangel

    Andreas Dangel - 2015-05-15
    • status: open --> duplicate
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-5.3.2
     
  • L.W.

    L.W. - 2015-10-23

    Even 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.

     
  • Andreas Dangel

    Andreas Dangel - 2015-10-25

    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


Log in to post a comment.