This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A java DEBUG flag


Mark Wielaard wrote:

> > > If we used something like
> > > System.getProperty("gnu.java.io.serialisation.debugging") to set these
> > > constants (you can even do that in an interface)
> >
> > I don't think so ;-)
>
> What don't you think so?
> What I meant was something like the following:
>
> interface I {
>     boolean SERIALISATION_DEBUG =
>         Boolean.getBoolean("gnu.java.io.serialisation.debugging");
> }

But this is not a constant! It can only be evaluated at runtime. A bytecode
compiler or native compiler like gcj cannot determine the value of the flag, and
must emit a branch. Granted, a smart JIT will be able to take advantage of it
being a final field and eliminate the debug code from what it generates. However,
if it is used extensively in the runtime then it is probable that the flag would
be evaluated before the system property is set, making it useless.

regards

  [ bryce ]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]