Hi there.
Edit: I googled some more and found out, that the java compiler does almost no optimization at all.
Java relies on the JIT to do all kinds of optimization.
But there are 3rd party applications to optimize the byte code generated by a compiler a little more.
I have a quick question: How good is the compiler at noticing dead code and removing it before creating byte-code?
Lets assume I have the following code:
Would the compiler remove the call to "debug"?public class ImportantClass { private static final boolean DEBUG = false; public void importantTask() { doStuff(); debug("This is an important message!"); } private void debug(String text) { if (DEBUG) { System.out.println(text); } } private void doStuff() { // This is very complicated stuff right here! } }
Would the compiler remove the method "debug(String)"?
If it would not, is there some simple way for me to implement a conditional output which is removed from the final release?
I am working with Eclipse Juno SR2 at the moment if this is important.
Thank you very much.