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

Commit 7da659bb 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: I8446f9076a45ebf7e7ffa06cb0d4ddb1001b6c00
parent 81c4fd80
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -59,4 +59,10 @@ android_test {

    test_suites: ["device-tests"],
    certificate: "platform",

    errorprone: {
        javacflags: [
            "-Xep:ReturnValueIgnored:WARN",
        ],
    },
}
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ public class ReferencePerfTest {
        int got = count.get();
        if (n != got) {
            throw new IllegalStateException(
                    String.format("Only %i of %i objects finalized?", got, n));
                    String.format("Only %d of %d objects finalized?", got, n));
        }
    }
}
+11 −0
Original line number Diff line number Diff line
@@ -396,6 +396,17 @@ public final class SearchableInfo implements Parcelable {
        private final String mSuggestActionMsg;
        private final String mSuggestActionMsgColumn;

        public static final Parcelable.Creator<ActionKeyInfo> CREATOR =
                new Parcelable.Creator<ActionKeyInfo>() {
                    public ActionKeyInfo createFromParcel(Parcel in) {
                        return new ActionKeyInfo(in);
                    }

                    public ActionKeyInfo[] newArray(int size) {
                        return new ActionKeyInfo[size];
                    }
                };

        /**
         * Create one object using attributeset as input data.
         * @param activityContext runtime context of the activity that the action key information
+1 −2
Original line number Diff line number Diff line
@@ -31,5 +31,4 @@ public class ActivityNotFoundException extends RuntimeException
    {
        super(name);
    }
};
}
+3 −3
Original line number Diff line number Diff line
@@ -261,8 +261,8 @@ public abstract class AtomicFormula extends IntegrityFormula {
            }
            LongAtomicFormula that = (LongAtomicFormula) o;
            return getKey() == that.getKey()
                    && mValue == that.mValue
                    && mOperator == that.mOperator;
                    && Objects.equals(mValue, that.mValue)
                    && Objects.equals(mOperator, that.mOperator);
        }

        @Override
@@ -628,7 +628,7 @@ public abstract class AtomicFormula extends IntegrityFormula {
                return false;
            }
            BooleanAtomicFormula that = (BooleanAtomicFormula) o;
            return getKey() == that.getKey() && mValue == that.mValue;
            return getKey() == that.getKey() && Objects.equals(mValue, that.mValue);
        }

        @Override
Loading