Menu

#1410 DefaultPackage triggers on field annotated with @VisibleForTesting

PMD-5.3.5
closed
None
PMD
3-Major
Bug
java-controversial/DefaultPackage
2015-09-30
2015-09-19
No

The below code should not raise DefaultPackage rule violations:

@VisibleForTesting static final int[] ints = {};

Discussion

  • Andreas Dangel

    Andreas Dangel - 2015-09-20
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-5.3.5
    • Ruleset / Rule: --> java-controversial/DefaultPackage
     
  • Michał Kordas

    Michał Kordas - 2015-09-20

    Andreas, thanks for fixing that!
    Shouldn't we also update documentation to say more clearly that this rule prevents accidental default scoping and allows methods/fields annotated with Guava's VisibleForTesting? I can raise PR for that if you agree.

     
  • Andreas Dangel

    Andreas Dangel - 2015-09-21

    Sure, this sounds great! Please create the PR for the branch "pmd/5.3.x". Thanks!

     

Log in to post a comment.