Eclipse and Debugging
Saturday, June 10th, 2006I never had any problems with Eclipse before but in a project I am currently working on I discovered a small ‘feature’ in Eclipse that made debugging slightly more difficult.
Eclipse shows the variables within an object and does not show the values the actual getter for a property.
Why is this important to know? In my current project I have an address object. This object is tagged with a special type. All address objects are passed through a filter. When the address is passed into a filter and gets matched the address object is encapsulated by a new object that returns a different type that the original type. Within this wrapper object we do not change the content of the actual address we really wrap the data. Each getter passes on to the getter of the address except for the type getter method. This returns a static value. While debugging Eclipse shows me the real value of the object NOT the static value that is returned.
Example code:
public class WrapperObject {
private Address address;
public String getName() {
return address.getName();
}
public String getType() {
return "HIDDEN";
}
}
You will not see the value “HIDDEN” in your Eclipse debugger.
This doesn’t make me love Eclipse less, but it sure keeps me more alert ![]()