public static InsnList debugMarker ( MarkerType markerType , String text ) { Validate . notNull ( markerType ) ; Validate . notNull ( text ) ; InsnList ret = new InsnList ( ) ; switch ( markerType ) { case NONE : break ; case CONSTANT : ret . add ( new LdcInsnNode ( text ) ) ; ret . add ( new InsnNode ( Opcodes . POP ) ) ; break ; case STDOUT : ret . add ( new FieldInsnNode ( Opcodes . GETSTATIC , "java/lang/System" , "out" , "Ljava/io/PrintStream;" ) ) ; ret . add ( new LdcInsnNode ( text ) ) ; ret . add ( new MethodInsnNode ( Opcodes . INVOKEVIRTUAL , "java/io/PrintStream" , "println" , "(Ljava/lang/String;)V" , false ) ) ; break ; default : throw new IllegalStateException ( ) ; } return ret ; }
Generates instructions for generating marker instructions . These marker instructions are meant to be is useful for debugging instrumented code . For example you can spot a specific portion of instrumented code by looking for specific markers in the assembly output .