Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 620cbb16 authored by Ian Rogers's avatar Ian Rogers Committed by Gerrit Code Review
Browse files

Merge "Add error prone patterns to warn.py"

parents afd3d552 32bb9bd0
Loading
Loading
Loading
Loading
+83 −1
Original line number Diff line number Diff line
@@ -303,6 +303,89 @@ warnpatterns = [
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Unchecked conversion',
        'patterns':[r".*: warning: \[unchecked\] unchecked conversion"] },

    # Warnings from error prone.
    { 'category':'java',    'severity':severity.LOW,   'members':[], 'option':'',
        'description':'Java: Long literal suffix',
        'patterns':[r".*: warning: \[LongLiteralLowerCaseSuffix\] Prefer 'L' to 'l' for the suffix to long literal"] },
    { 'category':'java',    'severity':severity.LOW,   'members':[], 'option':'',
        'description':'Java: Missing @Deprecated',
        'patterns':[r".*: warning: \[DepAnn\] Deprecated item is not annotated with @Deprecated"] },
    { 'category':'java',    'severity':severity.LOW,   'members':[], 'option':'',
        'description':'Java: Use of deprecated member',
        'patterns':[r".*: warning: \[deprecation\] .+ in .+ has been deprecated"] },
    { 'category':'java',    'severity':severity.LOW,   'members':[], 'option':'',
        'description':'Java: Missing hashCode method',
        'patterns':[r".*: warning: \[EqualsHashCode\] Classes that override equals should also override hashCode."] },
    { 'category':'java',    'severity':severity.LOW,   'members':[], 'option':'',
        'description':'Java: Hashtable contains is a legacy method',
        'patterns':[r".*: warning: \[HashtableContains\] contains\(\) is a legacy method that is equivalent to containsValue\(\)"] },
    { 'category':'java',    'severity':severity.LOW,   'members':[], 'option':'',
        'description':'Java: Type parameter used only for return type',
        'patterns':[r".*: warning: \[TypeParameterUnusedInFormals\] 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."] },

    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: reference equality used on arrays',
        'patterns':[r".*: warning: \[ArrayEquals\] Reference equality used to compare arrays"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: hashcode used on array',
        'patterns':[r".*: warning: \[ArrayHashCode\] hashcode method on array does not hash array contents"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: toString used on an array',
        'patterns':[r".*: warning: \[ArrayToStringConcatenation\] Implicit toString used on an array \(String \+ Array\)",
                    r".*: warning: \[ArrayToString\] Calling toString on an array does not provide useful information"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Exception created but not thrown',
        'patterns':[r".*: warning: \[DeadException\] Exception created but not thrown"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Return or throw from a finally',
        'patterns':[r".*: warning: \[Finally\] 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."] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Erroneous use of @GuardedBy',
        'patterns':[r".*: warning: \[GuardedByChecker\] This access should be guarded by '.+'; instead found: '.+'",
                    r".*: warning: \[GuardedByChecker\] This access should be guarded by '.+', which is not currently held"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Mislabeled Android string',
        'patterns':[r".*: warning: \[MislabeledAndroidString\] .+ is not \".+\" but \".+\"; prefer .+ for clarity"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Missing cases in enum switch',
        'patterns':[r".*: warning: \[MissingCasesInEnumSwitch\] Non-exhaustive switch, expected cases for: .+"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Multiple top-level classes (inhibits bug analysis)',
        'patterns':[r".*: warning: \[MultipleTopLevelClasses\] Expected at most one top-level class declaration, instead found: .+"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: equals method doesn\'t override Object.equals',
        'patterns':[r".*: warning: \[NonOverridingEquals\] equals method doesn't override Object\.equals.*"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Update of a volatile variable is non-atomic',
        'patterns':[r".*: warning: \[NonAtomicVolatileUpdate\] This update of a volatile variable is non-atomic"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Return value ignored',
        'patterns':[r".*: warning: \[ReturnValueIgnored\] Return value of this method must be used",
                    r".*: warning: \[RectIntersectReturnValueIgnored\] Return value of android.graphics.Rect.intersect\(\) must be checked"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Static variable accessed from an object instance',
        'patterns':[r".*: warning: \[StaticAccessedFromInstance\] Static (method|variable) .+ should not be accessed from an object instance; instead use .+"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Static guarded by instance',
        'patterns':[r".*: warning: \[StaticGuardedByInstance\] Write to static variable should not be guarded by instance lock '.+'"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: String reference equality',
        'patterns':[r".*: warning: \[StringEquality\] String comparison using reference equality instead of value equality"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Synchronization on non-final field',
        'patterns':[r".*: warning: \[SynchronizeOnNonFinalField\] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects."] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Catch masks fail or assert',
        'patterns':[r".*: warning: \[TryFailThrowable\] Catching Throwable/Error masks failures from fail\(\) or assert\*\(\) in the try block"] },
    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'Java: Wait not in a loop',
        'patterns':[r".*: warning: \[WaitNotInLoop\] Because of spurious wakeups, a?wait.*\(.*\) must always be called in a loop"] },

    { 'category':'java',    'severity':severity.UNKNOWN,   'members':[], 'option':'',
        'description':'Java: Unclassified/unrecognized warnings',
        'patterns':[r".*: warning: \[.+\] .+"] },

    { 'category':'aapt',    'severity':severity.MEDIUM,   'members':[], 'option':'',
        'description':'aapt: No default translation',
        'patterns':[r".*: warning: string '.+' has no default translation in .*"] },
@@ -886,4 +969,3 @@ dumpseverity(severity.TIDY)
dumpseverity(severity.HARMLESS)
dumpseverity(severity.UNKNOWN)
dumpfixed()