|
dump application
Creates a text file containing the requested information for each classfile of the
trek. Each output file is created in the directory identified by the op
switch, and is named classname.dmp. If the op switch is
omitted, each output file is created in the current directory.
The command line of the dump application is: base-classes [dump and
common switches]. The one switch defined by the dump
application is:
-inc optionlist
If this switch is omitted, only the declaration statements for classes and members are
output. If this switch is specified, additional information is included in each output
file.
Optionlist can be one or more of the letters a, i,
p, and s. They respectively mean the classfiles attributes,
instructions, constant pool, and source statements. The bytecode offset of each statement
is shown when optionlist includes both s and a,
but not i.
Using -inc s
If only s is specified, the output file may be renamed to .java and
compiled. Note the following though:
- The output file will compile without errors if classname.class
is a correct program. A syntactically correct but semantically incorrect program
may lead to an output file that will compile with errors. For example, assume Xsuper is
Xxx's superclass and that classname.java contains code that
would cause a null pointer exception at runtime:
Xxx xxx = null;
xxx.fld_in_xsuper = 1;
xxx.fld_in_xxx = 2;
Then if xxx.class is not in the input path and classname.class
has no local variables table, classname.class would dump as
follows and the 3rd line would cause a compilation error:
Xsuper xsuper1 = null;
xsuper1.fld_in_xsuper = 1;
xsuper1.fld_in_xxx = 2;
- An output file will show "inefficiencies" in a classfile's instructions. For
example, if var is a byte and you have a statement var++;,
this statement will (compile and) dump as: var = (byte)(var + 1); because
Java is defined to do all non-long integer arithmetic using 32-bit
integers.
|