| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Jinbo Wang (@testforstephen) Let me know if you see a better condition to use in this scenario. |
Sorry, something went wrong.
I don't get how this fix works. When I tested the snippet you posted in the issue #519, the stepInTargets DAP request returns no results for step-into target operation. Shouldn't we fix MethodInvocationLocator first? |
Sorry, something went wrong.
Let me check on this, I see the same, probably I missed to commit something |
Sorry, something went wrong.
Try now Jinbo Wang (@testforstephen) |
Sorry, something went wrong.
| @Override | ||
| public boolean visit(TypeDeclaration node) { | ||
| return shouldVisitNode(node); | ||
| return unit.getRoot() == node.getRoot() || shouldVisitNode(node); |
There was a problem hiding this comment.
The condition check unit.getRoot() == node.getRoot() is not needed. I tested #519 snippet without this check, it worked.
Sorry, something went wrong.
There was a problem hiding this comment.
For some reason for me it start to fail before in shouldVisitNode the end becomes -1 since the on JDT side the start + length of the node becomes equal to the end of the compilation unit's last position. I will try again without this check.
Sorry, something went wrong.
There was a problem hiding this comment.
OK now I found the reason, if you don't have a empty line at the end of the class, that after the last class definitions' brace, then the end getLineNumber becomes -1
Sorry, something went wrong.
There was a problem hiding this comment.
I can reproduce it, but i would prefer to modify the implementation shouldVisitNode() to fix the problem.
Since the offset range of the ast node is [node.getStartPosition, node.getStartPosition() + node.getLength() - 1], the ending line should be got from unit.getLineNumber(node.getStartPosition() + node.getLength() - 1).
The fix could be as follow:
private boolean shouldVisitNode(ASTNode node) {
int start = unit.getLineNumber(node.getStartPosition());
int end = unit.getLineNumber(node.getStartPosition() + node.getLength() - 1);
if (line >= start && line <= end) {
return true;
}
return false;
}
Sorry, something went wrong.
| } | ||
|
|
||
| private boolean isSameLocation(Location original, Location current) { | ||
| private boolean isSameLocation(Location original, Location current, MethodInvocation targetStepIn) { |
There was a problem hiding this comment.
Look at the caller, actually we took the first parameter as current, the second one as original. So we should change the signature definition to private boolean isSameLocation(Location current, Location original, MethodInvocation targetStepIn).
Sorry, something went wrong.
| return originalMethod.equals(currentMethod) | ||
| && original.lineNumber() == current.lineNumber(); | ||
| && (original.lineNumber() == current.lineNumber() | ||
| || (targetStepIn != null && targetStepIn.lineStart > current.lineNumber())); |
There was a problem hiding this comment.
The last condition check should be (targetStepIn != null && targetStepIn.lineEnd >= current.lineNumber()), which supports multiline expression better.
Sorry, something went wrong.
|
I also found another corner case failure when steping target into List.of("1"). new ArrayList<>(List.of("1"))
.subList(0, 1)
.addAll(mergedData());It looks like the generic method signature (e.g. "(LE;)Ljava/util/List;") we parsed from JDT is slightly different with the one from the JDI (e.g. "(Ljava/lang/Object;)Ljava/util/List;"). We could fix it in another PR. |
Sorry, something went wrong.
| @Override | ||
| public boolean visit(TypeDeclaration node) { | ||
| return shouldVisitNode(node); | ||
| return unit.getRoot() == node.getRoot() || shouldVisitNode(node); |
There was a problem hiding this comment.
I can reproduce it, but i would prefer to modify the implementation shouldVisitNode() to fix the problem.
Since the offset range of the ast node is [node.getStartPosition, node.getStartPosition() + node.getLength() - 1], the ending line should be got from unit.getLineNumber(node.getStartPosition() + node.getLength() - 1).
The fix could be as follow:
private boolean shouldVisitNode(ASTNode node) {
int start = unit.getLineNumber(node.getStartPosition());
int end = unit.getLineNumber(node.getStartPosition() + node.getLength() - 1);
if (line >= start && line <= end) {
return true;
}
return false;
}
Sorry, something went wrong.
| return originalMethod.equals(currentMethod) | ||
| && original.lineNumber() == current.lineNumber(); | ||
| && (original.lineNumber() == current.lineNumber() | ||
| || (targetStepIn != null && targetStepIn.lineStart >= current.lineNumber())); |
There was a problem hiding this comment.
this doesn't work for multiline method invocation. We should use targetStepIn.lineEnd in the last check, e.g. targetStepIn.lineEnd >= current.lineNumber().
For the use case below, step-into target filterMe doesn't work, it stops at the line of "2", "3", .
new ArrayList<>(List.of("1"))
.subList(0, 1)
.addAll(filterMe("1",
"2", "3",
"4"));
Sorry, something went wrong.
fix the comment
fix the comment
There was a problem hiding this comment.
I have updated the PR to fix the comments. Now it's good to merge.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
The fix try to compare the current line number against the target MethodInvocation start line if the debugger lines doesn't match because the current frame is at a wrapped line even though we are executing the same expression.