diff options
author | Cole Faust <colefaust@google.com> | 2022-10-15 21:33:28 -0700 |
---|---|---|
committer | Cole Faust <colefaust@google.com> | 2022-10-16 13:39:52 -0700 |
commit | baae74fb1422357dee942afc753f1e4ea2839269 (patch) | |
tree | 393a1d7ece4d4a2424ff7ffde6b849791f7233ea | |
parent | 90198b99b83ac24023b63f7a14610315737d3698 (diff) | |
download | dalvik-baae74fb1422357dee942afc753f1e4ea2839269.tar.gz |
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: Ibf99a434679d7dcf3409c6556cc740f768809800
-rw-r--r-- | dexgen/src/com/android/dexgen/dex/file/StringIdItem.java | 7 | ||||
-rw-r--r-- | dx/src/com/android/dx/dex/file/CallSiteIdItem.java | 5 | ||||
-rw-r--r-- | dx/src/com/android/dx/dex/file/StringIdItem.java | 7 |
3 files changed, 8 insertions, 11 deletions
diff --git a/dexgen/src/com/android/dexgen/dex/file/StringIdItem.java b/dexgen/src/com/android/dexgen/dex/file/StringIdItem.java index 30f31d421..f7d1408fc 100644 --- a/dexgen/src/com/android/dexgen/dex/file/StringIdItem.java +++ b/dexgen/src/com/android/dexgen/dex/file/StringIdItem.java @@ -24,7 +24,7 @@ import com.android.dexgen.util.Hex; * Representation of a string inside a Dalvik file. */ public final class StringIdItem - extends IndexedItem implements Comparable { + extends IndexedItem implements Comparable<StringIdItem> { /** size of instances when written out to a file, in bytes */ public static final int WRITE_SIZE = 4; @@ -66,9 +66,8 @@ public final class StringIdItem } /** {@inheritDoc} */ - public int compareTo(Object other) { - StringIdItem otherString = (StringIdItem) other; - return value.compareTo(otherString.value); + public int compareTo(StringIdItem other) { + return value.compareTo(other.value); } /** {@inheritDoc} */ diff --git a/dx/src/com/android/dx/dex/file/CallSiteIdItem.java b/dx/src/com/android/dx/dex/file/CallSiteIdItem.java index cf0bb24ef..ffe445e2a 100644 --- a/dx/src/com/android/dx/dex/file/CallSiteIdItem.java +++ b/dx/src/com/android/dx/dex/file/CallSiteIdItem.java @@ -23,7 +23,7 @@ import com.android.dx.util.Hex; /** * Representation of a call site reference in a DEX file. */ -public final class CallSiteIdItem extends IndexedItem implements Comparable { +public final class CallSiteIdItem extends IndexedItem implements Comparable<CallSiteIdItem> { /** The item size when placed in a DEX file. */ private static final int ITEM_SIZE = 4; @@ -83,8 +83,7 @@ public final class CallSiteIdItem extends IndexedItem implements Comparable { /** {@inheritDoc} */ @Override - public int compareTo(Object o) { - CallSiteIdItem other = (CallSiteIdItem) o; + public int compareTo(CallSiteIdItem other) { return invokeDynamicRef.compareTo(other.invokeDynamicRef); } } diff --git a/dx/src/com/android/dx/dex/file/StringIdItem.java b/dx/src/com/android/dx/dex/file/StringIdItem.java index e4fb559b8..29d399a37 100644 --- a/dx/src/com/android/dx/dex/file/StringIdItem.java +++ b/dx/src/com/android/dx/dex/file/StringIdItem.java @@ -25,7 +25,7 @@ import com.android.dx.util.Hex; * Representation of a string inside a Dalvik file. */ public final class StringIdItem - extends IndexedItem implements Comparable { + extends IndexedItem implements Comparable<StringIdItem> { /** {@code non-null;} the string value */ private final CstString value; @@ -65,9 +65,8 @@ public final class StringIdItem /** {@inheritDoc} */ @Override - public int compareTo(Object other) { - StringIdItem otherString = (StringIdItem) other; - return value.compareTo(otherString.value); + public int compareTo(StringIdItem other) { + return value.compareTo(other.value); } /** {@inheritDoc} */ |