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: I8b1533cbea835343dcf589cbaa57c63794be58bd
This commit is contained in:
@@ -394,7 +394,7 @@ class DefaultApnSettingsLoader implements ApnSettingsLoader {
|
|||||||
private void loadFromResources(final int subId, final String apnName, final List<Apn> apns) {
|
private void loadFromResources(final int subId, final String apnName, final List<Apn> apns) {
|
||||||
Log.i(MmsService.TAG, "Loading APNs from resources, apnName=" + apnName);
|
Log.i(MmsService.TAG, "Loading APNs from resources, apnName=" + apnName);
|
||||||
final int[] mccMnc = Utils.getMccMnc(mContext, subId);
|
final int[] mccMnc = Utils.getMccMnc(mContext, subId);
|
||||||
if (mccMnc[0] == 0 && mccMnc[0] == 0) {
|
if (mccMnc[0] == 0) {
|
||||||
Log.w(MmsService.TAG, "Can not get valid mcc/mnc from system");
|
Log.w(MmsService.TAG, "Can not get valid mcc/mnc from system");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,7 +188,6 @@ public class EncodedStringValue implements Cloneable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object clone() throws CloneNotSupportedException {
|
public Object clone() throws CloneNotSupportedException {
|
||||||
super.clone();
|
|
||||||
int len = mData.length;
|
int len = mData.length;
|
||||||
byte[] dstBytes = new byte[len];
|
byte[] dstBytes = new byte[len];
|
||||||
System.arraycopy(mData, 0, dstBytes, 0, len);
|
System.arraycopy(mData, 0, dstBytes, 0, len);
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public class DatabaseWrapper {
|
|||||||
}
|
}
|
||||||
if (mLog) {
|
if (mLog) {
|
||||||
printTiming(t1, String.format(Locale.US,
|
printTiming(t1, String.format(Locale.US,
|
||||||
"insertWithOnConflict with ", searchTable));
|
"insertWithOnConflict with %s", searchTable));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,6 @@ public class EncodedStringValue implements Cloneable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object clone() throws CloneNotSupportedException {
|
public Object clone() throws CloneNotSupportedException {
|
||||||
super.clone();
|
|
||||||
int len = mData.length;
|
int len = mData.length;
|
||||||
byte[] dstBytes = new byte[len];
|
byte[] dstBytes = new byte[len];
|
||||||
System.arraycopy(mData, 0, dstBytes, 0, len);
|
System.arraycopy(mData, 0, dstBytes, 0, len);
|
||||||
|
|||||||
@@ -360,6 +360,7 @@ public class ConversationActivity extends BugleActionBarActivity
|
|||||||
return mUiState.shouldResumeComposeMessage();
|
return mUiState.shouldResumeComposeMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("MissingSuperCall") // TODO: fix me
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(final int requestCode, final int resultCode,
|
protected void onActivityResult(final int requestCode, final int resultCode,
|
||||||
final Intent data) {
|
final Intent data) {
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public abstract class AbstractConversationListActivity extends BugleActionBarAc
|
|||||||
return isInConversationListSelectMode();
|
return isInConversationListSelectMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("MissingSuperCall") // TODO: fix me
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
|
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,10 +44,14 @@ public class CameraManagerTest extends BugleTestCase {
|
|||||||
CameraManager.setCameraWrapper(MockCameraFactory.createCameraWrapper());
|
CameraManager.setCameraWrapper(MockCameraFactory.createCameraWrapper());
|
||||||
assertEquals(false, CameraManager.get().hasAnyCamera());
|
assertEquals(false, CameraManager.get().hasAnyCamera());
|
||||||
assertEquals(false, CameraManager.get().hasFrontAndBackCamera());
|
assertEquals(false, CameraManager.get().hasFrontAndBackCamera());
|
||||||
|
boolean threw = false;
|
||||||
try {
|
try {
|
||||||
CameraManager.get().selectCamera(CameraInfo.CAMERA_FACING_BACK);
|
CameraManager.get().selectCamera(CameraInfo.CAMERA_FACING_BACK);
|
||||||
fail("selectCamera should have thrown");
|
|
||||||
} catch (AssertionError e) {
|
} catch (AssertionError e) {
|
||||||
|
threw = true;
|
||||||
|
}
|
||||||
|
if (!threw) {
|
||||||
|
fail("selectCamera should have thrown");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user