Java has (primitive) debugging support like this in that simple if in boolean constants will not generate such warnings (and, indeed, when the evaluation is false, the compiler will delete the entire conditional block). So you can do:
if(false) {
Similarly, if you temporarily insert early termination for debugging, you can do it like this:
if(true) { return blah; }
or
if(true) { throw new RuntimeException("Blow Up!"); }
And note that the Java specification explicitly states that, at compile time, permanently false conditional blocks are deleted, and IIRC, constantly true, have the condition removed. These include:
public class Debug { static public final boolean ON=false; } ... if(Debug.ON) { ... }
source share