Add new compiler warning patterns
* Mostly new Java and Kotlin warnings found in nightly builds.
* More clean up of Java and C++ warning patterns will follow.
Test: warn.py --url=http://cs/android --separator='?l=' build.log > warnings.html
Change-Id: I8776401d15c3a59535722d52a5eec03f954d3b15
diff --git a/tools/warn/java_warn_patterns.py b/tools/warn/java_warn_patterns.py
index 696ce9a..77b80a4 100644
--- a/tools/warn/java_warn_patterns.py
+++ b/tools/warn/java_warn_patterns.py
@@ -42,8 +42,9 @@
patterns = [
# pylint:disable=line-too-long,g-inconsistent-quotes
# Warnings from Javac
- java_medium('Use of deprecated member',
- [r'.*: warning: \[deprecation\] .+']),
+ java_medium('Use of deprecated',
+ [r'.*: warning: \[deprecation\] .+',
+ r'.*: warning: \[removal\] .+ has been deprecated and marked for removal$']),
java_medium('Unchecked conversion',
[r'.*: warning: \[unchecked\] .+']),
# Warnings generated by Error Prone
@@ -125,6 +126,8 @@
[r".*: warning: \[UseBinds\] .+"]),
java_low('Wildcard imports, static or otherwise, should not be used',
[r".*: warning: \[WildcardImport\] .+"]),
+ java_medium('AcronymName',
+ [r".*\.java:.*: warning: .+ \[AcronymName\]$"]),
java_medium('Method reference is ambiguous',
[r".*: warning: \[AmbiguousMethodReference\] .+"]),
java_medium('This method passes a pair of parameters through to String.format, but the enclosing method wasn\'t annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.',
@@ -265,6 +268,8 @@
[r".*: warning: \[InstanceOfAndCastMatchWrongType\] .+"]),
java_medium('Expression of type int may overflow before being assigned to a long',
[r".*: warning: \[IntLongMath\] .+"]),
+ java_medium('IntentBuilderName',
+ [r".*\.java:.*: warning: .+ \[IntentBuilderName\]$"]),
java_medium('This @param tag doesn\'t refer to a parameter of the method.',
[r".*: warning: \[InvalidParam\] .+"]),
java_medium('This tag is invalid.',
@@ -319,6 +324,8 @@
[r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]),
java_medium('equals method doesn\'t override Object.equals',
[r".*: warning: \[NonOverridingEquals\] .+"]),
+ java_medium('Not closeable',
+ [r".*\.java:.*: warning: .+ \[NotCloseable\]$"]),
java_medium('Constructors should not be annotated with @Nullable since they cannot return null',
[r".*: warning: \[NullableConstructor\] .+"]),
java_medium('Dereference of possibly-null value',
@@ -369,6 +376,8 @@
[r".*: warning: \[RequiredModifiers\] .+"]),
java_medium('Void methods should not have a @return tag.',
[r".*: warning: \[ReturnFromVoid\] .+"]),
+ java_medium('SAM-compatible parameters should be last',
+ [r".*\.java:.*: warning: .+ \[SamShouldBeLast\]$"]),
java_medium(u'Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
[r".*: warning: \[ShortCircuitBoolean\] .+"]),
java_medium('Writes to static fields should not be guarded by instance locks',
@@ -431,6 +440,10 @@
[r".*: warning: \[UnusedException\] .+"]),
java_medium('Java assert is used in test. For testing purposes Assert.* matchers should be used.',
[r".*: warning: \[UseCorrectAssertInTests\] .+"]),
+ java_medium('UserHandle',
+ [r".*\.java:.*: warning: .+ \[UserHandle\]$"]),
+ java_medium('UserHandleName',
+ [r".*\.java:.*: warning: .+ \[UserHandleName\]$"]),
java_medium('Non-constant variable missing @Var annotation',
[r".*: warning: \[Var\] .+"]),
java_medium('variableName and type with the same name would refer to the static field instead of the class',
@@ -449,6 +462,8 @@
[r".*: warning: \[ArrayFillIncompatibleType\] .+"]),
java_high('hashcode method on array does not hash array contents',
[r".*: warning: \[ArrayHashCode\] .+"]),
+ java_high('ArrayReturn',
+ [r".*\.java:.*: warning: .+ \[ArrayReturn\]$"]),
java_high('Calling toString on an array does not provide useful information',
[r".*: warning: \[ArrayToString\] .+"]),
java_high('Arrays.asList does not autobox primitive arrays, as one might expect.',
@@ -500,7 +515,7 @@
java_high('Thread created but not started',
[r".*: warning: \[DeadThread\] .+"]),
java_high('Deprecated item is not annotated with @Deprecated',
- [r".*: warning: \[DepAnn\] .+"]),
+ [r".*\.java:.*: warning: \[.*\] .+ is not annotated with @Deprecated$"]),
java_high('Division by integer literal zero',
[r".*: warning: \[DivZero\] .+"]),
java_high('This method should not be called.',
@@ -721,4 +736,9 @@
[r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]),
java_high('`var` should not be used as a type name.',
[r".*: warning: \[VarTypeName\] .+"]),
+ # Other javac tool warnings
+ java_medium('addNdkApiCoverage failed to getPackage',
+ [r".*: warning: addNdkApiCoverage failed to getPackage"]),
+ java_medium('Supported version from annotation processor',
+ [r".*: warning: Supported source version .+ from annotation processor"]),
]