diff --git a/tools/warn.py b/tools/warn.py index 2208d6df71..9b2afeed67 100755 --- a/tools/warn.py +++ b/tools/warn.py @@ -496,36 +496,6 @@ warn_patterns = [ 'patterns': [r'.*: warning: \[unchecked\] .+']}, # Begin warnings generated by Error Prone - {'category': 'java', - 'severity': Severity.LOW, - 'description': - 'Java: @Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.', - 'patterns': [r".*: warning: \[EmptySetMultibindingContributions\] .+"]}, - {'category': 'java', - 'severity': Severity.LOW, - 'description': - 'Java: Add a private constructor to modules that will not be instantiated by Dagger.', - 'patterns': [r".*: warning: \[PrivateConstructorForNoninstantiableModuleTest\] .+"]}, - {'category': 'java', - 'severity': Severity.LOW, - 'description': - 'Java: @Binds is a more efficient and declarative mechanism for delegating a binding.', - 'patterns': [r".*: warning: \[UseBinds\] .+"]}, - {'category': 'java', - 'severity': Severity.LOW, - 'description': - 'Java: Fields that can be null should be annotated @Nullable', - 'patterns': [r".*: warning: \[FieldMissingNullable\] .+"]}, - {'category': 'java', - 'severity': Severity.LOW, - 'description': - 'Java: Method parameters that aren\'t checked for null shouldn\'t be annotated @Nullable', - 'patterns': [r".*: warning: \[ParameterNotNullable\] .+"]}, - {'category': 'java', - 'severity': Severity.LOW, - 'description': - 'Java: Methods that can return null should be annotated @Nullable', - 'patterns': [r".*: warning: \[ReturnMissingNullable\] .+"]}, {'category': 'java', 'severity': Severity.LOW, 'description': @@ -541,11 +511,31 @@ warn_patterns = [ 'description': 'Java: Deprecated item is not annotated with @Deprecated', 'patterns': [r".*: warning: \[DepAnn\] .+"]}, + {'category': 'java', + 'severity': Severity.LOW, + 'description': + 'Java: @Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.', + 'patterns': [r".*: warning: \[EmptySetMultibindingContributions\] .+"]}, + {'category': 'java', + 'severity': Severity.LOW, + 'description': + 'Java: Prefer assertThrows to ExpectedException', + 'patterns': [r".*: warning: \[ExpectedExceptionMigration\] .+"]}, + {'category': 'java', + 'severity': Severity.LOW, + 'description': + 'Java: Fields that can be null should be annotated @Nullable', + 'patterns': [r".*: warning: \[FieldMissingNullable\] .+"]}, {'category': 'java', 'severity': Severity.LOW, 'description': r'Java: Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.', 'patterns': [r".*: warning: \[LambdaFunctionalInterface\] .+"]}, + {'category': 'java', + 'severity': Severity.LOW, + 'description': + 'Java: Logger instances are not constants -- they are mutable and have side effects -- and should not be named using CONSTANT CASE', + 'patterns': [r".*: warning: \[LoggerVariableCase\] .+"]}, {'category': 'java', 'severity': Severity.LOW, 'description': @@ -586,21 +576,46 @@ warn_patterns = [ 'description': 'Java: Non-standard parameter comment; prefer `/*paramName=*/ arg`', 'patterns': [r".*: warning: \[ParameterComment\] .+"]}, + {'category': 'java', + 'severity': Severity.LOW, + 'description': + 'Java: Method parameters that aren\'t checked for null shouldn\'t be annotated @Nullable', + 'patterns': [r".*: warning: \[ParameterNotNullable\] .+"]}, + {'category': 'java', + 'severity': Severity.LOW, + 'description': + 'Java: Add a private constructor to modules that will not be instantiated by Dagger.', + 'patterns': [r".*: warning: \[PrivateConstructorForNoninstantiableModuleTest\] .+"]}, {'category': 'java', 'severity': Severity.LOW, 'description': 'Java: Utility classes (only static members) are not designed to be instantiated and should be made noninstantiable with a default constructor.', 'patterns': [r".*: warning: \[PrivateConstructorForUtilityClass\] .+"]}, + {'category': 'java', + 'severity': Severity.LOW, + 'description': + 'Java: ', + 'patterns': [r".*: warning: \[RemoveFieldPrefixes\] .+"]}, {'category': 'java', 'severity': Severity.LOW, 'description': 'Java: Unused imports', 'patterns': [r".*: warning: \[RemoveUnusedImports\] .+"]}, + {'category': 'java', + 'severity': Severity.LOW, + 'description': + 'Java: Methods that can return null should be annotated @Nullable', + 'patterns': [r".*: warning: \[ReturnMissingNullable\] .+"]}, {'category': 'java', 'severity': Severity.LOW, 'description': 'Java: The default case of a switch should appear at the end of the last statement group', 'patterns': [r".*: warning: \[SwitchDefault\] .+"]}, + {'category': 'java', + 'severity': Severity.LOW, + 'description': + 'Java: Prefer assertThrows to @Test(expected=...)', + 'patterns': [r".*: warning: \[TestExceptionMigration\] .+"]}, {'category': 'java', 'severity': Severity.LOW, 'description': @@ -626,81 +641,21 @@ warn_patterns = [ 'description': 'Java: Using static imports for types is unnecessary', 'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]}, + {'category': 'java', + 'severity': Severity.LOW, + 'description': + 'Java: @Binds is a more efficient and declarative mechanism for delegating a binding.', + 'patterns': [r".*: warning: \[UseBinds\] .+"]}, {'category': 'java', 'severity': Severity.LOW, 'description': 'Java: Wildcard imports, static or otherwise, should not be used', 'patterns': [r".*: warning: \[WildcardImport\] .+"]}, - {'category': 'java', - 'severity': Severity.LOW, - 'description': - 'Java: ', - 'patterns': [r".*: warning: \[RemoveFieldPrefixes\] .+"]}, - {'category': 'java', - 'severity': Severity.LOW, - 'description': - 'Java: Prefer assertThrows to ExpectedException', - 'patterns': [r".*: warning: \[ExpectedExceptionMigration\] .+"]}, - {'category': 'java', - 'severity': Severity.LOW, - 'description': - 'Java: Logger instances are not constants -- they are mutable and have side effects -- and should not be named using CONSTANT CASE', - 'patterns': [r".*: warning: \[LoggerVariableCase\] .+"]}, - {'category': 'java', - 'severity': Severity.LOW, - 'description': - 'Java: Prefer assertThrows to @Test(expected=...)', - 'patterns': [r".*: warning: \[TestExceptionMigration\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': - 'Java: Public fields must be final.', - 'patterns': [r".*: warning: \[NonFinalPublicFields\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Private fields that are only assigned in the initializer should be made final.', - 'patterns': [r".*: warning: \[PrivateFieldsNotAssigned\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Lists returned by methods should be immutable.', - 'patterns': [r".*: warning: \[ReturnedListNotImmutable\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Parameters to log methods should not be generated by a call to String.format() or MessageFormat.format().', - 'patterns': [r".*: warning: \[SaferLoggerFormat\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Parameters to log methods should not be generated by a call to toString(); see b/22986665.', - 'patterns': [r".*: warning: \[SaferLoggerToString\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code.', - 'patterns': [r".*: warning: \[BinderIdentityRestoredDangerously\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.', - 'patterns': [r".*: warning: \[FragmentInjection\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor', - 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Hardcoded reference to /sdcard', - 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.', - 'patterns': [r".*: warning: \[WakelockReleasedDangerously\] .+"]}, + 'Java: Method reference is ambiguous', + 'patterns': [r".*: warning: \[AmbiguousMethodReference\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -711,71 +666,6 @@ warn_patterns = [ 'description': 'Java: Arguments are swapped in assertEquals-like call', 'patterns': [r".*: warning: \[AssertEqualsArgumentOrderChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: An equality test between objects with incompatible types always returns false', - 'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.', - 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.', - 'patterns': [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Injection frameworks currently don\'t understand Qualifiers in TYPE PARAMETER or TYPE USE contexts.', - 'patterns': [r".*: warning: \[QualifierWithTypeUse\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: This code declares a binding for a common value type without a Qualifier annotation.', - 'patterns': [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.', - 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)', - 'patterns': [r".*: warning: \[InconsistentOverloads\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Double-checked locking on non-volatile fields is unsafe', - 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Annotations should always be immutable', - 'patterns': [r".*: warning: \[ImmutableAnnotationChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Enums should always be immutable', - 'patterns': [r".*: warning: \[ImmutableEnumChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Writes to static fields should not be guarded by instance locks', - 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.', - 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Method reference is ambiguous', - 'patterns': [r".*: warning: \[AmbiguousMethodReference\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -786,6 +676,11 @@ warn_patterns = [ 'description': 'Java: This assertion throws an AssertionError if it fails, which will be caught by an enclosing try block.', 'patterns': [r".*: warning: \[AssertionFailureIgnored\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.', + 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -801,6 +696,16 @@ warn_patterns = [ 'description': 'Java: BigDecimal(double) and BigDecimal.valueOf(double) may lose precision, prefer BigDecimal(String) or BigDecimal(long)', 'patterns': [r".*: warning: \[BigDecimalLiteralDouble\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code.', + 'patterns': [r".*: warning: \[BinderIdentityRestoredDangerously\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: This code declares a binding for a common value type without a Qualifier annotation.', + 'patterns': [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -871,6 +776,11 @@ warn_patterns = [ 'description': 'Java: Implicit use of the platform default charset, which can result in differing behavior between JVM executions or incorrect behavior if the encoding of the data source doesn\'t match expectations.', 'patterns': [r".*: warning: \[DefaultCharset\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Double-checked locking on non-volatile fields is unsafe', + 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -881,6 +791,11 @@ warn_patterns = [ 'description': 'Java: Classes that override equals should also override hashCode.', 'patterns': [r".*: warning: \[EqualsHashCode\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: An equality test between objects with incompatible types always returns false', + 'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -906,6 +821,36 @@ warn_patterns = [ 'description': 'Java: Floating point literal loses precision', 'patterns': [r".*: warning: \[FloatingPointLiteralPrecision\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Invalid message format-style format specifier ({0}), expected printf-style (%s)', + 'patterns': [r".*: warning: \[FloggerMessageFormat\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Logger level check is already implied in the log() call. An explicit at[Level]().isEnabled() check is redundant.', + 'patterns': [r".*: warning: \[FloggerRedundantIsEnabled\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Calling withCause(Throwable) with an inline allocated Throwable is discouraged. Consider using withStackTrace(StackSize) instead, and specifying a reduced stack size (e.g. SMALL, MEDIUM or LARGE) instead of FULL, to improve performance.', + 'patterns': [r".*: warning: \[FloggerWithCause\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Use withCause to associate Exceptions with log statements', + 'patterns': [r".*: warning: \[FloggerWithoutCause\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.', + 'patterns': [r".*: warning: \[FragmentInjection\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor', + 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -921,21 +866,51 @@ warn_patterns = [ 'description': 'Java: Calling getClass() on an enum may return a subclass of the enum type', 'patterns': [r".*: warning: \[GetClassOnEnum\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Hardcoded reference to /sdcard', + 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': 'Java: Hiding fields of superclasses may cause confusion and errors', 'patterns': [r".*: warning: \[HidingField\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: No bug exists to track an ignored test', + 'patterns': [r".*: warning: \[IgnoredTestWithoutBug\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Annotations should always be immutable', + 'patterns': [r".*: warning: \[ImmutableAnnotationChecker\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Enums should always be immutable', + 'patterns': [r".*: warning: \[ImmutableEnumChecker\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': 'Java: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation', 'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)', + 'patterns': [r".*: warning: \[InconsistentOverloads\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': 'Java: This for loop increments the same variable in the header and in the body', 'patterns': [r".*: warning: \[IncrementInForLoopAndHeader\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.', + 'patterns': [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -966,6 +941,16 @@ warn_patterns = [ 'description': 'Java: Some JUnit4 construct cannot be used in a JUnit3 context. Convert your class to JUnit4 style to use them.', 'patterns': [r".*: warning: \[JUnit4ClassUsedInJUnit3\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: @Ignore is preferred to @Suppress for JUnit4 tests. @Suppress may silently fail in JUnit4 (that is, tests may run anyway.)', + 'patterns': [r".*: warning: \[JUnit4SuppressWithoutIgnore\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Medium and large test classes should document why they are medium or large', + 'patterns': [r".*: warning: \[JUnit4TestAttributeMissing\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -976,11 +961,26 @@ warn_patterns = [ 'description': 'Java: Never reuse class names from java.lang', 'patterns': [r".*: warning: \[JavaLangClash\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: java.net.IDN implements the older IDNA2003 standard. Prefer com.google.i18n.Idn, which implements the newer UTS #46 standard', + 'patterns': [r".*: warning: \[JavaNetIdn\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': 'Java: Suggests alternatives to obsolete JDK classes.', 'patterns': [r".*: warning: \[JdkObsolete\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Consider requiring strict parsing on JodaDurationFlag instances. Before adjusting existing flags, check the documentation and your existing configuration to avoid crashes!', + 'patterns': [r".*: warning: \[JodaDurationFlagStrictParsing\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Logging an exception and throwing it (or a new exception) for the same exceptional situation is an anti-pattern.', + 'patterns': [r".*: warning: \[LogAndThrow\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -1006,6 +1006,11 @@ warn_patterns = [ 'description': 'Java: method overrides method in supertype; expected @Override', 'patterns': [r".*: warning: \[MissingOverride\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: FormattingLogger uses wrong or mismatched format string', + 'patterns': [r".*: warning: \[MisusedFormattingLogger\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -1046,6 +1051,16 @@ warn_patterns = [ 'description': 'Java: Static import of member uses non-canonical name', 'patterns': [r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Flags should be final', + 'patterns': [r".*: warning: \[NonFinalFlag\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Public fields must be final.', + 'patterns': [r".*: warning: \[NonFinalPublicFields\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -1091,11 +1106,21 @@ warn_patterns = [ 'description': 'Java: Varargs doesn\'t agree for overridden method', 'patterns': [r".*: warning: \[Overrides\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.', + 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': 'Java: Detects `/* name= */`-style comments on actual parameters where the name doesn\'t match the formal parameter', 'patterns': [r".*: warning: \[ParameterName\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Pluggable Type checker internal error', + 'patterns': [r".*: warning: \[PluggableTypeChecker\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -1106,6 +1131,11 @@ warn_patterns = [ 'description': 'Java: Passing a primitive array to a varargs method is usually wrong', 'patterns': [r".*: warning: \[PrimitiveArrayPassedToVarargsMethod\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Private fields that are only assigned in the initializer should be made final.', + 'patterns': [r".*: warning: \[PrivateFieldsNotAssigned\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -1116,6 +1146,11 @@ warn_patterns = [ 'description': 'Java: BugChecker has incorrect ProvidesFix tag, please update', 'patterns': [r".*: warning: \[ProvidesFix\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Injection frameworks currently don\'t understand Qualifiers in TYPE PARAMETER or TYPE USE contexts.', + 'patterns': [r".*: warning: \[QualifierWithTypeUse\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -1136,11 +1171,36 @@ warn_patterns = [ 'description': 'Java: This annotation is missing required modifiers as specified by its @RequiredModifiers annotation', 'patterns': [r".*: warning: \[RequiredModifiers\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Lists returned by methods should be immutable.', + 'patterns': [r".*: warning: \[ReturnedListNotImmutable\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Parameters to log methods should not be generated by a call to String.format() or MessageFormat.format().', + 'patterns': [r".*: warning: \[SaferLoggerFormat\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Parameters to log methods should not be generated by a call to toString(); see b/22986665.', + 'patterns': [r".*: warning: \[SaferLoggerToString\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': r'Java: Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.', 'patterns': [r".*: warning: \[ShortCircuitBoolean\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Reading a flag from a static field or initializer block will cause it to always receive the default value and will cause an IllegalFlagStateException if the flag is ever set.', + 'patterns': [r".*: warning: \[StaticFlagUsage\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Writes to static fields should not be guarded by instance locks', + 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -1166,6 +1226,11 @@ warn_patterns = [ 'description': 'Java: Prefer Splitter to String.split', 'patterns': [r".*: warning: \[StringSplitter\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.', + 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -1216,6 +1281,11 @@ warn_patterns = [ 'description': 'Java: Finalizer may run before native code finishes execution', 'patterns': [r".*: warning: \[UnsafeFinalization\] .+"]}, + {'category': 'java', + 'severity': Severity.MEDIUM, + 'description': + 'Java: Apps must use BuildCompat.isAtLeastO to check whether they\'re running on Android O', + 'patterns': [r".*: warning: \[UnsafeSdkVersionCheck\] .+"]}, {'category': 'java', 'severity': Severity.MEDIUM, 'description': @@ -1239,208 +1309,23 @@ warn_patterns = [ {'category': 'java', 'severity': Severity.MEDIUM, 'description': - 'Java: Pluggable Type checker internal error', - 'patterns': [r".*: warning: \[PluggableTypeChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Invalid message format-style format specifier ({0}), expected printf-style (%s)', - 'patterns': [r".*: warning: \[FloggerMessageFormat\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Logger level check is already implied in the log() call. An explicit at[Level]().isEnabled() check is redundant.', - 'patterns': [r".*: warning: \[FloggerRedundantIsEnabled\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Calling withCause(Throwable) with an inline allocated Throwable is discouraged. Consider using withStackTrace(StackSize) instead, and specifying a reduced stack size (e.g. SMALL, MEDIUM or LARGE) instead of FULL, to improve performance.', - 'patterns': [r".*: warning: \[FloggerWithCause\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Use withCause to associate Exceptions with log statements', - 'patterns': [r".*: warning: \[FloggerWithoutCause\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: No bug exists to track an ignored test', - 'patterns': [r".*: warning: \[IgnoredTestWithoutBug\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: @Ignore is preferred to @Suppress for JUnit4 tests. @Suppress may silently fail in JUnit4 (that is, tests may run anyway.)', - 'patterns': [r".*: warning: \[JUnit4SuppressWithoutIgnore\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Medium and large test classes should document why they are medium or large', - 'patterns': [r".*: warning: \[JUnit4TestAttributeMissing\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: java.net.IDN implements the older IDNA2003 standard. Prefer com.google.i18n.Idn, which implements the newer UTS #46 standard', - 'patterns': [r".*: warning: \[JavaNetIdn\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Consider requiring strict parsing on JodaDurationFlag instances. Before adjusting existing flags, check the documentation and your existing configuration to avoid crashes!', - 'patterns': [r".*: warning: \[JodaDurationFlagStrictParsing\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Logging an exception and throwing it (or a new exception) for the same exceptional situation is an anti-pattern.', - 'patterns': [r".*: warning: \[LogAndThrow\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: FormattingLogger uses wrong or mismatched format string', - 'patterns': [r".*: warning: \[MisusedFormattingLogger\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Flags should be final', - 'patterns': [r".*: warning: \[NonFinalFlag\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Reading a flag from a static field or initializer block will cause it to always receive the default value and will cause an IllegalFlagStateException if the flag is ever set.', - 'patterns': [r".*: warning: \[StaticFlagUsage\] .+"]}, - {'category': 'java', - 'severity': Severity.MEDIUM, - 'description': - 'Java: Apps must use BuildCompat.isAtLeastO to check whether they\'re running on Android O', - 'patterns': [r".*: warning: \[UnsafeSdkVersionCheck\] .+"]}, + 'Java: A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.', + 'patterns': [r".*: warning: \[WakelockReleasedDangerously\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: Logging tag cannot be longer than 23 characters.', - 'patterns': [r".*: warning: \[LogTagLength\] .+"]}, + 'Java: Adds checkOrThrow calls where needed', + 'patterns': [r".*: warning: \[AddCheckOrThrow\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: Relative class name passed to ComponentName constructor', - 'patterns': [r".*: warning: \[RelativeComponentName\] .+"]}, + 'Java: Use of class, field, or method that is not compatible with legacy Android devices', + 'patterns': [r".*: warning: \[AndroidApiChecker\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: Explicitly enumerate all cases in switch statements for certain enum types.', - 'patterns': [r".*: warning: \[EnumerateAllCasesInEnumSwitch\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Do not call assumeTrue(tester.getExperimentValueFor(...)). Use @RequireEndToEndTestExperiment instead.', - 'patterns': [r".*: warning: \[JUnitAssumeExperiment\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: The accessed field or method is not visible here. Note that the default production visibility for @VisibleForTesting is Visibility.PRIVATE.', - 'patterns': [r".*: warning: \[VisibleForTestingChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Detects errors encountered building Error Prone plugins', - 'patterns': [r".*: warning: \[ErrorPronePluginCorrectness\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - r'Java: Parcelable CREATOR fields should be Creator\u003cT>', - 'patterns': [r".*: warning: \[ParcelableCreatorType\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Enforce reflected Parcelables are kept by Proguard', - 'patterns': [r".*: warning: \[ReflectedParcelable\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Any class that extends IntentService should have @Nullable notation on method onHandleIntent(@Nullable Intent intent) and handle the case if intent is null.', - 'patterns': [r".*: warning: \[OnHandleIntentNullableChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: In many cases, randomUUID is not necessary, and it slows the performance, which can be quite severe especially when this operation happens at start up time. Consider replacing it with cheaper alternatives, like object.hashCode() or IdGenerator.INSTANCE.getRandomId()', - 'patterns': [r".*: warning: \[UUIDChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: DynamicActivity.findViewById(int) is slow and should not be used inside View.onDraw(Canvas)!', - 'patterns': [r".*: warning: \[NoFindViewByIdInOnDrawChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Passing Throwable/Exception argument to the message format L.x(). Calling L.w(tag, message, ex) instead of L.w(tag, ex, message)', - 'patterns': [r".*: warning: \[WrongThrowableArgumentInLogChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: New splicers are disallowed on paths that are being Libsearched', - 'patterns': [r".*: warning: \[BlacklistedSplicerPathChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Object serialized in Bundle may have been flattened to base type.', - 'patterns': [r".*: warning: \[BundleDeserializationCast\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Log tag too long, cannot exceed 23 characters.', - 'patterns': [r".*: warning: \[IsLoggableTagLength\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Certain resources in `android.R.string` have names that do not match their content', - 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Return value of android.graphics.Rect.intersect() must be checked', - 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Incompatible type as argument to Object-accepting Java collections method', - 'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: @CompatibleWith\'s value is not a type argument.', - 'patterns': [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Passing argument to a generic method with an incompatible type.', - 'patterns': [r".*: warning: \[IncompatibleArgumentType\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Invalid printf-style format string', - 'patterns': [r".*: warning: \[FormatString\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Invalid format string passed to formatting method.', - 'patterns': [r".*: warning: \[FormatStringAnnotation\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations', - 'patterns': [r".*: warning: \[GuardedBy\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Type declaration annotated with @Immutable is not immutable', - 'patterns': [r".*: warning: \[Immutable\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: This method does not acquire the locks specified by its @LockMethod annotation', - 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation', - 'patterns': [r".*: warning: \[UnlockMethod\] .+"]}, + 'Java: Invalid use of Flogger format string', + 'patterns': [r".*: warning: \[AndroidFloggerFormatString\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -1481,6 +1366,16 @@ warn_patterns = [ 'description': 'Java: Shift by an amount that is out of range', 'patterns': [r".*: warning: \[BadShiftAmount\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: New splicers are disallowed on paths that are being Libsearched', + 'patterns': [r".*: warning: \[BlacklistedSplicerPathChecker\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Object serialized in Bundle may have been flattened to base type.', + 'patterns': [r".*: warning: \[BundleDeserializationCast\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -1496,6 +1391,11 @@ warn_patterns = [ 'description': 'Java: The source file name should match the name of the top-level class it contains', 'patterns': [r".*: warning: \[ClassName\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Incompatible type as argument to Object-accepting Java collections method', + 'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -1511,6 +1411,11 @@ warn_patterns = [ 'description': 'Java: Comparison to value that is out of range for the compared type', 'patterns': [r".*: warning: \[ComparisonOutOfRange\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: @CompatibleWith\'s value is not a type argument.', + 'patterns': [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -1551,11 +1456,36 @@ warn_patterns = [ 'description': 'Java: This method should not be called.', 'patterns': [r".*: warning: \[DoNotCall\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Use TunnelException.getCauseAs(Class) instead of casting the result of TunnelException.getCause().', + 'patterns': [r".*: warning: \[DoNotCastTunnelExceptionCause\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + r'Java: Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.', + 'patterns': [r".*: warning: \[ComparableType\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Duration Flag should NOT have units in the variable name or the @FlagSpec\'s name or altName field.', + 'patterns': [r".*: warning: \[DurationFlagWithUnits\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Duration.get() only works with SECONDS or NANOS.', + 'patterns': [r".*: warning: \[DurationGetTemporalUnit\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': 'Java: Empty statement after if', 'patterns': [r".*: warning: \[EmptyIf\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Explicitly enumerate all cases in switch statements for certain enum types.', + 'patterns': [r".*: warning: \[EnumerateAllCasesInEnumSwitch\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -1566,16 +1496,51 @@ warn_patterns = [ 'description': 'Java: == must be used in equals method to check equality to itself or an infinite loop will occur.', 'patterns': [r".*: warning: \[EqualsReference\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Detects errors encountered building Error Prone plugins', + 'patterns': [r".*: warning: \[ErrorPronePluginCorrectness\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Invalid printf-style format string', + 'patterns': [r".*: warning: \[FloggerFormatString\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': 'Java: Method annotated @ForOverride must be protected or package-private and only invoked from declaring class, or from an override of the method', 'patterns': [r".*: warning: \[ForOverride\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Equality on Nano protos (== or .equals) might not be the same in Lite', + 'patterns': [r".*: warning: \[ForbidNanoEquality\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Submessages of a proto cannot be mutated', + 'patterns': [r".*: warning: \[ForbidSubmessageMutation\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Invalid printf-style format string', + 'patterns': [r".*: warning: \[FormatString\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Invalid format string passed to formatting method.', + 'patterns': [r".*: warning: \[FormatStringAnnotation\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': 'Java: Casting a lambda to this @FunctionalInterface can cause a behavior change from casting to a functional superinterface, which is surprising to users. Prefer decorator methods to this surprising behavior.', 'patterns': [r".*: warning: \[FunctionalInterfaceMethodChanged\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Future.get in Google Now Producers code', + 'patterns': [r".*: warning: \[FutureGetInNowProducers\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -1596,6 +1561,11 @@ warn_patterns = [ 'description': 'Java: Calling getClass() on an object of type Class returns the Class object for java.lang.Class; you probably meant to operate on the object directly', 'patterns': [r".*: warning: \[GetClassOnClass\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations', + 'patterns': [r".*: warning: \[GuardedBy\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -1606,11 +1576,21 @@ warn_patterns = [ 'description': 'Java: A binary expression where both operands are the same is usually incorrect.', 'patterns': [r".*: warning: \[IdentityBinaryExpression\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Type declaration annotated with @Immutable is not immutable', + 'patterns': [r".*: warning: \[Immutable\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': 'Java: Modifying an immutable collection is guaranteed to throw an exception and leave the collection unmodified', 'patterns': [r".*: warning: \[ImmutableModification\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Passing argument to a generic method with an incompatible type.', + 'patterns': [r".*: warning: \[IncompatibleArgumentType\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -1646,6 +1626,11 @@ warn_patterns = [ 'description': 'Java: The argument to Class#isInstance(Object) should not be a Class', 'patterns': [r".*: warning: \[IsInstanceOfClass\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Log tag too long, cannot exceed 23 characters.', + 'patterns': [r".*: warning: \[IsLoggableTagLength\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -1666,6 +1651,11 @@ warn_patterns = [ 'description': 'Java: This method should be static', 'patterns': [r".*: warning: \[JUnit4ClassAnnotationNonStatic\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Test class may not be run because it is missing a @RunWith annotation', + 'patterns': [r".*: warning: \[JUnit4RunWithMissing\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -1689,278 +1679,8 @@ warn_patterns = [ {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: This pattern will silently corrupt certain byte sequences from the serialized protocol message. Use ByteString or byte[] directly', - 'patterns': [r".*: warning: \[LiteByteStringUtf8\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Loop condition is never modified in loop body.', - 'patterns': [r".*: warning: \[LoopConditionChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Overriding method is missing a call to overridden super method', - 'patterns': [r".*: warning: \[MissingSuperCall\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.', - 'patterns': [r".*: warning: \[MisusedWeekYear\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: A bug in Mockito will cause this test to fail at runtime with a ClassCastException', - 'patterns': [r".*: warning: \[MockitoCast\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Missing method call for verify(mock) here', - 'patterns': [r".*: warning: \[MockitoUsage\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Using a collection function with itself as the argument.', - 'patterns': [r".*: warning: \[ModifyingCollectionWithItself\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: The result of this method must be closed.', - 'patterns': [r".*: warning: \[MustBeClosedChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: The first argument to nCopies is the number of copies, and the second is the item to copy', - 'patterns': [r".*: warning: \[NCopiesOfChar\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: @NoAllocation was specified on this method, but something was found that would trigger an allocation', - 'patterns': [r".*: warning: \[NoAllocation\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Static import of type uses non-canonical name', - 'patterns': [r".*: warning: \[NonCanonicalStaticImport\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: @CompileTimeConstant parameters should be final or effectively final', - 'patterns': [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Calling getAnnotation on an annotation that is not retained at runtime.', - 'patterns': [r".*: warning: \[NonRuntimeAnnotation\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: This conditional expression may evaluate to null, which will result in an NPE when the result is unboxed.', - 'patterns': [r".*: warning: \[NullTernary\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Numeric comparison using reference equality instead of value equality', - 'patterns': [r".*: warning: \[NumericEquality\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Comparison using reference equality instead of value equality', - 'patterns': [r".*: warning: \[OptionalEquality\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Declaring types inside package-info.java files is very bad form', - 'patterns': [r".*: warning: \[PackageInfo\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null', - 'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference', - 'patterns': [r".*: warning: \[PreconditionsCheckNotNullPrimitive\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Using ::equals as an incompatible Predicate; the predicate will always return false', - 'patterns': [r".*: warning: \[PredicateIncompatibleType\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Access to a private protocol buffer field is forbidden. This protocol buffer carries a security contract, and can only be created using an approved library. Direct access to the fields is forbidden.', - 'patterns': [r".*: warning: \[PrivateSecurityContractProtoAccess\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Protobuf fields cannot be null', - 'patterns': [r".*: warning: \[ProtoFieldNullComparison\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Comparing protobuf fields of type String using reference equality', - 'patterns': [r".*: warning: \[ProtoStringFieldReferenceEquality\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: To get the tag number of a protocol buffer enum, use getNumber() instead.', - 'patterns': [r".*: warning: \[ProtocolBufferOrdinal\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0.', - 'patterns': [r".*: warning: \[RandomCast\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Use Random.nextInt(int). Random.nextInt() % n can have negative results', - 'patterns': [r".*: warning: \[RandomModInteger\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Check for non-whitelisted callers to RestrictedApiChecker.', - 'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Return value of this method must be used', - 'patterns': [r".*: warning: \[ReturnValueIgnored\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Variable assigned to itself', - 'patterns': [r".*: warning: \[SelfAssignment\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: An object is compared to itself', - 'patterns': [r".*: warning: \[SelfComparison\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Testing an object for equality with itself will always be true.', - 'patterns': [r".*: warning: \[SelfEquals\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: This method must be called with an even number of arguments.', - 'patterns': [r".*: warning: \[ShouldHaveEvenArgs\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?', - 'patterns': [r".*: warning: \[SizeGreaterThanOrEqualsZero\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Calling toString on a Stream does not provide useful information', - 'patterns': [r".*: warning: \[StreamToString\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: StringBuilder does not have a char constructor; this invokes the int constructor.', - 'patterns': [r".*: warning: \[StringBuilderInitWithChar\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Suppressing "deprecated" is probably a typo for "deprecation"', - 'patterns': [r".*: warning: \[SuppressWarningsDeprecated\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: throwIfUnchecked(knownCheckedException) is a no-op.', - 'patterns': [r".*: warning: \[ThrowIfUncheckedKnownChecked\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Throwing \'null\' always results in a NullPointerException being thrown.', - 'patterns': [r".*: warning: \[ThrowNull\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: isEqualTo should not be used to test an object for equality with itself; the assertion will never fail.', - 'patterns': [r".*: warning: \[TruthSelfEquals\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Catching Throwable/Error masks failures from fail() or assert*() in the try block', - 'patterns': [r".*: warning: \[TryFailThrowable\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Type parameter used as type qualifier', - 'patterns': [r".*: warning: \[TypeParameterQualifier\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Non-generic methods should not be invoked with type arguments', - 'patterns': [r".*: warning: \[UnnecessaryTypeArgument\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Instance created but never used', - 'patterns': [r".*: warning: \[UnusedAnonymousClass\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Collection is modified in place, but the result is not used', - 'patterns': [r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: `var` should not be used as a type name.', - 'patterns': [r".*: warning: \[VarTypeName\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Method parameter has wrong package', - 'patterns': [r".*: warning: \[ParameterPackage\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Type declaration annotated with @ThreadSafe is not thread safe', - 'patterns': [r".*: warning: \[ThreadSafe\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Use of class, field, or method that is not compatible with legacy Android devices', - 'patterns': [r".*: warning: \[AndroidApiChecker\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Invalid use of Flogger format string', - 'patterns': [r".*: warning: \[AndroidFloggerFormatString\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Use TunnelException.getCauseAs(Class) instead of casting the result of TunnelException.getCause().', - 'patterns': [r".*: warning: \[DoNotCastTunnelExceptionCause\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Identifies undesirable mocks.', - 'patterns': [r".*: warning: \[DoNotMock_ForJavaBuilder\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Duration Flag should NOT have units in the variable name or the @FlagSpec\'s name or altName field.', - 'patterns': [r".*: warning: \[DurationFlagWithUnits\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Duration.get() only works with SECONDS or NANOS.', - 'patterns': [r".*: warning: \[DurationGetTemporalUnit\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Invalid printf-style format string', - 'patterns': [r".*: warning: \[FloggerFormatString\] .+"]}, - {'category': 'java', - 'severity': Severity.HIGH, - 'description': - 'Java: Test class may not be run because it is missing a @RunWith annotation', - 'patterns': [r".*: warning: \[JUnit4RunWithMissing\] .+"]}, + 'Java: Do not call assumeTrue(tester.getExperimentValueFor(...)). Use @RequireEndToEndTestExperiment instead.', + 'patterns': [r".*: warning: \[JUnitAssumeExperiment\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -2021,16 +1741,161 @@ warn_patterns = [ 'description': 'Java: LanguageCode comparison using reference equality instead of value equality', 'patterns': [r".*: warning: \[LanguageCodeEquality\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: This pattern will silently corrupt certain byte sequences from the serialized protocol message. Use ByteString or byte[] directly', + 'patterns': [r".*: warning: \[LiteByteStringUtf8\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': 'Java: The zero argument toString is not part of the Localizable interface and likely is just the java Object toString. You probably want to call toString(Locale).', 'patterns': [r".*: warning: \[LocalizableWrongToString\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: This method does not acquire the locks specified by its @LockMethod annotation', + 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Logging tag cannot be longer than 23 characters.', + 'patterns': [r".*: warning: \[LogTagLength\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Loop condition is never modified in loop body.', + 'patterns': [r".*: warning: \[LoopConditionChecker\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Certain resources in `android.R.string` have names that do not match their content', + 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Overriding method is missing a call to overridden super method', + 'patterns': [r".*: warning: \[MissingSuperCall\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.', + 'patterns': [r".*: warning: \[MisusedWeekYear\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: A bug in Mockito will cause this test to fail at runtime with a ClassCastException', + 'patterns': [r".*: warning: \[MockitoCast\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Missing method call for verify(mock) here', + 'patterns': [r".*: warning: \[MockitoUsage\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Using a collection function with itself as the argument.', + 'patterns': [r".*: warning: \[ModifyingCollectionWithItself\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: The result of this method must be closed.', + 'patterns': [r".*: warning: \[MustBeClosedChecker\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: The first argument to nCopies is the number of copies, and the second is the item to copy', + 'patterns': [r".*: warning: \[NCopiesOfChar\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Repeated fields on proto messages cannot be directly referenced', + 'patterns': [r".*: warning: \[NanoUnsafeRepeatedFieldUsage\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: @NoAllocation was specified on this method, but something was found that would trigger an allocation', + 'patterns': [r".*: warning: \[NoAllocation\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: DynamicActivity.findViewById(int) is slow and should not be used inside View.onDraw(Canvas)!', + 'patterns': [r".*: warning: \[NoFindViewByIdInOnDrawChecker\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Static import of type uses non-canonical name', + 'patterns': [r".*: warning: \[NonCanonicalStaticImport\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: @CompileTimeConstant parameters should be final or effectively final', + 'patterns': [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Calling getAnnotation on an annotation that is not retained at runtime.', + 'patterns': [r".*: warning: \[NonRuntimeAnnotation\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: This conditional expression may evaluate to null, which will result in an NPE when the result is unboxed.', + 'patterns': [r".*: warning: \[NullTernary\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Numeric comparison using reference equality instead of value equality', + 'patterns': [r".*: warning: \[NumericEquality\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Any class that extends IntentService should have @Nullable notation on method onHandleIntent(@Nullable Intent intent) and handle the case if intent is null.', + 'patterns': [r".*: warning: \[OnHandleIntentNullableChecker\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Comparison using reference equality instead of value equality', + 'patterns': [r".*: warning: \[OptionalEquality\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Declaring types inside package-info.java files is very bad form', + 'patterns': [r".*: warning: \[PackageInfo\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Method parameter has wrong package', + 'patterns': [r".*: warning: \[ParameterPackage\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + r'Java: Parcelable CREATOR fields should be Creator\u003cT>', + 'patterns': [r".*: warning: \[ParcelableCreatorType\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': 'Java: Period.get() only works with YEARS, MONTHS, or DAYS.', 'patterns': [r".*: warning: \[PeriodGetTemporalUnit\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null', + 'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference', + 'patterns': [r".*: warning: \[PreconditionsCheckNotNullPrimitive\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Using ::equals as an incompatible Predicate; the predicate will always return false', + 'patterns': [r".*: warning: \[PredicateIncompatibleType\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Access to a private protocol buffer field is forbidden. This protocol buffer carries a security contract, and can only be created using an approved library. Direct access to the fields is forbidden.', + 'patterns': [r".*: warning: \[PrivateSecurityContractProtoAccess\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -2044,38 +1909,43 @@ warn_patterns = [ {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: Streams.iterating() is unsafe for use except in the header of a for-each loop; please see its Javadoc for details.', - 'patterns': [r".*: warning: \[StreamsIteratingNotInLoop\] .+"]}, + 'Java: Protobuf fields cannot be null', + 'patterns': [r".*: warning: \[ProtoFieldNullComparison\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: TemporalAccessor.get() only works for certain values of ChronoField.', - 'patterns': [r".*: warning: \[TemporalAccessorGetChronoField\] .+"]}, + 'Java: Comparing protobuf fields of type String using reference equality', + 'patterns': [r".*: warning: \[ProtoStringFieldReferenceEquality\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: Try-with-resources is not supported in this code, use try/finally instead', - 'patterns': [r".*: warning: \[TryWithResources\] .+"]}, + 'Java: To get the tag number of a protocol buffer enum, use getNumber() instead.', + 'patterns': [r".*: warning: \[ProtocolBufferOrdinal\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: Adds checkOrThrow calls where needed', - 'patterns': [r".*: warning: \[AddCheckOrThrow\] .+"]}, + 'Java: Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0.', + 'patterns': [r".*: warning: \[RandomCast\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: Equality on Nano protos (== or .equals) might not be the same in Lite', - 'patterns': [r".*: warning: \[ForbidNanoEquality\] .+"]}, + 'Java: Use Random.nextInt(int). Random.nextInt() % n can have negative results', + 'patterns': [r".*: warning: \[RandomModInteger\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: Submessages of a proto cannot be mutated', - 'patterns': [r".*: warning: \[ForbidSubmessageMutation\] .+"]}, + 'Java: Return value of android.graphics.Rect.intersect() must be checked', + 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: Repeated fields on proto messages cannot be directly referenced', - 'patterns': [r".*: warning: \[NanoUnsafeRepeatedFieldUsage\] .+"]}, + 'Java: Enforce reflected Parcelables are kept by Proguard', + 'patterns': [r".*: warning: \[ReflectedParcelable\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Relative class name passed to ComponentName constructor', + 'patterns': [r".*: warning: \[RelativeComponentName\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': @@ -2089,13 +1959,143 @@ warn_patterns = [ {'category': 'java', 'severity': Severity.HIGH, 'description': - 'Java: Future.get in Google Now Producers code', - 'patterns': [r".*: warning: \[FutureGetInNowProducers\] .+"]}, + 'Java: Check for non-whitelisted callers to RestrictedApiChecker.', + 'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Return value of this method must be used', + 'patterns': [r".*: warning: \[ReturnValueIgnored\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Variable assigned to itself', + 'patterns': [r".*: warning: \[SelfAssignment\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: An object is compared to itself', + 'patterns': [r".*: warning: \[SelfComparison\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Testing an object for equality with itself will always be true.', + 'patterns': [r".*: warning: \[SelfEquals\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: This method must be called with an even number of arguments.', + 'patterns': [r".*: warning: \[ShouldHaveEvenArgs\] .+"]}, {'category': 'java', 'severity': Severity.HIGH, 'description': 'Java: @SimpleEnum applied to non-enum type', 'patterns': [r".*: warning: \[SimpleEnumUsage\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?', + 'patterns': [r".*: warning: \[SizeGreaterThanOrEqualsZero\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Calling toString on a Stream does not provide useful information', + 'patterns': [r".*: warning: \[StreamToString\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Streams.iterating() is unsafe for use except in the header of a for-each loop; please see its Javadoc for details.', + 'patterns': [r".*: warning: \[StreamsIteratingNotInLoop\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: StringBuilder does not have a char constructor; this invokes the int constructor.', + 'patterns': [r".*: warning: \[StringBuilderInitWithChar\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Suppressing "deprecated" is probably a typo for "deprecation"', + 'patterns': [r".*: warning: \[SuppressWarningsDeprecated\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: TemporalAccessor.get() only works for certain values of ChronoField.', + 'patterns': [r".*: warning: \[TemporalAccessorGetChronoField\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Type declaration annotated with @ThreadSafe is not thread safe', + 'patterns': [r".*: warning: \[ThreadSafe\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: throwIfUnchecked(knownCheckedException) is a no-op.', + 'patterns': [r".*: warning: \[ThrowIfUncheckedKnownChecked\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Throwing \'null\' always results in a NullPointerException being thrown.', + 'patterns': [r".*: warning: \[ThrowNull\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: isEqualTo should not be used to test an object for equality with itself; the assertion will never fail.', + 'patterns': [r".*: warning: \[TruthSelfEquals\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Catching Throwable/Error masks failures from fail() or assert*() in the try block', + 'patterns': [r".*: warning: \[TryFailThrowable\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Try-with-resources is not supported in this code, use try/finally instead', + 'patterns': [r".*: warning: \[TryWithResources\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Type parameter used as type qualifier', + 'patterns': [r".*: warning: \[TypeParameterQualifier\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: In many cases, randomUUID is not necessary, and it slows the performance, which can be quite severe especially when this operation happens at start up time. Consider replacing it with cheaper alternatives, like object.hashCode() or IdGenerator.INSTANCE.getRandomId()', + 'patterns': [r".*: warning: \[UUIDChecker\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation', + 'patterns': [r".*: warning: \[UnlockMethod\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Non-generic methods should not be invoked with type arguments', + 'patterns': [r".*: warning: \[UnnecessaryTypeArgument\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Instance created but never used', + 'patterns': [r".*: warning: \[UnusedAnonymousClass\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Collection is modified in place, but the result is not used', + 'patterns': [r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: `var` should not be used as a type name.', + 'patterns': [r".*: warning: \[VarTypeName\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: The accessed field or method is not visible here. Note that the default production visibility for @VisibleForTesting is Visibility.PRIVATE.', + 'patterns': [r".*: warning: \[VisibleForTestingChecker\] .+"]}, + {'category': 'java', + 'severity': Severity.HIGH, + 'description': + 'Java: Passing Throwable/Exception argument to the message format L.x(). Calling L.w(tag, message, ex) instead of L.w(tag, ex, message)', + 'patterns': [r".*: warning: \[WrongThrowableArgumentInLogChecker\] .+"]}, # End warnings generated by Error Prone