简体   繁体   中英

Can I “Force Return” from a void method in the Eclipse debugger?

While debugging in Eclipse, it would be useful for me to avoid the side effects of a void function by just doing a force return (which I have done before with a non-void method).

However, the context menu item is always disabled when I try to return from a void method. Specifically, I tried going into the Display pane while debugging, enter a value I'd like to return, right-click and select "Force Return". Obviously, a void method is not supposed to return anything so I can understand why this menu item is disabled.

Does anyone know of a way to do this, or does some feature of Java prohibit me from doing it?

是的,您可以这样做,不要使用变量显示中的上下文菜单,而是右键单击代码,您将在上下文菜单中看到“强制返回”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM