Skip to content

Commit

Permalink
Shorten call to get enclosing method declaration (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
evie-lau committed Sep 24, 2024
1 parent 7acc0a5 commit 1931a6f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public TreeVisitor<?, ExecutionContext> getVisitor() {
public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, ExecutionContext ctx) {
if (invalidateMethodMatcher.matches(method)) {
// Get index of param for HttpServletRequest, from the encapsulating method declaration TODO: would like to make this cleaner...
J.MethodDeclaration parentMethod = getCursor().dropParentUntil(parent -> parent instanceof J.MethodDeclaration).getValue();
J.MethodDeclaration parentMethod = getCursor().firstEnclosing(J.MethodDeclaration.class);
Integer servletReqParamIndex = getServletRequestIndex(parentMethod);

// Failed to find HttpServletRequest from parent MethodDeclaration
Expand Down

0 comments on commit 1931a6f

Please sign in to comment.