Update warn.py for new Error Prone diagnostics

Test: Local build, tee'd to file, ran warn.py and checked output HTML
Change-Id: Iee3386e88c73e4b8e0a1fcc60105ee5fb86e3cb0
This commit is contained in:
Nick Glorioso 2016-11-15 15:57:57 -08:00
parent c7d2fe614e
commit 8a7b25c736

View file

@ -454,7 +454,7 @@ warn_patterns = [
'description': '_ used as an identifier',
'patterns': [r".*: warning: '_' used as an identifier"]},
# Warnings from Error Prone.
# Warnings from Javac
{'category': 'java',
'severity': Severity.MEDIUM,
'description': 'Java: Use of deprecated member',
@ -464,17 +464,32 @@ warn_patterns = [
'description': 'Java: Unchecked conversion',
'patterns': [r'.*: warning: \[unchecked\] .+']},
# Warnings from Error Prone (auto generated list).
# 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: Field name is CONSTANT CASE, but field is not static and final',
'patterns': [r".*: warning: \[ConstantField\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
'Java: Deprecated item is not annotated with @Deprecated',
'patterns': [r".*: warning: \[DepAnn\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
'Java: Fallthrough warning suppression has no effect if warning is suppressed',
'patterns': [r".*: warning: \[FallthroughSuppression\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
@ -483,8 +498,113 @@ warn_patterns = [
{'category': 'java',
'severity': Severity.LOW,
'description':
'Java: @Binds is a more efficient and declaritive mechanism for delegating a binding.',
'patterns': [r".*: warning: \[UseBinds\] .+"]},
'Java: C-style array declarations should not be used',
'patterns': [r".*: warning: \[MixedArrayDimensions\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
'Java: Variable declarations should declare only one variable',
'patterns': [r".*: warning: \[MultiVariableDeclaration\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
'Java: Source files should not contain multiple top-level class declarations',
'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
'Java: Package names should match the directory they are declared in',
'patterns': [r".*: warning: \[PackageLocation\] .+"]},
{'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: Unused imports',
'patterns': [r".*: warning: \[RemoveUnusedImports\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
'Java: Unchecked exceptions do not need to be declared in the method signature.',
'patterns': [r".*: warning: \[ThrowsUncheckedException\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
'Java: Using static imports for types is unnecessary',
'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
'Java: Wildcard imports, static or otherwise, should not be used',
'patterns': [r".*: warning: \[WildcardImport\] .+"]},
{'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: @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: Double-checked locking on non-volatile fields is unsafe',
'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
{'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':
'Java: A different potential argument is more similar to the name of the parameter than the existing argument; this may be an error',
'patterns': [r".*: warning: \[ArgumentParameterMismatch\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@ -495,16 +615,41 @@ warn_patterns = [
'description':
'Java: Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.',
'patterns': [r".*: warning: \[BadAnnotationImplementation\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Possible sign flip from narrowing conversion',
'patterns': [r".*: warning: \[BadComparable\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'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: valueOf or autoboxing provides better time and space performance',
'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Mockito cannot mock final classes',
'patterns': [r".*: warning: \[CannotMockFinalClass\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Inner class is non-static but does not reference enclosing class',
'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Class.newInstance() bypasses exception checking; prefer getConstructor().newInstance()',
'patterns': [r".*: warning: \[ClassNewInstance\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Implicit use of the platform default charset, which can result in e.g. non-ASCII characters being silently replaced with \'?\' in many environments',
'patterns': [r".*: warning: \[DefaultCharset\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@ -530,11 +675,26 @@ warn_patterns = [
'description':
'Java: If you return or throw from a finally, then values returned or thrown from the try-catch block will be ignored. Consider using try-with-resources instead.',
'patterns': [r".*: warning: \[Finally\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Overloads will be ambiguous when passing lambda arguments',
'patterns': [r".*: warning: \[FunctionalInterfaceClash\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'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: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation',
'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.',
'patterns': [r".*: warning: \[InputStreamSlowMultibyteRead\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@ -553,7 +713,7 @@ warn_patterns = [
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Enum switch statement is missing cases',
'Java: The Google Java Style Guide requires switch statements to have an explicit default',
'patterns': [r".*: warning: \[MissingCasesInEnumSwitch\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
@ -568,8 +728,8 @@ warn_patterns = [
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Source files should not contain multiple top-level class declarations',
'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]},
'Java: Compound assignments to bytes, shorts, chars, and floats hide dangerous casts',
'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@ -603,13 +763,8 @@ warn_patterns = [
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Package names should match the directory they are declared in',
'patterns': [r".*: warning: \[PackageLocation\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Second argument to Preconditions.* is a call to String.format(), which can be unwrapped',
'patterns': [r".*: warning: \[PreconditionsErrorMessageEagerEvaluation\] .+"]},
'Java: Use grouping parenthesis to make the operator precedence explicit',
'patterns': [r".*: warning: \[OperatorPrecedence\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@ -625,6 +780,16 @@ warn_patterns = [
'description':
'Java: Protobuf fields cannot be null, so this check is redundant',
'patterns': [r".*: warning: \[ProtoFieldPreconditionsCheckNotNull\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Thrown exception is a subtype of another',
'patterns': [r".*: warning: \[RedundantThrows\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Comparison using reference equality instead of value equality',
'patterns': [r".*: warning: \[ReferenceEquality\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@ -643,13 +808,18 @@ warn_patterns = [
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.',
'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]},
'Java: Truth Library assert is called on a constant.',
'patterns': [r".*: warning: \[TruthConstantAsserts\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Using static imports for types is unnecessary',
'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]},
'Java: An object is tested for equality to itself using Truth Libraries.',
'patterns': [r".*: warning: \[TruthSelfEquals\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
'Java: Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.',
'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@ -666,50 +836,180 @@ warn_patterns = [
'Java: Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop',
'patterns': [r".*: warning: \[WaitNotInLoop\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'severity': Severity.HIGH,
'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\] .+"]},
'Java: Log tag too long, cannot exceed 23 characters.',
'patterns': [r".*: warning: \[IsLoggableTagLength\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'severity': Severity.HIGH,
'description':
'Java: Hardcoded reference to /sdcard',
'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
'Java: Certain resources in `android.R.string` have names that do not match their content',
'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'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: Static and default methods in interfaces are not allowed in android builds.',
'patterns': [r".*: warning: \[StaticOrDefaultInterfaceMethod\] .+"]},
{'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.MEDIUM,
'severity': Severity.HIGH,
'description':
'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
'Java: @CompatibleWith\'s value is not a type argument.',
'patterns': [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'severity': Severity.HIGH,
'description':
'Java: Although Guice allows injecting final fields, doing so is not recommended because the injected value may not be visible to other threads.',
'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: @AssistedInject and @Inject cannot be used on the same constructor.',
'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: @AutoFactory and @Inject should not be used in the same type.',
'patterns': [r".*: warning: \[AutoFactoryAtInject\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Injected constructors cannot be optional nor have binding annotations',
'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: A scoping annotation\'s Target should include TYPE and METHOD.',
'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Abstract and default methods are not injectable with javax.inject.Inject',
'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: @javax.inject.Inject cannot be put on a final field.',
'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.',
'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Using more than one qualifier annotation on the same element is not allowed.',
'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: A class can be annotated with at most one scope annotation.',
'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.',
'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Qualifier applied to a method that isn\'t a @Provides method. This method won\'t be used for dependency injection',
'patterns': [r".*: warning: \[QualifierOnMethodWithoutProvides\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Scope annotation on an interface or abstact class is not allowed',
'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Scoping and qualifier annotations must have runtime retention.',
'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: `@Multibinds` is the new way to declare multibindings.',
'patterns': [r".*: warning: \[MultibindsInsteadOfMultibindings\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.',
'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.',
'patterns': [r".*: warning: \[GuiceInjectOnFinalField\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'severity': Severity.HIGH,
'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\] .+"]},
'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject. The method will not be Injected.',
'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'severity': Severity.HIGH,
'description':
'Java: Double-checked locking on non-volatile fields is unsafe',
'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
'Java: @Provides methods need to be declared in a Module to have any effect.',
'patterns': [r".*: warning: \[ProvidesMethodOutsideOfModule\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'severity': Severity.HIGH,
'description':
'Java: Writes to static fields should not be guarded by instance locks',
'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
'patterns': [r".*: warning: \[GuardedByChecker\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'severity': Severity.HIGH,
'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\] .+"]},
'Java: Invalid @GuardedBy expression',
'patterns': [r".*: warning: \[GuardedByValidator\] .+"]},
{'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\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: An argument is more similar to a different parameter; the arguments may have been swapped.',
'patterns': [r".*: warning: \[ArgumentParameterSwap\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@ -724,7 +1024,7 @@ warn_patterns = [
'severity': Severity.HIGH,
'description':
'Java: Calling toString on an array does not provide useful information',
'patterns': [r".*: warning: \[ArrayToString.*\] .+"]},
'patterns': [r".*: warning: \[ArrayToString\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@ -740,21 +1040,11 @@ warn_patterns = [
'description':
'Java: AsyncFunction should not return a null Future, only a Future whose result is null.',
'patterns': [r".*: warning: \[AsyncFunctionReturnsNull\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Possible sign flip from narrowing conversion',
'patterns': [r".*: warning: \[BadComparable\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Shift by an amount that is out of range',
'patterns': [r".*: warning: \[BadShiftAmount\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: valueOf provides better time and space performance',
'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@ -765,11 +1055,6 @@ warn_patterns = [
'description':
'Java: Ignored return value of method that is annotated with @CheckReturnValue',
'patterns': [r".*: warning: \[CheckReturnValue\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Inner class is non-static but does not reference enclosing class',
'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@ -790,6 +1075,11 @@ warn_patterns = [
'description':
'Java: Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.',
'patterns': [r".*: warning: \[CompileTimeConstant\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Compile-time constant expression overflows',
'patterns': [r".*: warning: \[ConstantOverflow\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@ -815,11 +1105,21 @@ warn_patterns = [
'description':
'Java: Method annotated @ForOverride must be protected or package-private and only invoked from declaring class',
'patterns': [r".*: warning: \[ForOverride\] .+"]},
{'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: Futures.getChecked requires a checked exception type with a standard constructor.',
'patterns': [r".*: warning: \[FuturesGetCheckedIllegalExceptionType\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Calling getClass() on an annotation may return a proxy class',
'patterns': [r".*: warning: \[GetClassOnAnnotation\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@ -838,8 +1138,23 @@ warn_patterns = [
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Cipher.getInstance() is invoked using either the default settings or ECB mode',
'patterns': [r".*: warning: \[InsecureCipherMode\] .+"]},
'Java: Writing "a && a", "a || a", "a & a", or "a | a" is equivalent to "a".',
'patterns': [r".*: warning: \[IdentityBinaryExpression\] .+"]},
{'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: This method always recurses, and will cause a StackOverflowError',
'patterns': [r".*: warning: \[InfiniteRecursion\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: A standard cryptographic operation is used in a mode that is prone to vulnerabilities',
'patterns': [r".*: warning: \[InsecureCryptoUsage\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@ -875,11 +1190,6 @@ warn_patterns = [
'description':
'Java: Test method will not be run; please add @Test annotation',
'patterns': [r".*: warning: \[JUnit4TestNotRun\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Printf-like format string does not match its arguments',
'patterns': [r".*: warning: \[MalformedFormatString\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@ -898,13 +1208,8 @@ warn_patterns = [
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Modifying a collection with itself',
'Java: Using a collection function with itself as the argument.',
'patterns': [r".*: warning: \[ModifyingCollectionWithItself\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Compound assignments to bytes, shorts, chars, and floats hide dangerous casts',
'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@ -918,7 +1223,7 @@ warn_patterns = [
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: @CompileTimeConstant parameters should be final',
'Java: @CompileTimeConstant parameters should be final or effectively final',
'patterns': [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
@ -940,6 +1245,11 @@ warn_patterns = [
'description':
'Java: Varargs doesn\'t agree for overridden method',
'patterns': [r".*: warning: \[Overrides\] .+"]},
{'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':
@ -960,6 +1270,11 @@ warn_patterns = [
'description':
'Java: Comparing protobuf fields of type String using reference equality',
'patterns': [r".*: warning: \[ProtoStringFieldReferenceEquality\] .+"]},
{'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':
@ -979,7 +1294,7 @@ warn_patterns = [
'severity': Severity.HIGH,
'description':
'Java: An object is compared to itself',
'patterns': [r".*: warning: \[SelfComparision\] .+"]},
'patterns': [r".*: warning: \[SelfComparison\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@ -1038,128 +1353,15 @@ warn_patterns = [
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Use of wildcard imports is forbidden',
'patterns': [r".*: warning: \[WildcardImport\] .+"]},
'Java: Collection is modified in place, but the result is not used',
'patterns': [r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Method parameter has wrong package',
'patterns': [r".*: warning: \[ParameterPackage\] .+"]},
{'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: Invalid printf-style format string',
'patterns': [r".*: warning: \[FormatString\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: @AssistedInject and @Inject cannot be used on the same constructor.',
'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Injected constructors cannot be optional nor have binding annotations',
'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: The target of a scoping annotation must be set to METHOD and/or TYPE.',
'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Abstract methods are not injectable with javax.inject.Inject.',
'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: @javax.inject.Inject cannot be put on a final field.',
'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: A class may not have more than one injectable constructor.',
'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Using more than one qualifier annotation on the same element is not allowed.',
'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: A class can be annotated with at most one scope annotation',
'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Annotations cannot be both Qualifiers/BindingAnnotations and Scopes',
'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Scope annotation on an interface or abstact class is not allowed',
'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Scoping and qualifier annotations must have runtime retention.',
'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations. ',
'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject.',
'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
'patterns': [r".*: warning: \[GuardedByChecker\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Invalid @GuardedBy expression',
'patterns': [r".*: warning: \[GuardedByValidator\] .+"]},
{'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\] .+"]},
# End warnings generated by Error Prone
{'category': 'java',
'severity': Severity.UNKNOWN,