flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piotr Nowojski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-6444) Add a check that '@VisibleForTesting' methods are only used in tests
Date Thu, 19 Oct 2017 12:59:00 GMT

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

Piotr Nowojski commented on FLINK-6444:
---------------------------------------

Hi, sorry for not looking here earlier. As I have written in the pull request:

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/).

Could you try out WorksApplications/findbugs-plugin? The issue might be that they are using
guava's {{VisibleForTesting}}, but maybe it is configurable? 

Does it work, if we create new flink module with an implementation of some maven plugin and
then use this plugin in our build?

> 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)

Mime
View raw message