Eclipse debugger "jumps" skipping important code
I have a weird problem debugging an android application. To be accurate, I copy here the exact code I'm running on:
// Get the puzzles from cache
List<PuzzleDetails> newPuzzles = m_cachedPuzzles.getPuzzles(count);
if(newPuzzles.size() > 0){
// Remove from cache
m_cachedPuzzles.removePuzzles(newPuzzles); // LINE (A)
// Add the new puzzles from cache immediately
m_ownedPuzzles.addPuzzles(newPuzzles);
Log.d("requests", "" + newPuzzles.size() + " moved from cache to user");
}
int left = count - newPuzzles.size();
String deviceId = ResourcesPublisher.getInstance().getDeviceId();
// Don't let anyone else use these points for now
ChallengePointsManagerImpl.getInstance().usePoints(left);
Log.d("requests", "aquirePuzzles(" + left + ")");
// Get a list of requests for 'left' number of puzzles
RequestList reqList = getRequestList(left);
// TODO this is a bug, now
if(reqList.size() > 1){
reqList = getRequestList(left); // LINE (B)
}
When I run on this code, after stepping over the line (A) m_cachedPuzzles.removePuzzles(newPuzzles); The debugger "jumps" to the last line (B) reqList = getRequestList(left);
A simple check shows it really skipped all code between these code lines. For example the Log.d(...) was never called nor written.
Can anyone give me a clue why does it happen???
Thanks!
尝试在编译代码之后并开始调试之前,在项目资源管理器上显示的项目上执行右键单击> refresh
。
也许从A行抛出一个异常,下一步对应于关闭这个堆栈帧?
mIsReaded = (mIsReaded)?false:true;
//mIsReaded = !mIsReaded;
saveReadFlag();
refreshUI();
Toast.makeText(getSherlockActivity(),...
In my case commented codeline cause the similar problem (two lines are skipped). For to solve it I just changed this line by codeline posted above (I mean mIsReaded = (mIsReaded)?false:true;) So different cases haves different solutions. It is result of code optimization by compiler, so please refactor something in (inside) m_cachedPuzzles.removePuzzles(newPuzzles);
链接地址: http://www.djcxy.com/p/10404.html上一篇: 如何在脚本标记字符串中嵌入变量?