Skip to content

Commit 62b11b1

Browse files
authored
#9691: Hyperlinks to object variables & co. in the debugging console
2 parents 9fc08e3 + 72436ab commit 62b11b1

23 files changed

Lines changed: 664 additions & 170 deletions

File tree

‎ide/api.debugger/src/org/netbeans/spi/debugger/ContextAwareSupport.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.lang.reflect.InvocationTargetException;
2424
import java.lang.reflect.Method;
2525
import java.lang.reflect.Proxy;
26-
import java.util.ArrayList;
2726
import java.util.Collections;
2827
import java.util.Map;
2928
import java.util.logging.Level;

‎ide/spi.debugger.ui/src/org/netbeans/spi/debugger/ui/PinWatchUISupport.java‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
*/
1919
package org.netbeans.spi.debugger.ui;
2020

21-
import java.beans.Customizer;
2221
import java.beans.PropertyChangeEvent;
23-
import java.beans.PropertyChangeListener;
2422
import java.util.HashMap;
2523
import java.util.HashSet;
2624
import java.util.List;
@@ -35,7 +33,6 @@
3533
import org.netbeans.modules.debugger.ui.annotations.WatchAnnotationProvider;
3634
import org.netbeans.spi.debugger.DebuggerServiceRegistration;
3735
import org.openide.loaders.DataObjectNotFoundException;
38-
import org.openide.util.Exceptions;
3936
import org.openide.util.NbBundle;
4037

4138
/**

‎java/api.debugger.jpda/apichanges.xml‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
-->
2222

2323
<?xml-stylesheet href="../../nbbuild/javadoctools/apichanges.xsl" type="text/xsl"?>
24-
<!DOCTYPE apichanges PUBLIC "-//NetBeans//DTD API changes list 1.0//EN" "../../nbbuild/javadoctools/apichanges.dtd">
24+
<!DOCTYPE apichanges PUBLIC "-//NetBeans//DTD API changes list 1.1//EN" "../../nbbuild/javadoctools/apichanges-1.1.dtd">
2525

2626
<!-- INFO FOR PEOPLE ADDING CHANGES:
2727
[most of contents snipped - see openide's apichanges for how-to instructions]
@@ -51,6 +51,22 @@
5151
<!-- ACTUAL CHANGES BEGIN HERE: -->
5252

5353
<changes>
54+
<change>
55+
<api name="JPDADebuggerAPI"/>
56+
<summary>ObjectInfoProvider, JPDABreakpointEvent, JPDADebugger enhancements</summary>
57+
<version major="3" minor="45"/>
58+
<date day="16" month="10" year="2026"/>
59+
<author login="jtulach"/>
60+
<compatibility addition="yes"/>
61+
<description>
62+
New service provider interface <code>ObjectInfoProvider</code>.
63+
Added <code>JPDABreakpointEvent.isThreadDeath()</code> method.
64+
Added new overload of <code>evaluate</code> method in <code>JPDADebugger</code>.
65+
</description>
66+
<class name="JPDABreakpointEvent" package="org.netbeans.api.debugger.jpda.event"/>
67+
<class name="JPDADebugger" package="org.netbeans.api.debugger.jpda"/>
68+
<class name="ObjectInfoProvider" package="org.netbeans.spi.debugger.jpda"/>
69+
</change>
5470
<change>
5571
<api name="JPDADebuggerAPI"/>
5672
<summary>Randomly select listening port</summary>

‎java/api.debugger.jpda/manifest.mf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Manifest-Version: 1.0
22
OpenIDE-Module: org.netbeans.api.debugger.jpda/2
33
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/debugger/jpda/Bundle.properties
4-
OpenIDE-Module-Specification-Version: 3.44
4+
OpenIDE-Module-Specification-Version: 3.45
55
OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager]
66

‎java/api.debugger.jpda/nbproject/org-netbeans-api-debugger-jpda.sig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ CLSS public java.util.EventObject
8080
cons public init(java.lang.Object)
8181
fld protected java.lang.Object source
8282
intf java.io.Serializable
83-
meth public java.lang.Object getSource()
83+
meth public org.netbeans.api.debugger.jpda.JPDABreakpoint getSource()
8484
meth public java.lang.String toString()
8585
supr java.lang.Object
8686

‎java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDADebugger.java‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,26 @@ public List<JPDAThread> getAllThreads() {
397397
* @param expression a expression to be evaluated
398398
*
399399
* @return current value of given expression
400+
* @throws org.netbeans.api.debugger.jpda.InvalidExpressionException
400401
*/
401402
public abstract Variable evaluate (String expression)
402403
throws InvalidExpressionException;
403404

