tbroyer/gradle-errorprone-plugin-v0.0.x

How to ignore Path '/build/generated/source/apt/debug/...'

fifa0329 opened this issue · 1 comments

I use data binding in my app project,
so it generates XXXbinding.java automatically
but I don't want errorprone works for the generated files

Messages output:

Information:Gradle tasks [:kepler:assembleDebug]
/Users/wlx/kepler4android/kepler/build/generated/source/apt/debug/com/taobao/kepler/common/databinding/ToolbarBreadcrumbsLayoutBinding.java
Error:(51, 20) 警告: [MissingOverride] setVariable implements method in ViewDataBinding; expected @Override
(see http://errorprone.info/bugpattern/MissingOverride)
Did you mean '@Override public boolean setVariable(int variableId, Object variable) {'?

I use

tasks.withType(JavaCompile) {
    options.compilerArgs += ['-XepDisableWarningsInGeneratedCode']
}

in my app build.gradle,but it doesn't work

See google/error-prone#329 (which led to introduce the -XepDisableWarningsInGeneratedCode) and google/error-prone#463
Also google/error-prone#523 and google/error-prone#599

In your case though, even if ToolbarBreadcrumbsLayoutBinding were annotated with @Generated, Error Prone detects an error, not a warning, so -XepDisableWarningsInGeneratedCode doesn't apply. You could use -Xep:MissingOverride:WARN to downgrade MissingOverride to a warning (or even turn it off if you prefer), and/or ask the annotation processor author to fix/enhance their generated code.

In any case, this is not an issue with this plugin, which works as intended here.