John Keiser writes:
> I have one use for conditional compilation of Java classes that I would
> like to employ. I do a lot of sanity checking in the JavaBeans classes, and
> that code is rather bulky. -DNO_SANITY_CHECKS would be kinda nice.
> There must be some macro preprocessor out there, m4 or something (I don't
> know much about m4).
Am I missing something here? I was under the impression
that Java more or less guarantees that
class Config {
public static const boolean SANITY_CHECK = false;
}
if( SANITY_CHECK ) {
// Insanity here.
}
will provide conditional compilation. I only looked
at the changes in bytecode size, not the bytecode
itself, but this seems to work.
I would love to see some template preprocessor for some
pseudo-Java, but I am not sure that introducing CPP to
"Glasspath" or any other project to get nothing but
C-style conditional compilation is a good idea. In
any case - shouldn't a (free) JavaCC be the tool of
choice?
b.