Skip to content

Commit 455fe70

Browse files
committed
Switch PriorityMapping's Map implementation to avoid reflection
EnumMap uses reflection under the hood. Switching to a HashMap removes the reflection call, so we don't need the Proguard rule keeping `values` after all.
1 parent d4c3429 commit 455fe70

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

transport/transport-api/proguard.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
-dontwarn com.google.auto.value.AutoValue
22
-dontwarn com.google.auto.value.AutoValue$Builder
3-
-keepclassmembers enum com.google.android.datatransport.Priority {
4-
*;
5-
}
3+

transport/transport-runtime/src/main/java/com/google/android/datatransport/runtime/util/PriorityMapping.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
import android.util.SparseArray;
1818
import androidx.annotation.NonNull;
1919
import com.google.android.datatransport.Priority;
20-
import java.util.EnumMap;
20+
import java.util.HashMap;
2121

2222
public final class PriorityMapping {
2323
private static SparseArray<Priority> PRIORITY_MAP = new SparseArray<>();
24-
private static EnumMap<Priority, Integer> PRIORITY_INT_MAP = new EnumMap<>(Priority.class);
24+
private static HashMap<Priority, Integer> PRIORITY_INT_MAP = new HashMap<>();
2525

2626
static {
2727
PRIORITY_INT_MAP.put(Priority.DEFAULT, 0);

0 commit comments

Comments
 (0)