You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "lahodaj (via GitHub)" <gi...@apache.org> on 2026/03/18 16:33:32 UTC
[PR] Breakpoints for Java lambdas. [netbeans]
lahodaj opened a new pull request, #9285:
URL: https://github.com/apache/netbeans/pull/9285
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:
```
List.of("a", "b", "c")
.stream()
.map(s -> s).filter(s -> !s.isEmpty())
.forEach(s -> System.err.println(s));
}
```
putting a breakpoint at the line with `map` will mean the debugger will stop at the line when `map` is 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, and `Integer.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:
- when a line breakpoint is added on a line with lambdas, it is considered to be on the line only, and there's a disable lambda breakpoint added for each lambda automatically. These can then be enabled/disabled independently.
- when the line breakpoint is removed, all the lambda breakpoints are removed as well.
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:
<img width="683" height="249" alt="lambda-breakpoints-editor" src="https://github.com/user-attachments/assets/22850b02-5b07-4aa0-930f-7f6e367a45e4" />
<img width="1146" height="328" alt="lambda-breakpoints-view" src="https://github.com/user-attachments/assets/2773fc6e-4a4c-4f54-9893-06ddbd50b754" />
---
**^Add meaningful description above**
<details open>
<summary>Click to collapse/expand PR instructions</summary>
By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
- are all your own work, and you have the right to contribute them.
- are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).
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:
1. [ ] Was this PR [correctly labeled](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=240884239#PRsandYouAreviewerGuide-PRtriggeredCIJobs(conditionalCIpipeline)), did the right tests run? When did they run?
2. [ ] Is this PR [squashed](https://cwiki.apache.org/confluence/display/NETBEANS/git%3A+squash+and+merge)?
3. [ ] Are author name / email address correct? Are [co-authors](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line) correctly listed? Do the commit messages need updates?
3. [ ] Does the PR title and description still fit after the Nth iteration? Is the description sufficient to appear in the release notes?
If this PR targets the delivery branch: [don't merge](https://cwiki.apache.org/confluence/display/NETBEANS/Pull+requests+for+delivery). ([full wiki article](https://cwiki.apache.org/confluence/display/NETBEANS/PRs+and+You+-+A+reviewer+Guide))
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on code in PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#discussion_r3323163894
##########
java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/breakpoints/LineBreakpointImpl.java:
##########
@@ -697,6 +709,39 @@ private static String normalize(String path) {
return path;
}
+ private List<Location> filterLocationsByLambdaIndex(List<Location> locations, int[] lambdaIndex) {
+ if (lambdaIndex.length == 0) {
+ return locations;
+ } else {
+ Map<String, List<Location>> lambda2Locations = new LinkedHashMap<>();
+ List<Location> outsideOfLambda = new ArrayList<>();
+
+ for (Location l : locations) {
+ if (l.method().name().startsWith("lambda$")) {
Review Comment:
Right, this is a heuristics. I've added comments to that effect. Moreover, @dbalek found out the heuristics is not working for classfiles generated by ecj (the order of methods differs, so it there are multiple lambdas on the same line, the counting goes from the back, not from front), I added more heuristics to guess this state.
Still, just a heuristics, but (to my knowledge), there's simply not enough information in the classfile to avoid guessing a bit.
Thanks for the comment in any case!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on code in PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#discussion_r3312802636
##########
java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/LineBreakpoint.java:
##########
@@ -182,6 +189,29 @@ public void setLineNumber (int ln) {
Integer.valueOf(ln)
);
}
+
+ public int[] getLambdaIndex() {
Review Comment:
Would it make sense to use correct plural form? I.e. `getLambdaIndexes`?
##########
java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/breakpoints/BreakpointsReader.java:
##########
@@ -370,6 +372,10 @@ public void write (Object object, Properties properties) {
LineBreakpoint.PROP_LINE_NUMBER,
lb.getLineNumber ()
);
+ properties.setArray(
+ LineBreakpoint.PROP_LAMBDA_INDEX,
+ Arrays.stream(lb.getLambdaIndex()).mapToObj(v -> v).toArray()
Review Comment:
I assume this is done to get the raw ints boxed?
##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle.properties:
##########
@@ -229,6 +229,11 @@
ACSD_TF_Line_Breakpoint_Line_Number=Line number
TTT_TF_Line_Breakpoint_Line_Number=Line number to stop at
+ L_Line_Breakpoint_Lambda_Index=Lambda &Index\:
+ ACSD_L_Line_Breakpoint_Lambda_Index=Lambda Index
+ ACSD_TF_Line_Breakpoint_Lambda_Index=Lambda Index
+ TTT_TF_Line_Breakpoint_Lambda_Index=Lambda Index to stop at
Review Comment:
I suggest to add a minimal explanation/usage instruction:
```suggestion
L_Line_Breakpoint_Lambda_Index=Lambda &Indexes\:
ACSD_L_Line_Breakpoint_Lambda_Index=Lambda Indexes
ACSD_TF_Line_Breakpoint_Lambda_Index=Lambda Indexes
TTT_TF_Line_Breakpoint_Lambda_Index=Comma seperated lambda indexes to stop at\nempty: all locations\n-1: stop outside of lambda\n0-based index: break in that lambda expression
```
##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/LineBreakpointPanel.java:
##########
@@ -248,6 +254,29 @@ private void initComponents() {
tfLineNumber.getAccessibleContext().setAccessibleName("Line number");
tfLineNumber.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_TF_Line_Breakpoint_Line_Number")); // NOI18N
+ jLabel4.setLabelFor(tfLambdaIndex);
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel4, bundle.getString("L_Line_Breakpoint_Lambda_Index")); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 4;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
+ pSettings.add(jLabel4, gridBagConstraints);
+ jLabel4.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_L_Line_Breakpoint_Lambda_Index")); // NOI18N
+
+ tfLambdaIndex.setToolTipText(bundle.getString("TTT_TF_Line_Breakpoint_Lambda_Index")); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 4;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
+ pSettings.add(tfLambdaIndex, gridBagConstraints);
+ tfLambdaIndex.getAccessibleContext().setAccessibleName("Lambda index");
Review Comment:
Should this be localized?
##########
java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/breakpoints/LineBreakpointImpl.java:
##########
@@ -697,6 +709,39 @@ private static String normalize(String path) {
return path;
}
+ private List<Location> filterLocationsByLambdaIndex(List<Location> locations, int[] lambdaIndex) {
+ if (lambdaIndex.length == 0) {
+ return locations;
+ } else {
+ Map<String, List<Location>> lambda2Locations = new LinkedHashMap<>();
+ List<Location> outsideOfLambda = new ArrayList<>();
+
+ for (Location l : locations) {
+ if (l.method().name().startsWith("lambda$")) {
Review Comment:
Should here be a comment, that this relies on the lambda naming convention and might break? I only suspect, that this detail is not described in the JLS?
##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/LineBreakpointPanel.java:
##########
@@ -319,6 +350,12 @@ public boolean ok () {
logger.fine(" => URL = '"+url+"'");
breakpoint.setURL((url != null) ? url.toString() : path);
breakpoint.setLineNumber(Integer.parseInt(tfLineNumber.getText().trim()));
+ String lambdaIndexText = tfLambdaIndex.getText().trim();
+ if (lambdaIndexText.isEmpty()) {
+ breakpoint.setLambdaIndex(new int[0]);
+ } else {
+ breakpoint.setLambdaIndex(Arrays.stream(lambdaIndexText.split(", *")).mapToInt(v -> Integer.parseInt(v)).toArray());
Review Comment:
I think we should be prepared for bogus values, so I would suggest this:
```suggestion
int[] indexes = Arrays.stream(lambdaIndexText.split(", *"))
.map(indexString -> {
try {
return Integer.parseInt(indexString);
} catch (NumberFormatException ex) {
// Ignore invalid values
return null;
}
})
.filter(value -> value != null)
.mapToInt(i -> i)
.toArray();
breakpoint.setLambdaIndex(indexes);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on code in PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#discussion_r3323111766
##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/LineBreakpointPanel.java:
##########
@@ -248,6 +254,29 @@ private void initComponents() {
tfLineNumber.getAccessibleContext().setAccessibleName("Line number");
tfLineNumber.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_TF_Line_Breakpoint_Line_Number")); // NOI18N
+ jLabel4.setLabelFor(tfLambdaIndex);
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel4, bundle.getString("L_Line_Breakpoint_Lambda_Index")); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 4;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
+ pSettings.add(jLabel4, gridBagConstraints);
+ jLabel4.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_L_Line_Breakpoint_Lambda_Index")); // NOI18N
+
+ tfLambdaIndex.setToolTipText(bundle.getString("TTT_TF_Line_Breakpoint_Lambda_Index")); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 4;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
+ pSettings.add(tfLambdaIndex, gridBagConstraints);
+ tfLambdaIndex.getAccessibleContext().setAccessibleName("Lambda index");
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#issuecomment-4112017575
@matthiasblaesing, thanks for trying. I guess what you are saying is that:
- by default, the breakpoints should stop everywhere (i.e. the lambda index should be `Integer.MIN_VALUE` in the current internal meaning)
- the automatically added lambda breakpoints should be dropped.
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "Chris2011 (via GitHub)" <gi...@apache.org>.
Chris2011 commented on PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#issuecomment-4653266154
Unfortunately I saw this to late but maybe for UI we can look into the Chrome devtools how this was implemented in JS lambdas. Just the UI, not the code. To get an idea. @lahodaj thx for this feature :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#issuecomment-4111931054
- I think the "don't break in lambda by default" is not a good approach. My reasoning: The feature is hard to discover, so without knowledge of this PR I would come to the conclusion "NetBeans can't break in lambdas". Breaking on the line outside the lambda (i.e. before execution of the chain) is IMHO the least interesting breakpoint as the intermediate steps are what I would be interested in.
- The don't break by default setting is also harmful for people using multiple lines to make the lambda readable. Today they can set a break point and it will work as expected. With this the breakpoint you can set without hassle is basicly useless. I mean this formatting:
<img width="513" height="222" alt="grafik" src="https://github.com/user-attachments/assets/2b9835e0-96be-4dac-853c-02a373fb475c" />
- The lambda breakpoint enablement is unstable. Consider this starting point (nothing is running right now):
<img width="1233" height="313" alt="grafik" src="https://github.com/user-attachments/assets/780a4be3-9486-41f8-a30f-feb291b4bd35" />
When I invoke "Debug file", the activation of the lamdba breakpoint is lost (see lambda index 2):
<img width="1246" height="346" alt="grafik" src="https://github.com/user-attachments/assets/a0e5acca-5513-4c5f-9429-4c7fc748cf1a" />
What I wonder in summary is: Isn't this "just" another "condition"? The ability to break in lambda is already there, at least I can set a break point for the example in the row with multiple lambdas and get multiple stops, that match what I would expect for the lambda execution. What is missing from that POV is "just" a filter to select the right lambda(s).
The drawback I see is, that the multiple breakpoints would allow more flexibility (independent counts for conditionally enabled breakpoints, conditions, log output).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#issuecomment-4692384217
FWIW, I think how the "ideal" UI should look like is obvious (i.e. basically the same as VS Code has, there may be some more bells and whistles, but roughly around that lines). But, so far, I don't know how to implement that in the real NetBeans Swing UI. I can paint a (virtual) icon anywhere, but I don't know how to distinguish a click on that virtual icon from a click inside the surrounding text.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj merged PR #9285:
URL: https://github.com/apache/netbeans/pull/9285
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#issuecomment-4118756709
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 :smile:):
```java
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 an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on code in PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#discussion_r3323109920
##########
java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/LineBreakpoint.java:
##########
@@ -182,6 +189,29 @@ public void setLineNumber (int ln) {
Integer.valueOf(ln)
);
}
+
+ public int[] getLambdaIndex() {
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on code in PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#discussion_r3323116814
##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/LineBreakpointPanel.java:
##########
@@ -319,6 +350,12 @@ public boolean ok () {
logger.fine(" => URL = '"+url+"'");
breakpoint.setURL((url != null) ? url.toString() : path);
breakpoint.setLineNumber(Integer.parseInt(tfLineNumber.getText().trim()));
+ String lambdaIndexText = tfLambdaIndex.getText().trim();
+ if (lambdaIndexText.isEmpty()) {
+ breakpoint.setLambdaIndex(new int[0]);
+ } else {
+ breakpoint.setLambdaIndex(Arrays.stream(lambdaIndexText.split(", *")).mapToInt(v -> Integer.parseInt(v)).toArray());
Review Comment:
@dbalek suggested the dialog should do validation, so i did that. The indexes are valid then (after the validation), I think, and can be relied on.
##########
java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/breakpoints/BreakpointsReader.java:
##########
@@ -370,6 +372,10 @@ public void write (Object object, Properties properties) {
LineBreakpoint.PROP_LINE_NUMBER,
lb.getLineNumber ()
);
+ properties.setArray(
+ LineBreakpoint.PROP_LAMBDA_INDEX,
+ Arrays.stream(lb.getLambdaIndex()).mapToObj(v -> v).toArray()
Review Comment:
Yes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#issuecomment-4555895503
FWIW, the lambda index is now a list, and the weird UI is removed. So, e.g. `-1, 1` is a valid list of lambda indices to stop on, and means "stop outside of any lambda, and on the second lambda on the line".
Also, there's a test added, which should (hopefully) ensure the lambda breakpoints work as intended over DAP.
I think this is ready for review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#issuecomment-4593148387
FWIW, I've squashed the commit (hoping for a clean run in Actions). I wonder if there are is any further feedback. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Breakpoints for Java lambdas. [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on code in PR #9285:
URL: https://github.com/apache/netbeans/pull/9285#discussion_r3336298506
##########
java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/LineBreakpoint.java:
##########
@@ -67,6 +68,8 @@ public class LineBreakpoint extends JPDABreakpoint {
/** Property name constant */
public static final String PROP_LINE_NUMBER = "lineNumber"; // NOI18N
/** Property name constant */
+ public static final String PROP_LAMBDA_INDEX = "lambdaIndex"; // NOI18N
Review Comment:
I think property name/constant should match getter/setter:
```suggestion
public static final String PROP_LAMBDA_INDEXES = "lambdaIndexes"; // NOI18N
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists