* For example, the internal representation of <code>java.lang.String</code>
* is <code>java/lang/String</code>.
*
+ * <p>Note that this is a map from <code>String</code> to <code>String</code>.
+ *
* @see #get(Object)
* @see CtClass#replaceClassName(ClassMap)
* @see CtNewMethod#copy(CtMethod,String,CtClass,ClassMap)
import javassist.CtMethod;
/**
- * Simple utility class for printing the instructions of a method.
+ * Simple utility class for printing the bytecode instructions of a method.
*
* @author Jason T. Greene
*/
private final static String opcodes[] = Mnemonic.OPCODE;
private final PrintStream stream;
+ /**
+ * Constructs a <code>InstructionPrinter</code> object.
+ */
public InstructionPrinter(PrintStream stream) {
this.stream = stream;
}
+ /**
+ * Prints the bytecode instructions of a given method.
+ */
public static void print(CtMethod method, PrintStream stream) {
(new InstructionPrinter(stream)).print(method);
}
+ /**
+ * Prints the bytecode instructions of a given method.
+ */
public void print(CtMethod method) {
MethodInfo info = method.getMethodInfo2();
ConstPool pool = info.getConstPool();
}
}
+ /**
+ * Gets a string representation of the bytecode instruction at the specified
+ * position.
+ */
public static String instructionString(CodeIterator iter, int pos, ConstPool pool) {
int opcode = iter.byteAt(pos);
This allows the user to determine the type state of the stack and local variable table
at the start of every instruction. In addition this API can be used to validate
bytecode, find dead bytecode, and identify unnecessary checkcasts.
+Look at <code>Analyzer</code> class first for details.
<p>The users of this package must know the specifications of
class file and Java bytecode. For more details, read this book: