[hg] main-silver: #226029: getSession()/setSession() methods are...

  • From:
  • To:
  • Subject: [hg] main-silver: #226029: getSession()/setSession() methods are...
  • Date: Thu, 21 Feb 2013 19:37:57 -0800

changeset 878bf015da81 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/878bf015da81
description:
        #226029: getSession()/setSession() methods are added to 
JPDABreakpoint class.

diffstat:

 api.debugger.jpda/apichanges.xml                                             
                     |  15 ++++++
 api.debugger.jpda/manifest.mf                                                
                     |   2 +-
 api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDABreakpoint.java     
                     |  10 ++--
 debugger.jpda.ui/nbproject/project.xml                                       
                     |   1 +
 
debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/RunToCursorActionProvider.java
 |   9 +---
 debugger.jpda/nbproject/project.xml                                          
                     |   2 +-
 debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDAStepImpl.java       
                     |   9 +---
 
debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/RunIntoMethodActionProvider.java
     |   9 +---
 
debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java
              |   9 +---
 
debugger.jpda/src/org/netbeans/modules/debugger/jpda/breakpoints/BreakpointsEngineListener.java
   |  22 +---------
 10 files changed, 29 insertions(+), 59 deletions(-)

diffs (210 lines):

diff --git a/api.debugger.jpda/apichanges.xml 
b/api.debugger.jpda/apichanges.xml
--- a/api.debugger.jpda/apichanges.xml
+++ b/api.debugger.jpda/apichanges.xml
@@ -801,6 +801,21 @@
         <issue number="215680"/>
     </change>
 
+    <change>
+        <api name="JPDADebuggerAPI"/>
+        <summary>Breakpoints can be made session-specific.</summary>
+        <version major="2" minor="41"/>
+        <date day="19" month="2" year="2013"/>
+        <author login="mentlicher"/>
+        <compatibility addition="yes" source="compatible" 
binary="compatible"/>
+        <description>
+            getSession()/setSession() methods are added to JPDABreakpoint 
class.
+            They can be used to make the breakpoint debugger 
session-specific.
+        </description>
+        <class package="org.netbeans.api.debugger.jpda" 
name="JPDABreakpoint" />
+        <issue number="226029"/>
+    </change>
+
 
 </changes>
 
diff --git a/api.debugger.jpda/manifest.mf b/api.debugger.jpda/manifest.mf
--- a/api.debugger.jpda/manifest.mf
+++ b/api.debugger.jpda/manifest.mf
@@ -1,6 +1,6 @@
 Manifest-Version: 1.0
 OpenIDE-Module: org.netbeans.api.debugger.jpda/2
 OpenIDE-Module-Localizing-Bundle: 
org/netbeans/api/debugger/jpda/Bundle.properties
-OpenIDE-Module-Specification-Version: 2.40
+OpenIDE-Module-Specification-Version: 2.41
 OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager]
 
diff --git 
a/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDABreakpoint.java 
b/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDABreakpoint.java
--- a/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDABreakpoint.java
+++ b/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDABreakpoint.java
@@ -98,7 +98,7 @@
     private int                         suspend;
     private String                      printText;
     private Collection<JPDABreakpointListener>  breakpointListeners = new 
HashSet<JPDABreakpointListener>();
-    private JPDADebugger                session;
+    private volatile JPDADebugger       session;
     private List<DebuggerEngine> engines = new ArrayList<DebuggerEngine>();
     
    
@@ -234,9 +234,9 @@
      * This will make the breakpoint session-specific
      *
      * @param session the specific session
+     * @since 2.41
      */
-    // TODO: make this public API
-    synchronized void setSession(JPDADebugger session) {
+    public void setSession(JPDADebugger session) {
         this.session = session;
     }
 
@@ -246,9 +246,9 @@
      * and is discarded after this session finishes.
      *
      * @return the specific session or <code>null</code>.
+     * @since 2.41
      */
-    // TODO: make this public API
-    synchronized JPDADebugger getSession() {
+    public JPDADebugger getSession() {
         return session;
     }
 
diff --git a/debugger.jpda.ui/nbproject/project.xml 
b/debugger.jpda.ui/nbproject/project.xml
--- a/debugger.jpda.ui/nbproject/project.xml
+++ b/debugger.jpda.ui/nbproject/project.xml
@@ -64,6 +64,7 @@
                     <compile-dependency/>
                     <run-dependency>
                         <release-version>2</release-version>
+                       <specification-version>2.41</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git 
a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/RunToCursorActionProvider.java
 
b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/RunToCursorActionProvider.java
--- 
a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/RunToCursorActionProvider.java
+++ 
b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/RunToCursorActionProvider.java
@@ -152,14 +152,7 @@
         if (currentThread != null) {
             breakpoint.setThreadFilters(debugger, new JPDAThread[] { 
currentThread });
         }
-        // TODO: mb.setSession(debugger);
-        try {
-            java.lang.reflect.Method setSessionMethod = 
JPDABreakpoint.class.getDeclaredMethod("setSession", JPDADebugger.class);
-            setSessionMethod.setAccessible(true);
-            setSessionMethod.invoke(breakpoint, debugger);
-        } catch (Exception ex) {
-            org.openide.util.Exceptions.printStackTrace(ex);
-        }
+        breakpoint.setSession(debugger);
         DebuggerManager.getDebuggerManager ().addBreakpoint (breakpoint);
         if (currentThread != null) {
             currentThread.resume();
diff --git a/debugger.jpda/nbproject/project.xml 
b/debugger.jpda/nbproject/project.xml
--- a/debugger.jpda/nbproject/project.xml
+++ b/debugger.jpda/nbproject/project.xml
@@ -64,7 +64,7 @@
                     <compile-dependency/>
                     <run-dependency>
                         <release-version>2</release-version>
-                        <specification-version>2.37</specification-version>
+                        <specification-version>2.41</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDAStepImpl.java 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDAStepImpl.java
--- a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDAStepImpl.java
+++ b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDAStepImpl.java
@@ -341,14 +341,7 @@
                 mb.setSuspend(JPDABreakpoint.SUSPEND_NONE);
                 lastMethodExitBreakpointListener = new 
MethodExitBreakpointListener(mb);
                 
mb.addJPDABreakpointListener(lastMethodExitBreakpointListener);
-                // TODO: mb.setSession(debugger);
-                try {
-                    java.lang.reflect.Method setSessionMethod = 
JPDABreakpoint.class.getDeclaredMethod("setSession", JPDADebugger.class);
-                    setSessionMethod.setAccessible(true);
-                    setSessionMethod.invoke(mb, debugger);
-                } catch (Exception ex) {
-                    org.openide.util.Exceptions.printStackTrace(ex);
-                }
+                mb.setSession(debugger);
                 DebuggerManager.getDebuggerManager().addBreakpoint(mb);
             }
         }
diff --git 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/RunIntoMethodActionProvider.java
 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/RunIntoMethodActionProvider.java
--- 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/RunIntoMethodActionProvider.java
+++ 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/RunIntoMethodActionProvider.java
@@ -265,14 +265,7 @@
                     doAction(url, event.getReferenceType(), methodLine, 
methodOffset, method, false);
                 }
             });
