hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Purtell (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (HBASE-11912) Catch some bad practices at compile time with error-prone
Date Sun, 19 Oct 2014 21:58:34 GMT

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

Andrew Purtell edited comment on HBASE-11912 at 10/19/14 9:58 PM:
------------------------------------------------------------------

Here's an updated patch that works with latest master.

Unfortunately we must avoid using error-prone, on a per-module basis, on the default-compile
or default-testCompile compiler execution (or both) where there are generated protobuf sources.
This is because generated protobuf code trips an error-prone ERROR rule and <exclude>
directives for the Maven compiler plugin, from version 2.2 and higher will not prevent compilation
of classes within source directories _that are needed for successful compilation_ even if
they have been excluded.

We use error-prone + javac to compile module main and test sources in two different phases,
except:
- hbase-annotations: No executable code here
- hbase-assembly: No code here
- hbase-checkstyle: No code here
- hbase-native-client: No java code here
- hbase-protocol: Generated protobuf code trips error-prone ERROR rule
- hbase-rest: Generated protobuf code trips error-prone ERROR rule
- hbase-server: Main sources only. We exclude test code because generated protobuf code trips
error-prone ERROR rule

I think is as good as we can do until we switch to a custom version of error-prone, which
is the plan I think, since error-prone adds only marginal value beyond FindBugs and Checkstyle
unless we pursuing development of additional plugins that flag new anti-patterns we agree
are as such.


was (Author: apurtell):
Here's an updated patch that works with latest master.

Unfortunately we must avoid using error-prone, on a per-module basis, on the default-compile
or default-testCompile compiler execution (or both) where there are generated protobuf sources.
This is because generated protobuf code trips an error-prone ERROR rule and <exclude>
directives for the Maven compiler plugin, from version 2.2 and higher will not prevent compilation
of classes within source directories _that are needed for successful compilation_ even if
they have been excluded.

We use error-prone + javac to compile module main and test sources in two different phases,
except:
- hbase-annotations: No code here
- hbase-assembly: No code here
- hbase-checkstyle: No code here
- hbase-native-client: No java code here
- hbase-protocol: Generated protobuf code trips error-prone ERROR rule
- hbase-rest: Generated protobuf code trips error-prone ERROR rule
- hbase-server: Main sources only. We exclude test code because generated protobuf code trips
error-prone ERROR rule

I think is as good as we can do until we switch to a custom version of error-prone, which
is the plan I think, since error-prone adds only marginal value beyond FindBugs and Checkstyle
unless we pursuing development of additional plugins that flag new anti-patterns we agree
are as such.

> Catch some bad practices at compile time with error-prone
> ---------------------------------------------------------
>
>                 Key: HBASE-11912
>                 URL: https://issues.apache.org/jira/browse/HBASE-11912
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: Andrew Purtell
>         Attachments: HBASE-11912.patch, HBASE-11912.patch, HBASE-11912.patch
>
>
> Google's error-prone (https://code.google.com/p/error-prone/) wraps javac with some additional
static analysis that will generate additional warnings or errors at compile time if certain
bug patterns (https://code.google.com/p/error-prone/wiki/BugPatterns) are detected. What's
nice about this approach, as opposed to findbugs, is the compile time detection and erroring
out prevent the detected problems from getting into the codebase up front.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message