MartinBalin commented on code in PR #9732:
URL: https://github.com/apache/netbeans/pull/9732#discussion_r4314078100
##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/BreakpointOutput.java:
##########
@@ -375,13 +376,45 @@ private void printOutEvent(DebuggerConsoleIO io, String
format, JPDABreakpointEv
printText = selectCondition(printText, threadStartedCondition,
false);
}
}
+
+ int printLocals = printText.indexOf(localsPattern);
+ if (printLocals != -1) {
+ printText = printText.substring(0, printLocals) +
printText.substring(printLocals + localsPattern.length());
+ }
// 5) resolve all expressions {=expression}
printExpressions(event, printText, (msg, action) -> {
io.printWithAction(msg, action, false);
}, (msg) -> {
io.println(msg, null);
});
+
+ if (printLocals != -1) {
+ CallStackFrame csf = findTopFrame(event);
+ if (csf != null) {
+ try {
+ for (var refValue : csf.getLocalVariables()) {
+ io.printWithAction(" ", null, false);
+ io.printWithAction(refValue.getName(), null, false);
+ io.printWithAction(" = ", null, false);
+ if (refValue instanceof ObjectVariable obj &&
!isNull(obj)) {
+ var sessionRef = new WeakReference<>(session);
+ io.printWithAction(obj.getValue(), () -> {
Review Comment:
The hyperlink captures an `ObjectLocalVariable `wrapper that NetBeans reuses
and updates. When a loop assigns another object to the same local, earlier
links retain their original text but target the newer object. A temporary
native test reproduced this: the first hyperlink’s object ID changed from `89`
to `97`. Capture a stable object reference when creating the link.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists