Index: api/src/org/netbeans/api/debugger/jpda/JPDADebugger.java
===================================================================
RCS file: /cvs/debuggerjpda/api/src/org/netbeans/api/debugger/jpda/JPDADebugger.java,v
--- api/src/org/netbeans/api/debugger/jpda/JPDADebugger.java 12 Aug 2005 12:45:10 -0000 1.18
+++ api/src/org/netbeans/api/debugger/jpda/JPDADebugger.java 18 Oct 2005 13:07:46 -0000
@@ -322,6 +322,15 @@
* @return true
if this debugger supports Pop action
*/
public abstract boolean canPopFrames ();
+
+ /**
+ * Determines if the target debuggee can be modified.
+ *
+ * @return true
if the target debuggee can be modified.
+ */
+ public boolean canBeModified() {
+ return true;
+ }
/**
* Implements fix & continue (HotSwap). Map should contain class names
Index: src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java
===================================================================
RCS file: /cvs/debuggerjpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java,v
--- src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java 17 Oct 2005 09:28:13 -0000 1.86
+++ src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java 18 Oct 2005 13:07:46 -0000
@@ -313,6 +313,33 @@
}
}
+
+ private Boolean canBeModified;
+ private Object canBeModifiedLock = new Object();
+
+ public boolean canBeModified() {
+ VirtualMachine vm = getVirtualMachine ();
+ if (vm == null) return false;
+ synchronized (canBeModifiedLock) {
+ if (canBeModified == null) {
+ try {
+ java.lang.reflect.Method canBeModifiedMethod =
+ com.sun.jdi.VirtualMachine.class.getMethod("canBeModified", new Class[] {});
+ Object modifiable = canBeModifiedMethod.invoke(vm, new Object[] {});
+ canBeModified = (Boolean) modifiable;
+ } catch (NoSuchMethodException nsmex) {
+ // On JDK 1.4 we do not know... we suppose that can
+ canBeModified = Boolean.TRUE;
+ } catch (IllegalAccessException iaex) {
+ canBeModified = Boolean.TRUE;
+ } catch (InvocationTargetException itex) {
+ canBeModified = Boolean.TRUE;
+ }
+ }
+ return canBeModified.booleanValue();
+ }
+ // return vm.canBeModified(); -- After we'll build on JDK 1.5
+ }
private SmartSteppingFilter smartSteppingFilter;
@@ -640,6 +667,9 @@
JPDAUtils.printFeatures (vm);
}
virtualMachine = vm;
+ synchronized (canBeModifiedLock) {
+ canBeModified = null; // Reset the can be modified flag
+ }
initGenericsSupport ();