Community
Participate
Working Groups
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.
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.
does the problem go away if you recreate the breakpoint and condition?
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...
Can you try this in 3.3?
(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.
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
Fixed with the patch in bug 184862. *** This bug has been marked as a duplicate of bug 184862 ***