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: I6298ddf7c04c13cbc238c100a25118b5fc571248
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 97676fc..b4984ec 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -21,6 +21,8 @@
import static com.android.internal.telephony.d2d.Communicator.MESSAGE_DEVICE_BATTERY_STATE;
import static com.android.internal.telephony.d2d.Communicator.MESSAGE_DEVICE_NETWORK_COVERAGE;
+import static java.util.Map.entry;
+
import android.Manifest;
import android.content.Context;
import android.net.Uri;
@@ -61,7 +63,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -198,33 +199,32 @@
// For instance: "xxxx_string", "xxxx_string_array", etc.
// The carrier config keys in this map does not follow this convention. It is therefore not
// possible to infer the type for these keys by looking at the string.
- private static final Map<String, CcType> CC_TYPE_MAP = new HashMap<String, CcType>() {{
- put(CarrierConfigManager.Gps.KEY_A_GLONASS_POS_PROTOCOL_SELECT_STRING, CcType.STRING);
- put(CarrierConfigManager.Gps.KEY_ES_EXTENSION_SEC_STRING, CcType.STRING);
- put(CarrierConfigManager.Gps.KEY_GPS_LOCK_STRING, CcType.STRING);
- put(CarrierConfigManager.Gps.KEY_LPP_PROFILE_STRING, CcType.STRING);
- put(CarrierConfigManager.Gps.KEY_NFW_PROXY_APPS_STRING, CcType.STRING);
- put(CarrierConfigManager.Gps.KEY_SUPL_ES_STRING, CcType.STRING);
- put(CarrierConfigManager.Gps.KEY_SUPL_HOST_STRING, CcType.STRING);
- put(CarrierConfigManager.Gps.KEY_SUPL_MODE_STRING, CcType.STRING);
- put(CarrierConfigManager.Gps.KEY_SUPL_PORT_STRING, CcType.STRING);
- put(CarrierConfigManager.Gps.KEY_SUPL_VER_STRING, CcType.STRING);
- put(CarrierConfigManager.Gps.KEY_USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_STRING,
- CcType.STRING);
- put(CarrierConfigManager.KEY_CARRIER_APP_NO_WAKE_SIGNAL_CONFIG_STRING_ARRAY,
- CcType.STRING_ARRAY);
- put(CarrierConfigManager.KEY_CARRIER_APP_WAKE_SIGNAL_CONFIG_STRING_ARRAY,
- CcType.STRING_ARRAY);
- put(CarrierConfigManager.KEY_CARRIER_CALL_SCREENING_APP_STRING, CcType.STRING);
- put(CarrierConfigManager.KEY_MMS_EMAIL_GATEWAY_NUMBER_STRING, CcType.STRING);
- put(CarrierConfigManager.KEY_MMS_HTTP_PARAMS_STRING, CcType.STRING);
- put(CarrierConfigManager.KEY_MMS_NAI_SUFFIX_STRING, CcType.STRING);
- put(CarrierConfigManager.KEY_MMS_UA_PROF_TAG_NAME_STRING, CcType.STRING);
- put(CarrierConfigManager.KEY_MMS_UA_PROF_URL_STRING, CcType.STRING);
- put(CarrierConfigManager.KEY_MMS_USER_AGENT_STRING, CcType.STRING);
- put(CarrierConfigManager.KEY_RATCHET_RAT_FAMILIES, CcType.STRING_ARRAY);
- }
- };
+ private static final Map<String, CcType> CC_TYPE_MAP = Map.ofEntries(
+ entry(CarrierConfigManager.Gps.KEY_A_GLONASS_POS_PROTOCOL_SELECT_STRING,
+ CcType.STRING),
+ entry(CarrierConfigManager.Gps.KEY_ES_EXTENSION_SEC_STRING, CcType.STRING),
+ entry(CarrierConfigManager.Gps.KEY_GPS_LOCK_STRING, CcType.STRING),
+ entry(CarrierConfigManager.Gps.KEY_LPP_PROFILE_STRING, CcType.STRING),
+ entry(CarrierConfigManager.Gps.KEY_NFW_PROXY_APPS_STRING, CcType.STRING),
+ entry(CarrierConfigManager.Gps.KEY_SUPL_ES_STRING, CcType.STRING),
+ entry(CarrierConfigManager.Gps.KEY_SUPL_HOST_STRING, CcType.STRING),
+ entry(CarrierConfigManager.Gps.KEY_SUPL_MODE_STRING, CcType.STRING),
+ entry(CarrierConfigManager.Gps.KEY_SUPL_PORT_STRING, CcType.STRING),
+ entry(CarrierConfigManager.Gps.KEY_SUPL_VER_STRING, CcType.STRING),
+ entry(CarrierConfigManager.Gps.KEY_USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_STRING,
+ CcType.STRING),
+ entry(CarrierConfigManager.KEY_CARRIER_APP_NO_WAKE_SIGNAL_CONFIG_STRING_ARRAY,
+ CcType.STRING_ARRAY),
+ entry(CarrierConfigManager.KEY_CARRIER_APP_WAKE_SIGNAL_CONFIG_STRING_ARRAY,
+ CcType.STRING_ARRAY),
+ entry(CarrierConfigManager.KEY_CARRIER_CALL_SCREENING_APP_STRING, CcType.STRING),
+ entry(CarrierConfigManager.KEY_MMS_EMAIL_GATEWAY_NUMBER_STRING, CcType.STRING),
+ entry(CarrierConfigManager.KEY_MMS_HTTP_PARAMS_STRING, CcType.STRING),
+ entry(CarrierConfigManager.KEY_MMS_NAI_SUFFIX_STRING, CcType.STRING),
+ entry(CarrierConfigManager.KEY_MMS_UA_PROF_TAG_NAME_STRING, CcType.STRING),
+ entry(CarrierConfigManager.KEY_MMS_UA_PROF_URL_STRING, CcType.STRING),
+ entry(CarrierConfigManager.KEY_MMS_USER_AGENT_STRING, CcType.STRING),
+ entry(CarrierConfigManager.KEY_RATCHET_RAT_FAMILIES, CcType.STRING_ARRAY));
/**
* Map from a shorthand string to the feature tags required in registration required in order