This is the mail archive of the
java-discuss@sources.redhat.com
mailing list for the Java project.
Re: A java DEBUG flag
- To: Bryce McKinlay <bryce at albatross dot co dot nz>
- Subject: Re: A java DEBUG flag
- From: Mark Wielaard <mark at klomp dot org>
- Date: Thu, 23 Nov 2000 09:52:40 +0100
- Cc: java-discuss at sources dot redhat dot com, classpath at gnu dot org
- References: <3A1CA5C4.254DC238@albatross.co.nz>
Hi,
On Thu, Nov 23, 2000 at 06:06:12PM +1300, Bryce McKinlay wrote:
> I think it would be useful to have a java file somewhere that defines
> constants which can be used to enable/disable bits of java code at
> compile time. The serialized object dumping facility in
> ObjectInputStream, for example, currently adds a lot of overhead even
> when its turned off, because the java code makes calls into native code
> regardless of whether debugging is enabled or not. By setting a constant
> somewhere, the compiler can optimize it out when not doing a debug
> build.
Does it has to be a compile time constansts?
I would like to be able to have a class library where I could selectively
turn on/off some debugging code at runtime. If we used something like
System.getProperty("gnu.java.io.serialisation.debugging") to set these
constants (you can even do that in an interface) then at runtime the
user could do a -Dgnu.java.io.serialisation.debugging=yes to turn on
the debugging. (It should at least be an option to have these 'constants'
compiled in so they can be set dynamicly at runtime IMHO.)
Cheers,
Mark