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

Commit 27db4326 authored by Cole Faust's avatar Cole Faust
Browse files

Fix errorprone warnings that should be errors

This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:

BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower

See https://errorprone.info/bugpatterns for more
information on the checks.

Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I46d5386474ff6fbd94568c10fdf11dff7016e2bd
parent 5d9c4ebe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -327,4 +327,4 @@ public abstract class Archive implements Closeable {
            checkArgumentEquals(expected.toString(), actual.toString(), message);
        }
    }
};
}
+1 −1
Original line number Diff line number Diff line
@@ -54,4 +54,4 @@ public class ArchiveId {
    public String toDocumentId() {
        return mArchiveUri.toString() + DELIMITER + mAccessMode + DELIMITER + mPath;
    }
};
}
+5 −6
Original line number Diff line number Diff line
@@ -45,12 +45,11 @@ public final class Providers {
    public static final String AUTHORITY_BUGREPORT = "com.android.shell.documents";

    private static final String DOCSUI_PACKAGE = "com.android.documentsui";
    private static final Set<String> SYSTEM_AUTHORITIES = new HashSet<String>() {{
        add(AUTHORITY_STORAGE);
        add(AUTHORITY_DOWNLOADS);
        add(AUTHORITY_MEDIA);
        add(AUTHORITY_MTP);
    }};
    private static final Set<String> SYSTEM_AUTHORITIES = Set.of(
            AUTHORITY_STORAGE,
            AUTHORITY_DOWNLOADS,
            AUTHORITY_MEDIA,
            AUTHORITY_MTP);

    public static boolean isArchiveUri(Uri uri) {
        return uri != null && ArchivesProvider.AUTHORITY.equals(uri.getAuthority());
+3 −3
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ class DirectoryItemAnimator extends DefaultItemAnimator {

    class ItemInfo extends DefaultItemAnimator.ItemHolderInfo {
        boolean isActivated;
    };
    }

    /**
     * Animates changes in background color.
@@ -161,5 +161,5 @@ class DirectoryItemAnimator extends DefaultItemAnimator {

        @Override
        public void onAnimationRepeat(Animator animation) {}
    };
};
    }
}
+3 −4
Original line number Diff line number Diff line
@@ -89,12 +89,11 @@ public class ProvidersCache implements ProvidersAccess, LookupApplicationName {
    // Not all providers are equally well written. If a provider returns
    // empty results we don't cache them...unless they're in this magical list
    // of beloved providers.
    private static final List<String> PERMIT_EMPTY_CACHE = new ArrayList<String>() {{
    private static final List<String> PERMIT_EMPTY_CACHE = List.of(
        // MTP provider commonly returns no roots (if no devices are attached).
        add(Providers.AUTHORITY_MTP);
        Providers.AUTHORITY_MTP,
        // ArchivesProvider doesn't support any roots.
        add(ArchivesProvider.AUTHORITY);
    }};
        ArchivesProvider.AUTHORITY);
    private static final int FIRST_LOAD_TIMEOUT_MS = 5000;

    private final Context mContext;
Loading