405+
/**
406+
* Evaluates given expression in the current context.
407+
*
408+
* @param expression a expression to be evaluated
409+
* @param csf frame to evaluate the expression at
410+
*
411+
* @return current value of given expression
412+
* @throws org.netbeans.api.debugger.jpda.InvalidExpressionException
413+
* @since 3.45
414+
*/
415+
public Variable evaluate (String expression, CallStackFrame csf)
416+
throws InvalidExpressionException {
417+
return evaluate(expression);
418+
}
419+
404420
/**
405421
* Waits till the Virtual Machine is started and returns
406422
* {@link DebuggerStartException} if some problem occurres.

‎java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/event/JPDABreakpointEvent.java‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import com.sun.jdi.ReferenceType;
2323
import com.sun.jdi.event.Event;
24+
import com.sun.jdi.event.ThreadDeathEvent;
2425
import java.util.EventObject;
2526
import org.netbeans.api.debugger.jpda.*;
2627

@@ -105,6 +106,16 @@ public JPDABreakpointEvent (
105106
this.referenceType = referenceType;
106107
this.variable = variable;
107108
}
109+
110+
/** The breakpoint that generated this event.
111+
*
112+
* @return the breakpoint associated with this event
113+
* @since 3.45
114+
*/
115+
@Override
116+
public JPDABreakpoint getSource() {
117+
return (JPDABreakpoint) super.getSource();
118+
}
108119

109120
/**
110121
* Returns result of condition evaluation.
@@ -180,4 +191,13 @@ public void resume () {
180191
public boolean getResume () {
181192
return resume;
182193
}
194+
195+
/** Checks if this event is representing {@link ThreadDeathEvent}.
196+
*
197+
* @return {@code true} or {@code false}
198+
* @since 3.45
199+
*/
200+
public boolean isThreadDeath() {
201+
return event instanceof ThreadDeathEvent;
202+
}
183203
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.netbeans.spi.debugger.jpda;
20+
21+
import org.netbeans.api.debugger.Session;
22+
import org.netbeans.api.debugger.jpda.ObjectVariable;
23+
24+
/** Provider of additional information about objects in the heap.
25+
* Register your implementation as
26+
* <pre>
27+
* @DebuggerServiceRegistration(path="netbeans-JPDASession", types=ObjectInfoProvider.class)
28+
* public final class YourProvider implements ObjectInfoProvider {
29+
* ...
30+
* }
31+
* </pre>
32+
* @since 3.45
33+
*/
34+
public interface ObjectInfoProvider {
35+
/** Handles showing the info about provided object.
36+
*
37+
* @param session the debugging session sending the request
38+
* @param obj the object to display additional information about
39+
* @return {@code true} if the object information can be shown,
40+
* {@code false} otherwise
41+
*/
42+
boolean display(Session session, ObjectVariable obj);
43+
44+
45+
/** Requests additional information about an object to be shown.
46+
* Iterates all providers registered in the
47+
* {@code session.lookup(null, ObjectInfoProvider.class)}.
48+
*
49+
* @param session the debugging session that's requesting
50+
* @param obj reference to an object in the heap
51+
* @return {@code true} if the object information can be shown,
52+
* {@code false} otherwise
53+
*/
54+
static boolean showObjectInfo(Session session, ObjectVariable obj) {
55+
for (var output : session.lookup(null, ObjectInfoProvider.class)) {
56+
if (output != null && output.display(session, obj)) {
57+
return true;
58+
}
59+
}
60+
return false;
61+
}
62+
63+
}

‎java/debugger.jpda.ui/manifest.mf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ AutoUpdate-Show-In-Client: false
33
OpenIDE-Module: org.netbeans.modules.debugger.jpda.ui/1
44
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/debugger/jpda/ui/Bundle.properties
55
OpenIDE-Module-Layer: org/netbeans/modules/debugger/jpda/resources/mf-layer.xml
6-
OpenIDE-Module-Specification-Version: 1.88
6+
OpenIDE-Module-Specification-Version: 1.89
77
OpenIDE-Module-Requires: org.netbeans.api.debugger.jpda.JPDADebuggerEngineImpl,
88
org.netbeans.spi.debugger.ui
99
OpenIDE-Module-Provides: org.netbeans.modules.debugger.jpda.ui

‎java/debugger.jpda.ui/nbproject/project.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<compile-dependency/>
4141
<run-dependency>
4242
<release-version>2</release-version>
43-
<specification-version>3.18</specification-version>
43+
<specification-version>3.45</specification-version>
4444
</run-dependency>
4545
</dependency>
4646
<dependency>
@@ -90,7 +90,7 @@
9090
<compile-dependency/>
9191
<run-dependency>
9292
<release-version>2</release-version>
93-
<specification-version>1.81</specification-version>
93+
<specification-version>1.144</specification-version>
9494
</run-dependency>
9595
</dependency>
9696
<dependency>

0 commit comments

Comments
 (0)