Skip to content

Commit

Permalink
Suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 authored and rickie committed Apr 11, 2022
1 parent 4f00821 commit de984da
Showing 1 changed file with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,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",
Expand Down Expand Up @@ -123,26 +124,6 @@ public final class StaticImportCheck extends BugChecker implements MemberSelectT
.put("com.google.common.collect.ImmutableTable", "toImmutableTable")
.put("com.google.common.collect.Sets", "toImmutableEnumSet")
.put("com.google.common.base.Functions", "identity")
.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("org.junit.jupiter.params.provider.Arguments", "arguments")
Expand All @@ -163,10 +144,25 @@ public final class StaticImportCheck extends BugChecker implements MemberSelectT
* <p>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<String, String> STATIC_IMPORT_EXEMPTED_MEMBERS =
ImmutableSetMultimap.<String, String>builder()
.put("com.mongodb.client.model.Filters", "empty")
.putAll(
"java.util.Collections",
"addAll",
"copy",
"fill",
"list",
"max",
"min",
"nCopies",
"rotate",
"sort",
"swap")
.putAll("java.util.regex.Pattern", "compile", "matches", "quote")
.put("org.springframework.http.MediaType", "ALL")
.build();
Expand Down

0 comments on commit de984da

Please sign in to comment.