[SOLVED] Changing unreachable code behavior [message #1859295] |
Sun, 28 May 2023 20:54  |
Eclipse User |
|
|
|
Hi. It's not uncommon for me to throw a return in the middle of a method when debugging so I can test the beginning and not have it continue. In C# and PHP, they don't care. Java though makes it uncompilable. Quite irritating, as I have to do like if (1==1) return;
I saw in Preferences, Java, Compiler, Errors/Warnings you can change behavior for many things, but sadly unreachable code is not one of them. I saw "dead code" but it was set to warning so I assume that's not the same thing, as this is straight up red underlined non-compilable. I tried setting it to ignore anyway, but yea, had no effect.
Is there a way to change it to just a warning?
[Updated on: Mon, 29 May 2023 23:32] by Moderator
|
|
|
|
|
|
|
Re: Changing unreachable code behavior [message #1859720 is a reply to message #1859305] |
Fri, 23 June 2023 04:02  |
Eclipse User |
|
|
|
Hey Ken, good to hear your issue is resolved, albeit not the way you'd hoped. As Ed and Ed Willink suggested, using "if (Boolean.TRUE) return;" or "assert false;" are nifty workarounds. Java's strictness can be a bit frustrating when debugging, but it also helps avoid some more subtle bugs down the line. Remember, each language has its quirks.
|
|
|
Powered by
FUDForum. Page generated in 0.03126 seconds