jtulach commented on code in PR #9691:
URL: https://github.com/apache/netbeans/pull/9691#discussion_r4246713679


##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/BreakpointOutput.java:
##########
@@ -397,43 +400,44 @@ private String substitute (String printText, 
JPDABreakpointEvent event) {
                         }
                     } catch (AbsentInformationException aiex) {}
                 }
-                try {
-                value = ((Variable) 
theDebugger.getClass().getMethod("evaluate", String.class, 
CallStackFrame.class).
-                        invoke(theDebugger, expression, csf)).getValue();
-                } catch (InvocationTargetException itex) {
-                    if (itex.getTargetException() instanceof 
InvalidExpressionException) {
-                        throw (InvalidExpressionException) 
itex.getTargetException();
-                    }
-                } catch (Exception ex) {
-                    Exceptions.printStackTrace(ex);
+                Variable refValue = theDebugger.evaluate(expression, csf);
+                if (refValue instanceof ObjectVariable obj) {
+                    io.printWithAction("  " + obj.getType() + " " + expression 
+ " = ", null, false);
+                    var sessionRef = new WeakReference<>(session);
+                    io.printWithAction("#" + obj.getUniqueID(), () -> {

Review Comment:
   - changed in a27977e909 to not capture anything else than the breakpoint 
again
      - e.g. `io` isn't captured
   - ~~using weak reference in 408884c82a 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 
a6e613c24fc48a007c9bbf6a885ee963141ebc70



-- 
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

Reply via email to