java_medium('This method passes a pair of parameters through to String.format, but the enclosing method wasn\'t annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.',
[r".*: warning: \[AnnotateFormatMethod\] .+"]),
java_medium('Annotations should be positioned after Javadocs, but before modifiers..',
[r".*: warning: \[AnnotationPosition\] .+"]),
java_medium('Arguments are in the wrong order or could be commented for clarity.',
java_medium('Arrays do not override equals() or hashCode, so comparisons will be done on reference equality only. If neither deduplication nor lookup are needed, consider using a List instead. Otherwise, use IdentityHashMap/Set, a Map from a library that handles object arrays, or an Iterable/List of pairs.',
[r".*: warning: \[ArrayAsKeyOfSetOrMap\] .+"]),
java_medium('Arguments are swapped in assertEquals-like call',
java_medium('Make toString(), hashCode() and equals() final in AutoValue classes, so it is clear to readers that AutoValue is not overriding them',
[r".*: warning: \[AutoValueFinalMethods\] .+"]),
java_medium('Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.',
java_medium('Possible sign flip from narrowing conversion',
[r".*: warning: \[BadComparable\] .+"]),
java_medium('Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer.',
[r".*: warning: \[BadImport\] .+"]),
java_medium('instanceof used in a way that is equivalent to a null check.',
[r".*: warning: \[BadInstanceof\] .+"]),
java_medium('BigDecimal#equals has surprising behavior: it also compares scale.',
[r".*: warning: \[BigDecimalEquals\] .+"]),
java_medium('new BigDecimal(double) loses precision in this case.',
java_medium('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.',
java_medium('ByteBuffer.array() shouldn\'t be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate().',
[r".*: warning: \[ByteBufferBackingArray\] .+"]),
java_medium('Mockito cannot mock final classes',
[r".*: warning: \[CannotMockFinalClass\] .+"]),
java_medium('Duration can be expressed more clearly with different units',
[r".*: warning: \[CanonicalDuration\] .+"]),
java_medium('Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace',
java_medium('Constructors should not pass the \'this\' reference out in method invocations, since the object may not be fully constructed.',
[r".*: warning: \[ConstructorLeaksThis\] .+"]),
java_medium('DateFormat is not thread-safe, and should not be used as a constant field.',
[r".*: warning: \[DateFormatConstant\] .+"]),
java_medium('Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn\'t match expectations.',
[r".*: warning: \[DefaultCharset\] .+"]),
java_medium('Avoid deprecated Thread methods; read the method\'s javadoc for details.',
java_medium('equals() implementation may throw NullPointerException when given null',
[r".*: warning: \[EqualsBrokenForNull\] .+"]),
java_medium('Overriding Object#equals in a non-final class by using getClass rather than instanceof breaks substitutability of subclasses.',
[r".*: warning: \[EqualsGetClass\] .+"]),
java_medium('Classes that override equals should also override hashCode.',
[r".*: warning: \[EqualsHashCode\] .+"]),
java_medium('An equality test between objects with incompatible types always returns false',
[r".*: warning: \[EqualsIncompatibleType\] .+"]),
java_medium('The contract of #equals states that it should return false for incompatible types, while this implementation may throw ClassCastException.',
[r".*: warning: \[EqualsUnsafeCast\] .+"]),
java_medium('Implementing #equals by just comparing hashCodes is fragile. Hashes collide frequently, and this will lead to false positives in #equals.',
[r".*: warning: \[EqualsUsingHashCode\] .+"]),
java_medium('Calls to ExpectedException#expect should always be followed by exactly one statement.',
java_medium('When only using JUnit Assert\'s static methods, you should import statically instead of extending.',
[r".*: warning: \[ExtendingJUnitAssert\] .+"]),
java_medium('Switch case may fall through',
[r".*: warning: \[FallThrough\] .+"]),
java_medium('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.',
[r".*: warning: \[Finally\] .+"]),
java_medium('Use parentheses to make the precedence explicit',
[r".*: warning: \[FloatCast\] .+"]),
java_medium('This fuzzy equality check is using a tolerance less than the gap to the next number. You may want a less restrictive tolerance, or to assert equality.',
java_medium('Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.',
[r".*: warning: \[FragmentInjection\] .+"]),
java_medium('Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
java_medium('Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.',
java_medium('The Google Java Style Guide requires that each switch statement includes a default statement group, even if it contains no code. (This requirement is lifted for any switch statement that covers all values of an enum.)',
[r".*: warning: \[MissingDefault\] .+"]),
java_medium('Not calling fail() when expecting an exception masks bugs',
[r".*: warning: \[MissingFail\] .+"]),
java_medium('method overrides method in supertype; expected @Override',
[r".*: warning: \[MissingOverride\] .+"]),
java_medium('A collection or proto builder was created, but its values were never accessed.',
[r".*: warning: \[ModifiedButNotUsed\] .+"]),
java_medium('Modifying a collection while iterating over it in a loop may cause a ConcurrentModificationException to be thrown.',
java_medium('Constant field declarations should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)',
[r".*: warning: \[MutableConstantField\] .+"]),
java_medium('Method return type should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)',
java_medium('Varargs doesn\'t agree for overridden method',
[r".*: warning: \[Overrides\] .+"]),
java_medium('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.',
java_medium('A field on a protocol buffer was set twice in the same chained expression.',
[r".*: warning: \[ProtoRedundantSet\] .+"]),
java_medium('Protos should not be used as a key to a map, in a set, or in a contains method on a descendant of a collection. Protos have non deterministic ordering and proto equality is deep, which is a performance issue.',
[r".*: warning: \[ProtosAsKeyOfSetOrMap\] .+"]),
java_medium('BugChecker has incorrect ProvidesFix tag, please update',
[r".*: warning: \[ProvidesFix\] .+"]),
java_medium('Qualifiers/Scope annotations on @Inject methods don\'t have any effect. Move the qualifier annotation to the binding location.',
java_medium('Code that contains System.exit() is untestable.',
[r".*: warning: \[SystemExitOutsideMain\] .+"]),
java_medium('Using @Test(expected=...) is discouraged, since the test will pass if *any* statement in the test method throws the expected exception',
[r".*: warning: \[TestExceptionChecker\] .+"]),
java_medium('Thread.join needs to be surrounded by a loop until it succeeds, as in Uninterruptibles.joinUninterruptibly.',
[r".*: warning: \[ThreadJoinLoop\] .+"]),
java_medium('ThreadLocals should be stored in static fields',
[r".*: warning: \[ThreadLocalUsage\] .+"]),
java_medium('Relying on the thread scheduler is discouraged; see Effective Java Item 72 (2nd edition) / 84 (3rd edition).',
[r".*: warning: \[ThreadPriorityCheck\] .+"]),
java_medium('Three-letter time zone identifiers are deprecated, may be ambiguous, and might not do what you intend; the full IANA time zone ID should be used instead.',
[r".*: warning: \[ThreeLetterTimeZoneID\] .+"]),
java_medium('An implementation of Object.toString() should never return null.',
[r".*: warning: \[ToStringReturnsNull\] .+"]),
java_medium('The actual and expected values appear to be swapped, which results in poor assertion failure messages. The actual value should come first.',
[r".*: warning: \[TruthAssertExpected\] .+"]),
java_medium('Truth Library assert is called on a constant.',
[r".*: warning: \[TruthConstantAsserts\] .+"]),
java_medium('Argument is not compatible with the subject\'s type.',
[r".*: warning: \[TruthIncompatibleType\] .+"]),
java_medium('Type parameter declaration shadows another named type',
[r".*: warning: \[TypeNameShadowing\] .+"]),
java_medium('Type parameter declaration overrides another type parameter already declared',
[r".*: warning: \[TypeParameterShadowing\] .+"]),
java_medium('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.',
java_medium('Avoid hash-based containers of java.net.URL--the containers rely on equals() and hashCode(), which cause java.net.URL to make blocking internet connections.',
[r".*: warning: \[URLEqualsHashCode\] .+"]),
java_medium('Collection, Iterable, Multimap, and Queue do not have well-defined equals behavior',
[r".*: warning: \[UndefinedEquals\] .+"]),
java_medium('Switch handles all enum values: an explicit default case is unnecessary and defeats error checking for non-exhaustive switches.',
java_medium('Unnecessary use of grouping parentheses',
[r".*: warning: \[UnnecessaryParentheses\] .+"]),
java_medium('Finalizer may run before native code finishes execution',
[r".*: warning: \[UnsafeFinalization\] .+"]),
java_medium('Prefer `asSubclass` instead of casting the result of `newInstance`, to detect classes of incorrect type before invoking their constructors.This way, if the class is of the incorrect type,it will throw an exception before invoking its constructor.',
java_medium('This catch block catches an exception and re-throws another, but swallows the caught exception rather than setting it as a cause. This can make debugging harder.',
[r".*: warning: \[UnusedException\] .+"]),
java_medium('Java assert is used in test. For testing purposes Assert.* matchers should be used.',
java_medium('variableName and type with the same name would refer to the static field instead of the class',
[r".*: warning: \[VariableNameSameAsType\] .+"]),
java_medium('Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop',
[r".*: warning: \[WaitNotInLoop\] .+"]),
java_medium('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.',
java_high('The called constructor accepts a parameter with the same name and type as one of its caller\'s parameters, but its caller doesn\'t pass that parameter to it. It\'s likely that it was intended to.',
java_high('Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.',
[r".*: warning: \[CompileTimeConstant\] .+"]),
java_high('Non-trivial compile time constant boolean expressions shouldn\'t be used.',
[r".*: warning: \[ComplexBooleanConstant\] .+"]),
java_high('A conditional expression with numeric operands of differing types will perform binary numeric promotion of the operands; when these operands are of reference types, the expression\'s result may not be of the expected type.',
java_high('== NaN always returns false; use the isNaN methods instead',
[r".*: warning: \[EqualsNaN\] .+"]),
java_high('== must be used in equals method to check equality to itself or an infinite loop will occur.',
[r".*: warning: \[EqualsReference\] .+"]),
java_high('Comparing different pairs of fields/getters in an equals implementation is probably a mistake.',
[r".*: warning: \[EqualsWrongThing\] .+"]),
java_high('Method annotated @ForOverride must be protected or package-private and only invoked from declaring class, or from an override of the method',
[r".*: warning: \[ForOverride\] .+"]),
java_high('Invalid printf-style format string',
[r".*: warning: \[FormatString\] .+"]),
java_high('Invalid format string passed to formatting method.',
[r".*: warning: \[FormatStringAnnotation\] .+"]),
java_high('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.',
java_high('Calling getClass() on an annotation may return a proxy class',
[r".*: warning: \[GetClassOnAnnotation\] .+"]),
java_high('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',
[r".*: warning: \[GetClassOnClass\] .+"]),
java_high('Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
[r".*: warning: \[GuardedBy\] .+"]),
java_high('Scope annotation on implementation class of AssistedInject factory is not allowed',
java_high('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.',
java_high('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.',