diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImportCheck.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImportCheck.java index 20dc19b3c1f..9bc703eee4b 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImportCheck.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImportCheck.java @@ -76,6 +76,7 @@ public final class StaticImportCheck extends BugChecker implements MemberSelectT "com.mongodb.client.model.Sorts", "com.mongodb.client.model.Updates", "java.nio.charset.StandardCharsets", + "java.util.Collections", "java.util.Comparator", "java.util.Map.Entry", "java.util.regex.Pattern", @@ -125,26 +126,6 @@ public final class StaticImportCheck extends BugChecker implements MemberSelectT .put("com.google.common.collect.Sets", "toImmutableEnumSet") .put("com.google.common.base.Functions", "identity") .put("java.time.ZoneOffset", "UTC") - .putAll( - "java.util.Collections", - "disjoint", - "emptyList", - "emptyMap", - "emptySet", - "reverse", - "singleton", - "singletonList", - "singletonMap", - "synchronizedCollection", - "synchronizedList", - "synchronizedMap", - "synchronizedNavigableMap", - "synchronizedSet", - "unmodifiableCollection", - "unmodifiableList", - "unmodifiableMap", - "unmodifiableNavigableSet", - "unmodifiableSet") .put("java.util.function.Function", "identity") .put("java.util.function.Predicate", "not") .put("java.util.UUID", "randomUUID") @@ -166,10 +147,25 @@ public final class StaticImportCheck extends BugChecker implements MemberSelectT *
Identifiers listed by {@link #STATIC_IMPORT_EXEMPTED_IDENTIFIERS} should be omitted from
* this collection.
*/
+ // XXX: Perhaps the set of exempted `java.util.Collections` methods is too strict. For now any
+ // method name that could be considered "too vague" or could conceivably mean something else in a
+ // specific context is left out.
@VisibleForTesting
static final ImmutableSetMultimap