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

Bug 330625

Summary: [expr] New watch expressions executed twice
Product: [Eclipse Project] JDT Reporter: Justin Spadea <jspadea>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: pawel.1.piech
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Justin Spadea CLA 2010-11-18 17:51:56 EST
Build Identifier: 3.6.1

I've seen this with Eclipse 3.4 as well.

When adding a watch expression in the middle of a debug session, it is evaluated twice. If the expression has side effects, this can screw things up. I understand that you have to be careful about expressions with side effects, but this prevents you from running it just once then deleting/disabling it.

This also occurs the first time you suspend for a debug session - all expressions are evaluated twice (subsequent suspends only execute the expression once though), but that's less of a concern since you're asking for trouble if you leave expressions with side effects enabled.

Reproducible: Always

Steps to Reproduce:
public class ExprRunTwice
{
	public static void main( String[] args )
	{
		System.out.println("suspended..."); // Add breakpoint here
	}
}

While suspended add a watch expression: System.out.println("foo")

See "foo" immediately printed twice in the console.
Comment 1 Pawel Piech CLA 2011-06-08 14:19:59 EDT
One sensible option would be to execute function expressions only on demand, then cache the result to show in view.  In our product we've hi-jacked the cell editor activation trigger to refresh function expressions.
Comment 2 Eclipse Genie CLA 2019-11-13 15:27:51 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.