allelopath
asked on
Conditional breakpoint in Eclipse
Following the example here:
http://thecoderlounge.blogspot.com/2010/06/print-points-debugging-by-writing-to.html
I am inserting a printpoint In the SDK code at Container.addImpl():
System.out.println ("Container.addImpl(): " + component + "\tindex: " + index);
return false;
The printpoint is on the 2nd line of code:
if (index > component.size() || (index < 0 && index != -1)) {
The problem is that it gives me an error saying that comp and index cannot be resolved
If I do this:
System.out.println ("Container.addImpl(): " + component);
It compiles with no error (component is a class member of Container)
So it has access to the class component but not the parameters.
One might think that the compiler has removed these, but it appears to be in debug mode by virtue of having by default the following boxes In Project -> properties -> Java Compiler checked:
x Add variable attributes to generated class files (used by the debugger)
x Add line number attributes to generated class files (used by the debugger)
x Add source file name to generated class file (used by the debugger)
x Preserve unused (never read) local variables
I also tried this:
System.out.println ("Container.addImpl(): " + args[0] + "\tindex " + args[1]);
return false;
but this gives similar compile errors for args
What can be done to do make comp and index visible?
http://thecoderlounge.blogspot.com/2010/06/print-points-debugging-by-writing-to.html
I am inserting a printpoint In the SDK code at Container.addImpl():
System.out.println ("Container.addImpl(): " + component + "\tindex: " + index);
return false;
The printpoint is on the 2nd line of code:
if (index > component.size() || (index < 0 && index != -1)) {
The problem is that it gives me an error saying that comp and index cannot be resolved
If I do this:
System.out.println ("Container.addImpl(): " + component);
It compiles with no error (component is a class member of Container)
So it has access to the class component but not the parameters.
One might think that the compiler has removed these, but it appears to be in debug mode by virtue of having by default the following boxes In Project -> properties -> Java Compiler checked:
x Add variable attributes to generated class files (used by the debugger)
x Add line number attributes to generated class files (used by the debugger)
x Add source file name to generated class file (used by the debugger)
x Preserve unused (never read) local variables
I also tried this:
System.out.println ("Container.addImpl(): " + args[0] + "\tindex " + args[1]);
return false;
but this gives similar compile errors for args
What can be done to do make comp and index visible?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
>>If it works in your code then it should work as a conditional break point code.
This does not seem to be the case. This line:
Open in new window
works in the code but not in the breakpoint.You can try this very thing yourself in Container.addImpl()