while(true); loop throws Unreachable code when isn’t in a void
The language spec has an exact definition what the compiler should treat as unreachable code, see also https://stackoverflow.com/a/20922409/14955. In particular, it does not care about if a method completes, and it does not look inside other methods. It won’t do more than that. However, you could get static code analysis tools like FindBugs to get … Read more