#597 VisibilityModifier - exclude members with given annotations

Future
closed
nobody
Check (274)
5
2015-01-18
2012-04-12
No

It is quite common to use package access scope to make class members visible in test. There is packageAllowed properties in VisibilityModifier, but it's work globally. It would be useful as an extension to publicMemberPattern to allow to define annotations (like VisibleForTesting) which should cause a field to be ignored when with package access.

http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/annotations/VisibleForTesting.html

Discussion

  • Holger Brands

    Holger Brands - 2012-12-03

    Another use case in the context of checking JUnit test classes:

    @Rule
    public final ErrorCollector errorCollector = new ErrorCollector();
    

    When using method rules, it must be a public member with a @Rule annotation.
    So, you want to exclude these occurences from the VisibilityModifier check.
    Being able to define the field annotations (in this case org.junit.Rule) for exclusion would help here.

     
  • Roman Ivanov

    Roman Ivanov - 2015-01-18
    • status: open --> closed
    • Group: --> Future
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks