private void buildRecorderFromObject ( int opcode , String owner , String name , String signature , boolean itf ) { super . visitMethodInsn ( opcode , owner , name , signature , itf ) ; // -> stack: ... newobj super . visitInsn ( Opcodes . DUP ) ; // -> stack: ... newobj newobj super . visitInsn ( Opcodes . DUP ) ; // -> stack: ... newobj newobj newobj // We could be instantiating this class or a subclass, so we // have to get the class the hard way. super . visitMethodInsn ( Opcodes . INVOKEVIRTUAL , "java/lang/Object" , "getClass" , "()Ljava/lang/Class;" , false ) ; // -> stack: ... newobj newobj Class super . visitInsn ( Opcodes . SWAP ) ; // -> stack: ... newobj Class newobj super . visitMethodInsn ( Opcodes . INVOKESTATIC , recorderClass , recorderMethod , CLASS_RECORDER_SIG , false ) ; // -> stack: ... newobj }
object then we get the class and invoke the recorder .