From f35b9df4107b77121e93c423b724341dd37aec55 Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Mon, 18 Apr 2022 14:42:00 -0700 Subject: [PATCH] Remove duplicate `TypesWithUndefinedEquality#SPARSE_ARRAY` entry Type `androidx.collection.SparseArrayCompat` was listed twice. While there, sort the enum elements and type names. Fixes #3110 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/error-prone/pull/3110 from PicnicSupermarket:rossendrijver/object_undefined_equality c6979849a7c92ec10f019cf3358d06ff5ccc122c PiperOrigin-RevId: 442635974 --- .../TypesWithUndefinedEquality.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/TypesWithUndefinedEquality.java b/core/src/main/java/com/google/errorprone/bugpatterns/TypesWithUndefinedEquality.java index 6d9eb9d6acb..1785dbb849e 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/TypesWithUndefinedEquality.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/TypesWithUndefinedEquality.java @@ -24,25 +24,23 @@ /** Enumerates types which have poorly-defined behaviour for equals. */ public enum TypesWithUndefinedEquality { + // keep-sorted start + CHAR_SEQUENCE("CharSequence", "java.lang.CharSequence"), + COLLECTION("Collection", "java.util.Collection"), + DATE("Date", "java.util.Date"), + IMMUTABLE_COLLECTION("ImmutableCollection", "com.google.common.collect.ImmutableCollection"), + IMMUTABLE_MULTIMAP("ImmutableMultimap", "com.google.common.collect.ImmutableMultimap"), + ITERABLE("Iterable", "com.google.common.collect.FluentIterable", "java.lang.Iterable"), LONG_SPARSE_ARRAY( "LongSparseArray", - "android.util.LongSparseArray", "android.support.v4.util.LongSparseArrayCompat", - "androidx.core.util.LongSparseArrayCompat", - "androidx.collection.LongSparseArrayCompat"), - SPARSE_ARRAY( - "SparseArray", - "android.util.SparseArray", - "androidx.collection.SparseArrayCompat", - "androidx.collection.SparseArrayCompat"), + "android.util.LongSparseArray", + "androidx.collection.LongSparseArrayCompat", + "androidx.core.util.LongSparseArrayCompat"), MULTIMAP("Multimap", "com.google.common.collect.Multimap"), - IMMUTABLE_MULTIMAP("ImmutableMultimap", "com.google.common.collect.ImmutableMultimap"), - CHAR_SEQUENCE("CharSequence", "java.lang.CharSequence"), - ITERABLE("Iterable", "java.lang.Iterable", "com.google.common.collect.FluentIterable"), - COLLECTION("Collection", "java.util.Collection"), - IMMUTABLE_COLLECTION("ImmutableCollection", "com.google.common.collect.ImmutableCollection"), QUEUE("Queue", "java.util.Queue"), - DATE("Date", "java.util.Date"); + SPARSE_ARRAY("SparseArray", "android.util.SparseArray", "androidx.collection.SparseArrayCompat"); + // keep-sorted end private final String shortName; private final ImmutableSet typeNames;