Skip to content

Commit

Permalink
Self apply
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien Diederichs committed Mar 7, 2023
1 parent a70a5f9 commit d97e62b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.util.Objects.requireNonNull;

import com.google.common.collect.ImmutableList;
import com.google.errorprone.VisitorState;
Expand All @@ -27,7 +28,7 @@ private MoreASTHelpers() {}
*/
public static ImmutableList<MethodTree> findMethods(CharSequence methodName, VisitorState state) {
ClassTree clazz = state.findEnclosing(ClassTree.class);
checkArgument(clazz != null, "Visited node is not enclosed by a class");
requireNonNull(clazz, "Visited node is not enclosed by a class");
return clazz.getMembers().stream()
.filter(MethodTree.class::isInstance)
.map(MethodTree.class::cast)
Expand Down

0 comments on commit d97e62b

Please sign in to comment.