简体   繁体   中英

How do I make error-prone ignore my generated source code?

I've recently discovered Error Prone and am integrating it into my Android build using the Gradle plugin linked on their page.

Since our project is using Icepick (and some other code generating annotation processors), we have generated source code, which gets compiled in. Unfortunately, some of the generated code triggers warnings in Error Prone, and I'd like to filter that noise out somehow.

The generated code shows up in the app/build/generated/source/apt/debug directory. How can I exempt this code from Error Prone's steely gaze?

Use the flag -XepDisableWarningsInGeneratedCode

See this issue on GitHub

In my case classes were annotated with @AvroGenerated and -XepDisableWarningsInGeneratedCode didn't work.

The solution was to exclude build directory from checks via -XepExcludedPaths:.*/build/.*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM