Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate TypesWithUndefinedEquality#SPARSE_ARRAY entry #3110

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -24,25 +24,21 @@

/** Enumerates types which have poorly-defined behaviour for equals. */
public enum TypesWithUndefinedEquality {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following (somewhat hacky, likely Linux-only) script verifies that this PR does not introduce additional changes:

#!/usr/bin/env bash

set -e -u -o pipefail

normalize() {
  local rev="${1}"

  git show "${rev}:core/src/main/java/com/google/errorprone/bugpatterns/TypesWithUndefinedEquality.java" \
    | grep -Pzo '(?<=LONG_SPARSE_ARRAY\()[^)]+' | grep -Pao '[\w.]+' | sort -u
  git show "${rev}:core/src/main/java/com/google/errorprone/bugpatterns/TypesWithUndefinedEquality.java" \
    | grep -Pzo '(?<=SPARSE_ARRAY\()[^)]+' | grep -Pao '[\w.]+' | sort -u
  git show "${rev}:core/src/main/java/com/google/errorprone/bugpatterns/TypesWithUndefinedEquality.java" \
    | grep -Po '[A-Z_]+\(' | sort -u
}

diff -u <(normalize master) <(normalize HEAD)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add java.lang.Object to the TypesWithUndefinedEquality enum?

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");

private final String shortName;
private final ImmutableSet<String> typeNames;
Expand Down