Buggy code:
private final Type [ ] argumentTypes ; private final String [ ] declaredExceptions ; private final InstructionList body ; private final Attribute [ ] attributes ; private final LazyClassGen enclosingClass ; private final BcelMethod memberView ; private int maxLocals ; private boolean canInline = true ; private boolean hasExceptionHandlers ; List matchedShadows ; public ResolvedTypeX definingType = null ; public LazyMethodGen ( int accessFlags , Type returnType , String name , Type [ ] paramTypes , String [ ] declaredExceptions , LazyClassGen enclosingClass ) { } private int calculateMaxLocals ( ) { } public LazyMethodGen ( Method m , LazyClassGen enclosingClass ) { } private void unpackHandlers ( MethodGen gen ) { } private InstructionHandle getOutermostExceptionStart ( InstructionHandle ih ) { } private InstructionHandle getOutermostExceptionEnd ( InstructionHandle ih ) { } private void unpackLineNumbers ( MethodGen gen ) { } private void unpackLocals ( MethodGen gen ) { } public int allocateLocal ( Type type ) { } public int allocateLocal ( int slots ) { } public Method getMethod ( ) { } public String toString ( ) { } public String toShortString ( ) { } public String toLongString ( ) { } public void print ( ) { } public void print ( PrintStream out ) { } private void printAspectAttributes ( PrintStream out ) { } private class BodyPrinter { Map prefixMap = new HashMap ( ) ; Map suffixMap = new HashMap ( ) ; Map labelMap = new HashMap ( ) ; InstructionList body ; PrintStream out ; ConstantPool pool ; List ranges ; BodyPrinter ( PrintStream out ) { } void run ( ) { } void assignLabels ( ) { } void print ( ) { } void printRangeString ( Range r , int depth ) { } String getRangeString ( Range r , Map labelMap ) { } void printDepth ( int depth ) { } void printLabel ( String s , int depth ) { } void printInstruction ( InstructionHandle h , int depth ) { } static final int BODY_INDENT = 4 ; static final int CODE_INDENT = 16 ; void pad ( int size ) { } } static LocalVariableTag getLocalVariableTag ( InstructionHandle ih , int index ) { } static int getLineNumber ( InstructionHandle ih , int prevLine ) { } public boolean isStatic ( ) { } public boolean isAbstract ( ) { } public void addExceptionHandler ( InstructionHandle start , InstructionHandle end , InstructionHandle handlerStart , ObjectType catchType , boolean highPriority ) { } public int getAccessFlags ( ) { } public Type [ ] getArgumentTypes ( ) { } public LazyClassGen getEnclosingClass ( ) { } public int getMaxLocals ( ) { } public String getName ( ) { } public Type getReturnType ( ) { } public void setMaxLocals ( int maxLocals ) { } public InstructionList getBody ( ) { } public boolean hasBody ( ) { } public Attribute [ ] getAttributes ( ) { } public String [ ] getDeclaredExceptions ( ) { } public String getClassName ( ) { } public MethodGen pack ( ) { } public void packBody ( MethodGen gen ) { HashMap map = new HashMap ( ) ; InstructionList fresh = gen . getInstructionList ( ) ; for ( InstructionHandle ih = getBody ( ) . getStart ( ) ; ih != null ; ih = ih . getNext ( ) ) { if ( Range . isRangeHandle ( ih ) ) { continue ; } Instruction i = ih . getInstruction ( ) ; <START_BUG> Instruction c = i . copy ( ) ; <END_BUG> if ( c instanceof BranchInstruction ) map . put ( ih , fresh . append ( ( ( BranchInstruction ) ( c ) ) ) ) ; else map . put ( ih , fresh . append ( c ) ) ; } InstructionHandle ih = getBody ( ) . getStart ( ) ; InstructionHandle jh = fresh . getStart ( ) ; LinkedList exnList = new LinkedList ( ) ; Map localVariableStarts = new HashMap ( ) ; Map localVariableEnds = new HashMap ( ) ; int currLine = - 1 ; while ( ih != null ) { if ( ( map . get ( ih ) ) == null ) { Range r = Range . getRange ( ih ) ; if ( r instanceof ExceptionRange ) { ExceptionRange er = ( ( ExceptionRange ) ( r ) ) ; if ( ( er . getStart ( ) ) == ih ) { if ( ! ( er . isEmpty ( ) ) ) { LazyMethodGen . insertHandler ( er , exnList ) ; } } } else { } ih = ih . getNext ( ) ; } else { Instruction i = ih . getInstruction ( ) ; Instruction j = jh . getInstruction ( ) ; if ( i instanceof BranchInstruction ) { BranchInstruction bi = ( ( BranchInstruction ) ( i ) ) ; BranchInstruction bj = ( ( BranchInstruction ) ( j ) ) ; InstructionHandle itarget = bi . getTarget ( ) ; bj . setTarget ( LazyMethodGen . remap ( itarget , map ) ) ; if ( bi instanceof Select ) { InstructionHandle [ ] itargets = ( ( Select ) ( bi ) ) . getTargets ( ) ; InstructionHandle [ ] jtargets = ( ( Select ) ( bj ) ) . getTargets ( ) ; for ( int k = ( itargets . length ) - 1 ; k >= 0 ; k -- ) { jtargets [ k ] = LazyMethodGen . remap ( itargets [ k ] , map ) ; jtargets [ k ] . addTargeter ( bj ) ; } } } InstructionTargeter [ ] targeters = ih . getTargeters ( ) ; if ( targeters != null ) { for ( int k = ( targeters . length ) - 1 ; k >= 0 ;

Fix:
Instruction c = Utility . copyInstruction ( i ) ;