Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 304956

Summary: Inspects & Debug should not execute but just preview the outcome of the output.
Product: [Eclipse Project] JDT Reporter: Ravi <ravikumar.tj>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: darin.eclipse
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Ravi CLA 2010-03-08 00:36:43 EST
Build Identifier: 20090621-0832

Please execute this program in Debug mode.
class Source{
	static public void main(String[] args){
	     StringBuilder sb = new StringBuilder("Foo");
	       sb.delete(0,1);
	       System.out.println(sb);

	}
}


Reproducible: Always

Steps to Reproduce:
1.Execute the program in Debug mode. 
2.Set a breakpoint in sb.delete(0,1);
3.Highlight sb.delete(0,1) and press Ctrl + Shift + i
4.Value of sb becomes o which is wrong. Ctrl + Shift + i (Inspect) & Ctrl + Shift + d should be used for preview purpose during debugging and should not actually execute the statement.
Comment 1 Darin Wright CLA 2010-03-08 09:25:16 EST
The evaluations are performed in the VM/Application being debugged and have side effects. This is how the evaluation support is designed and intended to work. Marking as won't fix.
Comment 2 Ravi CLA 2010-03-08 21:12:59 EST
The Evaluation support if designed in such a way, is of no use to the developer.
Eclipse should follow these basic standards in the advanced version being released.
Comment 3 Darin Wright CLA 2010-03-08 21:44:01 EST
(In reply to comment #2)
> The Evaluation support if designed in such a way, is of no use to the
> developer.

I have to disagree. The Java debugger in Eclipse has functioned this way since JDT began. It has been of great use to many developers.

> Eclipse should follow these basic standards in the advanced version being
> released.

Evaluations are performed in the thread that the program has suspended in, via the native debug interface provided by the virtual machine (JVMTI). This is how the Java Platform Debug Architecture works - it is an industry standard.

http://java.sun.com/javase/6/docs/technotes/guides/jpda/index.html

I do not know of any Java debuggers that provide evaluation support without side effects.
Comment 4 Darin Wright CLA 2010-03-10 09:24:56 EST
Closing as won't fix.
Comment 5 Darin Wright CLA 2010-03-10 09:25:15 EST
Closed.