-
Notifications
You must be signed in to change notification settings - Fork 925
Breakpoints for Java lambdas. #9285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
beac478
9842736
2a594f0
709a3eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 | ||||||||||||||||||
|
Comment on lines
+232
to
+235
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest to add a minimal explanation/usage instruction:
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| L_Line_Breakpoint_Condition=Co&ndition: | ||||||||||||||||||
| ACSD_L_Line_Breakpoint_Condition=Condition | ||||||||||||||||||
| ACSD_TF_Line_Breakpoint_Condition=Condition | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,8 +25,10 @@ | |||||||||||||||||||||||||||||
| import java.net.URI; | ||||||||||||||||||||||||||||||
| import java.net.URISyntaxException; | ||||||||||||||||||||||||||||||
| import java.net.URL; | ||||||||||||||||||||||||||||||
| import java.util.Arrays; | ||||||||||||||||||||||||||||||
| import java.util.logging.Level; | ||||||||||||||||||||||||||||||
| import java.util.logging.Logger; | ||||||||||||||||||||||||||||||
| import java.util.stream.Collectors; | ||||||||||||||||||||||||||||||
| import javax.swing.JPanel; | ||||||||||||||||||||||||||||||
| import javax.swing.SwingUtilities; | ||||||||||||||||||||||||||||||
| import javax.swing.event.DocumentEvent; | ||||||||||||||||||||||||||||||
|
|
@@ -130,6 +132,7 @@ public LineBreakpointPanel (LineBreakpoint b, boolean createBreakpoint) { | |||||||||||||||||||||||||||||
| tfFileName.getPreferredSize().height)); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| tfLineNumber.setText(Integer.toString(b.getLineNumber())); | ||||||||||||||||||||||||||||||
| tfLambdaIndex.setText(Arrays.stream(b.getLambdaIndex()).mapToObj(String::valueOf).collect(Collectors.joining(", "))); | ||||||||||||||||||||||||||||||
| conditionsPanel = new ConditionsPanel(HELP_ID); | ||||||||||||||||||||||||||||||
| setupConditionPane(); | ||||||||||||||||||||||||||||||
| conditionsPanel.showClassFilter(false); | ||||||||||||||||||||||||||||||
|
|
@@ -143,6 +146,7 @@ public LineBreakpointPanel (LineBreakpoint b, boolean createBreakpoint) { | |||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| tfFileName.getDocument().addDocumentListener(validityDocumentListener); | ||||||||||||||||||||||||||||||
| tfLineNumber.getDocument().addDocumentListener(validityDocumentListener); | ||||||||||||||||||||||||||||||
| tfLambdaIndex.getDocument().addDocumentListener(validityDocumentListener); | ||||||||||||||||||||||||||||||
| SwingUtilities.invokeLater(new Runnable() { | ||||||||||||||||||||||||||||||
| public void run() { | ||||||||||||||||||||||||||||||
| controller.checkValid(); | ||||||||||||||||||||||||||||||
|
|
@@ -192,6 +196,8 @@ private void initComponents() { | |||||||||||||||||||||||||||||
| tfFileName = new javax.swing.JTextField(); | ||||||||||||||||||||||||||||||
| jLabel1 = new javax.swing.JLabel(); | ||||||||||||||||||||||||||||||
| tfLineNumber = new javax.swing.JTextField(); | ||||||||||||||||||||||||||||||
| jLabel4 = new javax.swing.JLabel(); | ||||||||||||||||||||||||||||||
| tfLambdaIndex = new javax.swing.JTextField(); | ||||||||||||||||||||||||||||||
| cPanel = new javax.swing.JPanel(); | ||||||||||||||||||||||||||||||
| pActions = new javax.swing.JPanel(); | ||||||||||||||||||||||||||||||
| jPanel1 = new javax.swing.JPanel(); | ||||||||||||||||||||||||||||||
|
|
@@ -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"); | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be localized? |
||||||||||||||||||||||||||||||
| tfLambdaIndex.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_TF_Line_Breakpoint_Lambda_Index")); // NOI18N | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| gridBagConstraints = new java.awt.GridBagConstraints(); | ||||||||||||||||||||||||||||||
| gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; | ||||||||||||||||||||||||||||||
| gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; | ||||||||||||||||||||||||||||||
|
|
@@ -286,10 +315,12 @@ private void initComponents() { | |||||||||||||||||||||||||||||
| private javax.swing.JPanel cPanel; | ||||||||||||||||||||||||||||||
| private javax.swing.JLabel jLabel1; | ||||||||||||||||||||||||||||||
| private javax.swing.JLabel jLabel3; | ||||||||||||||||||||||||||||||
| private javax.swing.JLabel jLabel4; | ||||||||||||||||||||||||||||||
| private javax.swing.JPanel jPanel1; | ||||||||||||||||||||||||||||||
| private javax.swing.JPanel pActions; | ||||||||||||||||||||||||||||||
| private javax.swing.JPanel pSettings; | ||||||||||||||||||||||||||||||
| private javax.swing.JTextField tfFileName; | ||||||||||||||||||||||||||||||
| private javax.swing.JTextField tfLambdaIndex; | ||||||||||||||||||||||||||||||
| private javax.swing.JTextField tfLineNumber; | ||||||||||||||||||||||||||||||
| // End of variables declaration//GEN-END:variables | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
@@ -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()); | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should be prepared for bogus values, so I would suggest this:
Suggested change
|
||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| breakpoint.setCondition (conditionsPanel.getCondition()); | ||||||||||||||||||||||||||||||
| breakpoint.setHitCountFilter(conditionsPanel.getHitCount(), | ||||||||||||||||||||||||||||||
| conditionsPanel.getHitCountFilteringStyle()); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| import java.io.IOException; | ||
| import java.net.MalformedURLException; | ||
| import java.net.URL; | ||
| import java.util.Arrays; | ||
| import java.util.Collections; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
|
|
@@ -108,6 +109,7 @@ public Object read (String typeID, Properties properties) { | |
| LineBreakpoint lb = LineBreakpoint.create ("", 0); | ||
| lb.setURL(properties.getString (LineBreakpoint.PROP_URL, null)); | ||
| lb.setLineNumber(properties.getInt (LineBreakpoint.PROP_LINE_NUMBER, 1)); | ||
| lb.setLambdaIndex(Arrays.stream(properties.getArray(LineBreakpoint.PROP_LAMBDA_INDEX, new Object[0])).mapToInt(v -> (Integer) v).toArray()); | ||
| lb.setCondition ( | ||
| properties.getString (LineBreakpoint.PROP_CONDITION, "") | ||
| ); | ||
|
|
@@ -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() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this is done to get the raw ints boxed? |
||
| ); | ||
| properties.setString ( | ||
| LineBreakpoint.PROP_CONDITION, | ||
| lb.getCondition () | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to use correct plural form? I.e.
getLambdaIndexes?