Skip to content

Hyperlinks to object variables & co. in the debugging console - #9691

Open
jtulach wants to merge 1 commit into
apache:masterfrom
jtulach:jtulach/BetterDebugUX
Open

jtulach wants to merge 1 commit into
apache:masterfrom
jtulach:jtulach/BetterDebugUX

Conversation

@jtulach

@jtulach jtulach commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
  • provides ObjectInfoProvider that displays more info about debugger objects in the heap
  • when the Debugger Console prints log lines with variable values it now hyperlinks the objects
  • clicking on the hyperlink either shows the object in the heap or shows configuration dialog

Hyperlink to Instances View

HyperlinkToInstances
  • when "log points" are used, the evaluated variables are printed as links
  • such a hyperlink takes user to instances view allowing further exploration of the object

@jtulach jtulach self-assigned this Oct 9, 2026
@jtulach jtulach added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) debugger labels Oct 9, 2026

@eppleton eppleton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, linking the console message to the breakpoint customizer is a nice touch, and replacing the two reflective hacks with isThreadDeath() and evaluate(String, CallStackFrame) is a clear improvement. I built api.io, api.debugger.jpda, debugger.jpda and debugger.jpda.ui from 7b35b38 locally, and they compile.

I have one suggestion about what the hyperlink keeps alive, one question about the build.xml change, and a few small points inline.

Comment thread java/api.debugger.jpda/build.xml Outdated
Comment thread java/api.debugger.jpda/apichanges.xml
@jtulach
jtulach requested a review from eppleton October 11, 2026 12:19

@eppleton eppleton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Moving the lookup to the session is a good direction. I re-checked 67972ed, and debugger.jpda.ui and debugger.jpda.heapwalk build locally. I haven't run it in the IDE.

The new link still holds the debugger through two of the objects it captures (details inline). The findProvider() debug output and the dependency version need a look before this goes in. The two failonerror="false" changes you mentioned reverting are also still in the build.xml files.

if (refValue instanceof ObjectVariable obj) {
io.printWithAction(" " + obj.getType() + " " + expression + " = ", null, false);
var sessionRef = new WeakReference<>(session);
io.printWithAction("#" + obj.getUniqueID(), () -> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WeakReference to the session helps, but javap shows the lambda as lambda$printOutEvent$0(WeakReference, ObjectVariable, DebuggerConsoleIO), so it still captures obj and io strongly. Both reach the debugger:

  • obj is an AbstractVariable, which has private JPDADebuggerImpl debugger, plus the JDI Value.
  • io is DebuggerConsoleIO, which has private final JPDADebuggerImpl debugger.

The output window keeps the listener: NbIOProvider.hyperlinkToOutputListener wraps the Hyperlink, and AbstractLines stores it per line. DebuggerOutput closes the old tab only when a new session starts as the only session. A heap dump taken after starting the next session therefore wouldn't show it. I traced this in the code and haven't taken a heap dump myself, so it may be worth checking with the console tab still open after the session ends.

Maybe hold obj weakly too, as ShowObjectVariableInHeap already does? The "Cannot display details" fallback is the only reason to capture io.

@jtulach jtulach Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • changed in a27977e to not capture anything else than the breakpoint again
    • e.g. io isn't captured
  • using weak reference in 408884c as suggested
    • no, weak references don't work!
    • there can be many ObjectVariable instances pointing to the same object in the debugee
    • cannot hold weak reference, as it gets GCed
    • returned back to regular reference in a6e613c

@eppleton eppleton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our pushes crossed: my review above is on 67972ed. Printing the message in segments removes the extra line I asked about, but it also changes which values are printed as #id. Two follow-ups are inline. The other points from the review above still apply to 2bef3a6.

@jtulach jtulach changed the title Show faulty breakpoint configuration directly from console Hyperlinks to object variables & co. in the debugging console Oct 12, 2026
@jtulach
jtulach requested review from ebarboni and eppleton October 12, 2026 13:35
@jtulach jtulach added this to the NB32 milestone Oct 12, 2026
@jtulach

jtulach commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

I am pretty happy with current behavior. I'd like to get it into NetBeans 32 - e.g. to integrate by Oct 15, 2026. Reviewers, please review (again). Update: needed 6b2999e bugfix to build.

@neilcsmith-net

Copy link
Copy Markdown
Member

It doesn't seem to build in its current state?!

@lahodaj

lahodaj commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

I am not an expert on the debugger, but makes sense to me.

@jtulach

jtulach commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Adding a test for the behavior in 9ffb3a4

@lahodaj lahodaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Note you should squash before merging, as per existing rules.)

@eppleton eppleton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked at 9ffb3a4 again. The ObjectInfoProvider SPI is a nice cleanup, the four touched modules build for me, and the test is a great addition.

On weak references: agreed. Your point that the link may be the only holder of the ObjectVariable is right, and since the old console tab is closed when a new session starts, the strong references are fine with me.

Two things below: an exception regression in printExpressions, and the test failing on my machine (JDK 21, macOS).

@jtulach
jtulach requested a review from eppleton October 13, 2026 16:34

@eppleton eppleton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, both points are addressed in 87ddf47. BreakpointOutputTest passes for me locally. LGTM.

@jtulach
jtulach force-pushed the jtulach/BetterDebugUX branch from 87ddf47 to 72436ab Compare October 14, 2026 07:57
@jtulach

jtulach commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for reviews. Squashed. Once the CI is green, I integrate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debugger Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants