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

Commit 91cb9a6a 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: I454a105ae82484a2d19aff1808e8d9dd55ba64f4
parent 370d41de
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -281,7 +281,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
        if (DEBUG_LISTENER) {
            final String output = code == Constants.CODE_OUTPUT_TEXT
                    ? key.getOutputText() : Constants.printableCode(code);
            Log.d(TAG, String.format("[%d] onCodeInput: %4d %4d %s%s%s", mPointerId, x, y,
            Log.d(TAG, String.format("[%d] onCodeInput: %4d %4d %s%s%s%s", mPointerId, x, y,
                    output, ignoreModifierKey ? " ignoreModifier" : "",
                    altersCode ? " altersCode" : "", key.isEnabled() ? "" : " disabled"));
        }
+1 −1
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ public final class CursorAnchorInfoUtils {
                        if (isTopLeftVisible || isBottomRightVisible) {
                            characterBoundsFlags |= CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION;
                        }
                        if (!isTopLeftVisible || !isTopLeftVisible) {
                        if (!isTopLeftVisible || !isBottomRightVisible) {
                            characterBoundsFlags |= CursorAnchorInfo.FLAG_HAS_INVISIBLE_REGION;
                        }
                        if (isRtl) {
+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ abstract class ExpectedKeyOutput {

        @Override
        boolean hasSameKeyOutput(final String text) {
            return text.equals(text);
            return mText.equals(text);
        }

        @Override
+2 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Objects;

/**
 * An implementation of DictEncoder for version 2 binary dictionary.
@@ -100,7 +101,7 @@ public class Ver2DictEncoder implements DictEncoder {
        Collections.sort(codePointOccurrenceArray, new Comparator<Entry<Integer, Integer>>() {
            @Override
            public int compare(final Entry<Integer, Integer> a, final Entry<Integer, Integer> b) {
                if (a.getValue() != b.getValue()) {
                if (!Objects.equals(a.getValue(), b.getValue())) {
                    return b.getValue().compareTo(a.getValue());
                }
                return b.getKey().compareTo(a.getKey());
+1 −1
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ public class BinaryDictOffdeviceUtilsTests extends TestCase {
        options.put("locale", "en_US");
        options.put("version", Integer.toString(mRandom.nextInt()));
        // Add some random options for test
        final int numberOfOptionsToAdd = mRandom.nextInt() % (MAX_NUMBER_OF_OPTIONS_TO_ADD + 1);
        final int numberOfOptionsToAdd = mRandom.nextInt(MAX_NUMBER_OF_OPTIONS_TO_ADD + 1);
        for (int i = 0; i < numberOfOptionsToAdd; ++i) {
            options.put(sWords.get(2 * i), sWords.get(2 * 1 + 1));
        }
Loading