3232import org .apache .bcel .generic .ConstantPoolGen ;
3333import org .apache .bcel .generic .ConstantPushInstruction ;
3434import org .apache .bcel .generic .EmptyVisitor ;
35+ import org .apache .bcel .generic .INVOKEINTERFACE ;
36+ import org .apache .bcel .generic .INVOKESPECIAL ;
37+ import org .apache .bcel .generic .INVOKESTATIC ;
38+ import org .apache .bcel .generic .INVOKEVIRTUAL ;
3539import org .apache .bcel .generic .Instruction ;
3640import org .apache .bcel .generic .InstructionConstants ;
3741import org .apache .bcel .generic .InstructionHandle ;
38- import org .apache .bcel .generic .InvokeInstruction ;
3942import org .apache .bcel .generic .MethodGen ;
4043import org .apache .bcel .generic .ReturnInstruction ;
4144
@@ -57,7 +60,7 @@ public MethodVisitor(MethodGen m, JavaClass jc) {
5760 mg = m ;
5861 cp = mg .getConstantPool ();
5962 format = "M:" + visitedClass .getClassName () + ":" + mg .getName ()
60- + " " + "%s:%s" ;
63+ + " " + "(%s) %s:%s" ;
6164 }
6265
6366 public void start () {
@@ -80,8 +83,23 @@ private boolean visitInstruction(Instruction i) {
8083 && !(i instanceof ReturnInstruction ));
8184 }
8285
83- /** Method invocation. */
84- public void visitInvokeInstruction (InvokeInstruction i ) {
85- System .out .println (String .format (format ,i .getReferenceType (cp ),i .getMethodName (cp )));
86+ @ Override
87+ public void visitINVOKEVIRTUAL (INVOKEVIRTUAL i ) {
88+ System .out .println (String .format (format ,"M" ,i .getReferenceType (cp ),i .getMethodName (cp )));
89+ }
90+
91+ @ Override
92+ public void visitINVOKEINTERFACE (INVOKEINTERFACE i ) {
93+ System .out .println (String .format (format ,"I" ,i .getReferenceType (cp ),i .getMethodName (cp )));
94+ }
95+
96+ @ Override
97+ public void visitINVOKESPECIAL (INVOKESPECIAL i ) {
98+ System .out .println (String .format (format ,"O" ,i .getReferenceType (cp ),i .getMethodName (cp )));
99+ }
100+
101+ @ Override
102+ public void visitINVOKESTATIC (INVOKESTATIC i ) {
103+ System .out .println (String .format (format ,"S" ,i .getReferenceType (cp ),i .getMethodName (cp )));
86104 }
87105}
0 commit comments