Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update MethodInvocationLocator.java
fix the comment
  • Loading branch information
testforstephen authored Jan 30, 2024
commit efb32a645d282f878f3a7d4055f88c9f59c3d2e6
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ public boolean visit(MethodDeclaration node) {

@Override
public boolean visit(TypeDeclaration node) {
// when root type declaration doesn't ends with a empty line, the end position
// for the root type returned from getLineNumber becomes -1. Therefore the
// shouldVisitNode fails, so the extra check unit.getRoot() == node.getRoot() is
// added.
return unit.getRoot() == node.getRoot() || shouldVisitNode(node);
return shouldVisitNode(node);
}

@Override
Expand Down Expand Up @@ -221,7 +217,7 @@ public boolean visit(ClassInstanceCreation node) {

private boolean shouldVisitNode(ASTNode node) {
int start = unit.getLineNumber(node.getStartPosition());
int end = unit.getLineNumber(node.getStartPosition() + node.getLength());
int end = unit.getLineNumber(node.getStartPosition() + node.getLength() - 1);

if (line >= start && line <= end) {
return true;
Expand Down