Turn on VariableNameSameAsType bug pattern
Only one error was found by this pattern in the file generated for
AutoValue. The change excludes all auto-value generated files from
analysis.
Details: https://errorprone.info/bugpattern/VariableNameSameAsType
Change-Id: If935aa3361a764b67f043308a74a9eebf5432eed
diff --git a/tools/BUILD b/tools/BUILD
index 632156b..df5a729 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -79,6 +79,12 @@
name = "error_prone",
javacopts = [
"-XepDisableWarningsInGeneratedCode",
+ # The XepDisableWarningsInGeneratedCode disables only warnings, but
+ # not errors. We should manually exclude all files generated by
+ # AutoValue; such files always start $AutoValue_.....
+ # XepExcludedPaths is a regexp. If you need more paths - use | as
+ # separator.
+ "-XepExcludedPaths:.*/\\\\$$AutoValue_.*\\.java",
"-Xep:AlmostJavadoc:ERROR",
"-Xep:AlwaysThrows:ERROR",
"-Xep:AmbiguousMethodReference:ERROR",
@@ -446,7 +452,7 @@
"-Xep:UseBinds:ERROR",
# "-Xep:UseCorrectAssertInTests:WARN",
"-Xep:VarTypeName:ERROR",
- # "-Xep:VariableNameSameAsType:WARN",
+ "-Xep:VariableNameSameAsType:ERROR",
"-Xep:WaitNotInLoop:ERROR",
"-Xep:WakelockReleasedDangerously:ERROR",
"-Xep:WildcardImport:ERROR",