I get unexpected behavior in my Android 1.5 application under a Windows emulator and debug it using Eclipse. Here's a generalization of what the code does:
if (someCondition) {
System.out.println("got here");
return "a";
}
if (someOtherCondition)
return "b"
return "c";
If I go through this code with the debugger, if someConditiontrue, it displays "got here", but then jumps to the final return statement, as if it were going to execute this line. From what I can say, it returns “a,” but it is confusing because it seems like it will return “c”.
If it someConditionis false, but someOtherCondition- true, the debugger goes to the line return "b"- it does not jump to the final return statement and then leaves the method as expected.
As I mentioned, it seems like it always returns the expected behavior, but the fact that the debugger goes to the wrong line made me pursue phantom errors. A complete rebuild, restarting Eclipse, and restarting Windows each of them does not affect the problem - it is completely recreated.
Any ideas?
source
share