-            // TODO: cbrkp.setSession(debugger);
-            try {
-                java.lang.reflect.Method setSessionMethod = 
JPDABreakpoint.class.getDeclaredMethod("setSession", JPDADebugger.class);
-                setSessionMethod.setAccessible(true);
-                setSessionMethod.invoke(cbrkp, debugger);
-            } catch (Exception ex) {
-                Exceptions.printStackTrace(ex);
-            }
+            cbrkp.setSession(debugger);
             DebuggerManager.getDebuggerManager().addBreakpoint(cbrkp);
             resume(debugger);
         }
diff --git 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java
 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java
--- 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java
+++ 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java
@@ -331,14 +331,7 @@
         mb.setThreadFilters(getDebuggerImpl(), new JPDAThread[] { jtr });
         lastMethodExitBreakpointListener = new 
MethodExitBreakpointListener(mb);
         mb.addJPDABreakpointListener(lastMethodExitBreakpointListener);
-        // TODO: mb.setSession(debugger);
-        try {
-            java.lang.reflect.Method setSessionMethod = 
JPDABreakpoint.class.getDeclaredMethod("setSession", JPDADebugger.class);
-            setSessionMethod.setAccessible(true);
-            setSessionMethod.invoke(mb, debugger);
-        } catch (Exception ex) {
-            Exceptions.printStackTrace(ex);
-        }
+        mb.setSession(debugger);
         DebuggerManager.getDebuggerManager().addBreakpoint(mb);
     }
     
diff --git 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/breakpoints/BreakpointsEngineListener.java
 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/breakpoints/BreakpointsEngineListener.java
--- 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/breakpoints/BreakpointsEngineListener.java
+++ 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/breakpoints/BreakpointsEngineListener.java
@@ -277,16 +277,7 @@
             boolean removed = removeBreakpointImpl (bs [i]);
             if (removed && bs[i] instanceof JPDABreakpoint) {
                 JPDABreakpoint jb = (JPDABreakpoint) bs[i];
-                // TODO: JPDADebugger bDebugger = jb.getSession();
-                JPDADebugger bDebugger;
-                try {
-                    java.lang.reflect.Method getSessionMethod = 
JPDABreakpoint.class.getDeclaredMethod("getSession");
-                    getSessionMethod.setAccessible(true);
-                    bDebugger = (JPDADebugger) getSessionMethod.invoke(jb);
-                } catch (Exception ex) {
-                    bDebugger = null;
-                    Exceptions.printStackTrace(ex);
-                }
+                JPDADebugger bDebugger = jb.getSession();
                 if (bDebugger != null && bDebugger.equals(debugger)) {
                     // A hidden breakpoint submitted just for this one 
session. Remove it with the end of the session.
                     DebuggerManager.getDebuggerManager 
().removeBreakpoint(jb);
@@ -317,16 +308,7 @@
         synchronized (breakpointToImpl) {
             if (breakpointToImpl.containsKey (b)) return;
             if (!(b instanceof JPDABreakpoint)) return ;
-            JPDADebugger bDebugger;
-            try {
-                // TODO: bDebugger = ((JPDADebugger) b).getSession();
-                java.lang.reflect.Method getSessionMethod = 
JPDABreakpoint.class.getDeclaredMethod("getSession");
-                getSessionMethod.setAccessible(true);
-                bDebugger = (JPDADebugger) getSessionMethod.invoke(b);
-            } catch (Exception ex) {
-                bDebugger = null;
-                Exceptions.printStackTrace(ex);
-            }
+            JPDADebugger bDebugger = ((JPDABreakpoint) b).getSession();
             if (bDebugger != null && !bDebugger.equals(debugger)) {
                 return ;
             }

[hg] main-silver: #226029: getSession()/setSession() methods are...

mentlicher 02/22/2013

Project Features

About this Project

Debugger was started in November 2009, is owned by tpavek, and has 29 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close