Skip to content

Commit

Permalink
Suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 committed Apr 10, 2022
1 parent 4fc85cf commit 7748f2a
Showing 1 changed file with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,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.stream.Collectors",
Expand Down Expand Up @@ -119,26 +120,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 @@ -159,10 +140,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")
.put("org.springframework.http.MediaType", "ALL")
.build();

Expand Down

0 comments on commit 7748f2a

Please sign in to comment.