I am writing a desktop and j2me application. I have debug statements in program. Currently to avoid those getting compiled i use as following. We are doing this to reduce size of jar. (Specifically for mobile)
ConstantFile.java
Boolean ConstantFile.DebugEnabled = false;
if(ConstantFile.DebugEnabled) {
log.debug("msg");
}
But this is sort of hard coding. Is there an alternative like C where we have pre-compiled directives. Can Annotation help here ? Or something else i should look for ?
I got exact answer i wanted. Preprocessor. Similar to hatchetman82 suggested, There is wtkpreprocess task available. And its specifically developed for mobile. (Though it can be used for other java part also.) And it works perfectly. It comments out line so byte code remains lighter.