-
Enhancement
-
Resolution: Fixed
-
P4
-
1.1.1
-
beta
-
generic
-
generic
Name: clC74495 Date: 11/17/98
This enhancement is filed by Java licensee Oracle (#765649).
The debug code happens in many places in the sun/applet package.
For example:
In AppletPanel.java:
...
static boolean debug = false;
...
debug("AppletPanel:CTOR: get list of Jarfiles");
...
static void debug(String s) {
if (debug)
System.err.println("AppletPanel:::" + s);
}
static void debug(String s, Throwable t) {
if (debug) {
debug(s);
}
}
The JVM will call the String functions to assemble the strings and call
the appropriate debug function, REGARDLESS whether the boolean debug
flag is set or not.
The changes would be to test the debug flag first before calling the
debug method.
private static boolean final debug = false;
...
if (debug)
{
debug("AppletPanel:CTOR: get list of Jarfiles");
}
When the debug flag is set to false, since the boolean is defined as
static final, the javac compiler is smart enough not to compile the
debug code block, therefore the String method calls are avoided.
(Review ID: 42910)
======================================================================