Skip to content

Commit

Permalink
s/isUsedReflectively/shouldKeep/g
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 418767265
  • Loading branch information
cushon authored and Error Prone Team committed Dec 29, 2021
1 parent 8dc4654 commit bf6c145
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static com.google.errorprone.util.ASTHelpers.getAnnotation;
import static com.google.errorprone.util.ASTHelpers.getStartPosition;
import static com.google.errorprone.util.ASTHelpers.getSymbol;
import static com.google.errorprone.util.ASTHelpers.isUsedReflectively;
import static com.google.errorprone.util.ASTHelpers.shouldKeep;

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
Expand Down Expand Up @@ -87,7 +87,7 @@ public Void visitVariable(VariableTree variableTree, Void unused) {
&& symbol.getKind() == ElementKind.FIELD
&& symbol.isPrivate()
&& canBeLocal(variableTree)
&& !isUsedReflectively(variableTree)) {
&& !shouldKeep(variableTree)) {
potentialFields.put(symbol, getCurrentPath());
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import static com.google.errorprone.matchers.Matchers.kindIs;
import static com.google.errorprone.util.ASTHelpers.getReceiver;
import static com.google.errorprone.util.ASTHelpers.getSymbol;
import static com.google.errorprone.util.ASTHelpers.isUsedReflectively;
import static com.google.errorprone.util.ASTHelpers.shouldKeep;

import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -117,7 +117,7 @@ public final class ImmutableMemberCollection extends BugChecker implements Class
// TODO(ashishkedia) : Share this with ImmutableSetForContains.
private static final Matcher<Tree> EXCLUSIONS =
anyOf(
(t, s) -> isUsedReflectively(t),
(t, s) -> shouldKeep(t),
hasAnnotationWithSimpleName("Bind"),
hasAnnotationWithSimpleName("Inject"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import static com.google.errorprone.matchers.Matchers.staticMethod;
import static com.google.errorprone.util.ASTHelpers.getReceiver;
import static com.google.errorprone.util.ASTHelpers.getSymbol;
import static com.google.errorprone.util.ASTHelpers.isUsedReflectively;
import static com.google.errorprone.util.ASTHelpers.shouldKeep;
import static com.google.errorprone.util.ASTHelpers.streamReceivers;
import static java.util.stream.Collectors.toMap;

Expand Down Expand Up @@ -82,7 +82,7 @@ public final class ImmutableSetForContains extends BugChecker implements ClassTr

private static final Matcher<Tree> EXCLUSIONS =
anyOf(
(t, s) -> isUsedReflectively(t),
(t, s) -> shouldKeep(t),
hasAnnotationWithSimpleName("Bind"),
hasAnnotationWithSimpleName("Inject"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import static com.google.errorprone.util.ASTHelpers.getSymbol;
import static com.google.errorprone.util.ASTHelpers.getType;
import static com.google.errorprone.util.ASTHelpers.isSubtype;
import static com.google.errorprone.util.ASTHelpers.isUsedReflectively;
import static com.google.errorprone.util.ASTHelpers.shouldKeep;
import static com.google.errorprone.util.MoreAnnotations.asStrings;
import static com.google.errorprone.util.MoreAnnotations.getAnnotationValue;

Expand Down Expand Up @@ -190,7 +190,7 @@ private boolean isMethodSymbolEligibleForChecking(MethodTree tree) {
if (exemptedByAnnotation(tree.getModifiers().getAnnotations())) {
return false;
}
if (isUsedReflectively(tree)) {
if (shouldKeep(tree)) {
return false;
}
// Skip constructors and special methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static com.google.errorprone.matchers.Description.NO_MATCH;
import static com.google.errorprone.util.ASTHelpers.enclosingClass;
import static com.google.errorprone.util.ASTHelpers.getSymbol;
import static com.google.errorprone.util.ASTHelpers.isUsedReflectively;
import static com.google.errorprone.util.ASTHelpers.shouldKeep;

import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
Expand Down Expand Up @@ -88,7 +88,7 @@ private boolean ignoreUnusedClass(ClassTree classTree) {
if (isSuppressed(classTree)) {
return true;
}
if (isUsedReflectively(classTree)) {
if (shouldKeep(classTree)) {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static com.google.errorprone.matchers.InjectMatchers.hasProvidesAnnotation;
import static com.google.errorprone.util.ASTHelpers.hasAnnotation;
import static com.google.errorprone.util.ASTHelpers.hasDirectAnnotationWithSimpleName;
import static com.google.errorprone.util.ASTHelpers.isUsedReflectively;
import static com.google.errorprone.util.ASTHelpers.shouldKeep;

import com.google.errorprone.BugPattern;
import com.google.errorprone.ErrorProneFlags;
Expand Down Expand Up @@ -72,7 +72,7 @@ public Description matchMethod(MethodTree tree, VisitorState state) {
}

// don't suggest on APIs that get called reflectively
if (isUsedReflectively(tree) || hasProvidesAnnotation().matches(tree, state)) {
if (shouldKeep(tree) || hasProvidesAnnotation().matches(tree, state)) {
return Description.NO_MATCH;
}

Expand Down

0 comments on commit bf6c145

Please sign in to comment.