Conversation
|
@matthiasblaesing, thanks for trying. I guess what you are saying is that:
That way, anyone could go to the settings and specify the lambda index. (+the UI maybe could be slightly better e.g. a combobox showing "Everywhere"/"Main Line Only"/"Lambda 1"/"Lambda 2"/...). Note the breakpoint properties already allow to set the lambda index in this prototype. I can't say I disagree with that. The automagically setup breakpoints where a bit preparation for a (much) better UI (similar to what VS Code is doing), but I don't have the UI, and I don't know if I ever will. So maybe this is simply too complex. And it can be resurrected if we have the better UI. |
|
Yes you understood my point correctly. I'm not opposed to multiple breakpoints in general, but from a UI/UX perspective I think making the options available in the line break point might be more realistic as the UI impact would be smaller. I think it would be good if the "lamdba" "condition" would allow to select multiple lambdas, for this example (in reality I expect lambdas with more interesting content in it 😄): public class Test3 {
public static void main(String[] args) {
List.of("a", "b", "c")
.stream()
.map(s -> s.trim()).filter(s -> !s.isEmpty()).forEach(s -> System.err.println(s));
}
}
it might make sense to break on the first and last lamdba. That way you can observe what goes into the stream pipeline and what reaches the end. |



This is something I was looking at long time ago, but was not very happy about the UI. So I was trying to improve the UI, but I didn't make progress on that, and this got stashed. So, now I decided to try to recover this, even with the not-so-nice UI.
I would consider this patch to be a fairly advanced prototype.
Currently, having code like:
putting a breakpoint at the line with
mapwill mean the debugger will stop at the line whenmapis called, and then each time any of the lambdas is called. This is rarely what one wants. It would be better to be able to say that I want the debugger to stop at e.g. the first lambda.This is what this PR is trying to do. There's an ability to specify the breakpoint applies to n-th lambda on the given line. Special values are
-1, which means to stop at the line outside of any lambda, andInteger.MIN_VALUE, which means stop each time this line is reached, regardless of any lambdas. This is the way it works on the backend.Inside the NetBeans UI, it works like this:
The ability is also used in the DAP Java server, for use in DAP clients (e.g. in VS Code). The UI in VS Code is better, but also has some sharp edges.
Inside NB, it can look like this:


^Add meaningful description above
Click to collapse/expand PR instructions
By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
Please make sure (eg.
git log) that all commits have a valid name and email address for you in the Author field.If you're a first time contributor, see the Contributing guidelines for more information.
If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.
PR approval and merge checklist:
If this PR targets the delivery branch: don't merge. (full wiki article)