[ 
https://issues.apache.org/jira/browse/FLINK-6444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16210810#comment-16210810
 ] 

ASF GitHub Bot commented on FLINK-6444:
---------------------------------------

Github user pnowojski commented on the issue:

    https://github.com/apache/flink/pull/4705
  
    Hmmm, I looked a little bit and it seems like there are tools doing this:
    https://github.com/google/guava/issues/1640
    https://github.com/WorksApplications/findbugs-plugin
    
https://github.com/WorksApplications/findbugs-plugin/commit/d77ca84a9dcc8a99a99a155423c5e7b707a1a5fc
    
    It evens seems to be working based on 
    ```
     * <p>A detector to ensure that implementation (class in src/main/java) 
doesn't call
     * package-private method in other class which is annotated by {@code 
@VisibleForTesting}.
    ```
    
    If above doesn't work/fit us, we could probably easily implement our own 
check for that using 
[findbugs-maven-plugin](https://gleclaire.github.io/findbugs-maven-plugin/usage.html),
 maybe like described 
[here](https://writeoncereadmany.wordpress.com/2016/04/08/how-to-find-bugs-part-3-visiblefortesting/).
    
    Nevertheless I think this feature should be first discussed on a dev 
mailing list. I am not against it (as long as it will not significantly prolong 
builds), but it would be better to discuss this with the community. 


> Add a check that '@VisibleForTesting' methods are only used in tests
> --------------------------------------------------------------------
>
>                 Key: FLINK-6444
>                 URL: https://issues.apache.org/jira/browse/FLINK-6444
>             Project: Flink
>          Issue Type: Improvement
>          Components: Build System
>            Reporter: Stephan Ewen
>            Assignee: mingleizhang
>
> Some methods are annotated with {{@VisibleForTesting}}. These methods should 
> only be called from tests.
> This is currently not enforced / checked during the build. We should add such 
> a check.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to