public static LineNumberNode findLineNumberForInstruction ( InsnList insnList , AbstractInsnNode insnNode ) { Validate . notNull ( insnList ) ; Validate . notNull ( insnNode ) ; int idx = insnList . indexOf ( insnNode ) ; Validate . isTrue ( idx != - 1 ) ; // Get index of labels and insnNode within method ListIterator < AbstractInsnNode > insnIt = insnList . iterator ( idx ) ; while ( insnIt . hasPrevious ( ) ) { AbstractInsnNode node = insnIt . previous ( ) ; if ( node instanceof LineNumberNode ) { return ( LineNumberNode ) node ; } } return null ; }
Find line number associated with an instruction .