Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 156370 - [breakpoints] Conditional breakpoint compilation error on sane-looking code
Summary: [breakpoints] Conditional breakpoint compilation error on sane-looking code
Status: RESOLVED DUPLICATE of bug 184862
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-06 11:18 EDT by kevin mudrick CLA
Modified: 2007-05-04 10:25 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kevin mudrick CLA 2006-09-06 11:18:02 EDT
I'm getting the following error:

Conditional breakpoint has compilation error(s).

Reason:
Evaluations must contain either an expression or a block of well-formed statements

The conditional breakpoint looks like this:

"ABBREV_SPEC_WITH_LTC_AFFIL".equals(statistic.getName())

It is enabled and is set to suspend when the condition is true.

The breakpoint is on a line within a for-loop block structured like:

for (Statistic statistic : stats) {
   ...
}

statistic is valid and non-null according to the Variables pane.

This happens while debugging a JBoss 4.0 server.  I've tried stopping and restarting Eclipse and cleaning my project, to no avail.
Comment 1 Darin Wright CLA 2006-09-06 11:55:57 EDT
This works for me using a similar breakpoint with the condition:

    "four".equals(thing.getName())

package a.b.c;

import java.util.ArrayList;

public class ConditionalBreak {

	String fName;
	
	public ConditionalBreak(String name) {
		fName = name;
	}
	
	public String getName() {
		return fName;
	}
	
	public static void main(String[] args) {
		ArrayList<ConditionalBreak> list = new ArrayList<ConditionalBreak>();
		list.add(new ConditionalBreak("one"));
		list.add(new ConditionalBreak("one"));
		list.add(new ConditionalBreak("three"));
		list.add(new ConditionalBreak("four"));
		list.add(new ConditionalBreak("five"));
		for (ConditionalBreak thing : list) {
			System.out.println(thing.toString()); // BP with cond
		}
	}
}

However, you might try formatting like "return EXPRESSION;" (i.e. add return and a semicolon), as a workaround.
Comment 2 Michael Rennie CLA 2006-10-17 17:03:56 EDT
does the problem go away if you recreate the breakpoint and condition?
Comment 3 Patrick Forhan CLA 2006-11-21 11:35:21 EST
I have this problem as well.  Example code runs just fine for me, too.  But in any "real" code I cannot set a condition -- I've had to resort to using hit counts.

I can't even set the condition to 

true 

or to 

return true;

I get the same error in both cases -- "Evaluations must contain either an expression or a block of well-formed statements".

If I change the word true to blah, then I get a bit more detail -- it says first that "blah cannot be resolved" and then continues into the above error message.

Recreating the breakpoint has no effect.  The only solution is to not use conditionals...
Comment 4 Darin Wright CLA 2007-02-08 13:40:04 EST
Can you try this in 3.3?
Comment 5 Patrick Forhan CLA 2007-02-08 13:52:22 EST
(In reply to comment #4)
> Can you try this in 3.3?

Sorry - I should have mentioned it.  I was using the latest 3.3 milestone build at the time, and, indeed, I still get it under 3.3 I20061214-1445, which I believe is M4.

I think this is just a symptom of a larger problem -- on the whole, my debugging has gotten really unstable under 3.3, with the debug view's thread tree constantly refreshing (losing my selected thread), sometimes not being able to evaluate any expressions, not being able to use ctrl-shift-I or ctrl-shift-D.  Of course,  I can't narrow down what the conditions are when things work right, or don't -- I hope someone can.
Comment 6 Darin Wright CLA 2007-04-30 16:10:33 EDT
I can now reproduce the problem using Sun 1.5_08 and teh sample code in comment#1. It generates a run method like:

	static <a.b.c.ConditionalBreak> void ___run(java.lang.String[] args, java.util.ArrayList<a.b.c.ConditionalBreak> list, a.b.c.ConditionalBreak thing) throws Throwable {
		"four".equals(thing.getName());
	}

and the compilation error is in on the fist dot separator in "a.b..."

   Syntax error on token ".", extends expected
Comment 7 Darin Wright CLA 2007-05-04 10:25:54 EDT
Fixed with the patch in bug 184862.

*** This bug has been marked as a duplicate of bug 184862 ***