public void concatenate ( JavaMethod tail ) { CodeAttribute codeAttr = getCode ( ) ; CodeAttribute tailCodeAttr = tail . getCode ( ) ; byte [ ] code = codeAttr . getCode ( ) ; byte [ ] tailCode = tailCodeAttr . getCode ( ) ; int codeLength = code . length ; if ( ( code [ codeLength - 1 ] & 0xff ) == CodeVisitor . RETURN ) codeLength = codeLength - 1 ; byte [ ] newCode = new byte [ codeLength + tailCode . length ] ; System . arraycopy ( code , 0 , newCode , 0 , codeLength ) ; System . arraycopy ( tailCode , 0 , newCode , codeLength , tailCode . length ) ; codeAttr . setCode ( newCode ) ; if ( codeAttr . getMaxStack ( ) < tailCodeAttr . getMaxStack ( ) ) codeAttr . setMaxStack ( tailCodeAttr . getMaxStack ( ) ) ; if ( codeAttr . getMaxLocals ( ) < tailCodeAttr . getMaxLocals ( ) ) codeAttr . setMaxLocals ( tailCodeAttr . getMaxLocals ( ) ) ; ArrayList < CodeAttribute . ExceptionItem > exns = tailCodeAttr . getExceptions ( ) ; for ( int i = 0 ; i < exns . size ( ) ; i ++ ) { CodeAttribute . ExceptionItem exn = exns . get ( i ) ; CodeAttribute . ExceptionItem newExn = new CodeAttribute . ExceptionItem ( ) ; newExn . setType ( exn . getType ( ) ) ; newExn . setStart ( exn . getStart ( ) + codeLength ) ; newExn . setEnd ( exn . getEnd ( ) + codeLength ) ; newExn . setHandler ( exn . getHandler ( ) + codeLength ) ; } }
Concatenates the method .