From 7514c9e7b7e7342483d76e0d6e1fed392c025f25 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Sat, 15 Oct 2022 21:33:29 -0700 Subject: 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: Ibffb78353bb2ffc669422d6ac58f3a6a34b5ad43 --- .../loganalysis/item/DvmLockSampleItem.java | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/com/android/loganalysis/item/DvmLockSampleItem.java b/src/com/android/loganalysis/item/DvmLockSampleItem.java index 01372a4..10edebc 100644 --- a/src/com/android/loganalysis/item/DvmLockSampleItem.java +++ b/src/com/android/loganalysis/item/DvmLockSampleItem.java @@ -17,7 +17,6 @@ package com.android.loganalysis.item; import java.util.Arrays; -import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -43,17 +42,16 @@ public class DvmLockSampleItem extends GenericItem { OWNER_ACQUIRE_SOURCE_LINE, SAMPLE_PERCENTAGE)); @SuppressWarnings("serial") - private static final Map> TYPES = new HashMap>() {{ - put(PROCESS_NAME, String.class); - put(SENSITIVITY_FLAG, Boolean.class); - put(WAITING_THREAD_NAME, String.class); - put(WAIT_TIME, Integer.class); - put(WAITING_SOURCE_FILE, String.class); - put(WAITING_SOURCE_LINE, Integer.class); - put(OWNER_FILE_NAME, String.class); - put(OWNER_ACQUIRE_SOURCE_LINE, Integer.class); - put(SAMPLE_PERCENTAGE, Integer.class); - }}; + private static final Map> TYPES = Map.of( + PROCESS_NAME, String.class, + SENSITIVITY_FLAG, Boolean.class, + WAITING_THREAD_NAME, String.class, + WAIT_TIME, Integer.class, + WAITING_SOURCE_FILE, String.class, + WAITING_SOURCE_LINE, Integer.class, + OWNER_FILE_NAME, String.class, + OWNER_ACQUIRE_SOURCE_LINE, Integer.class, + SAMPLE_PERCENTAGE, Integer.class); public DvmLockSampleItem() { super(ATTRIBUTES); -- cgit v1.2.3