Buggy code:
private void deleteNewAndDup ( ) { } private void retargetFrom ( InstructionHandle old , InstructionHandle fresh ) { } protected void prepareForMungers ( ) { } public ShadowRange getRange ( ) { } public void setRange ( ShadowRange range ) { } public int getSourceLine ( ) { } public TypeX getEnclosingType ( ) { } public LazyClassGen getEnclosingClass ( ) { } public BcelWorld getWorld ( ) { } public static BcelShadow makeConstructorExecution ( BcelWorld world , LazyMethodGen enclosingMethod , InstructionHandle justBeforeStart ) { } public static BcelShadow makeStaticInitialization ( BcelWorld world , LazyMethodGen enclosingMethod ) { } public static BcelShadow makeExceptionHandler ( BcelWorld world , ExceptionRange exceptionRange , LazyMethodGen enclosingMethod , InstructionHandle startOfHandler , BcelShadow enclosingShadow ) { } public static BcelShadow makeIfaceInitialization ( BcelWorld world , LazyMethodGen constructor , BcelShadow ifaceCExecShadow , Member interfaceConstructorSignature ) { } public static BcelShadow makeIfaceConstructorExecution ( BcelWorld world , LazyMethodGen constructor , InstructionHandle next , Member interfaceConstructorSignature ) { } public static BcelShadow makeUnfinishedInitialization ( BcelWorld world , LazyMethodGen constructor ) { } public static BcelShadow makeUnfinishedPreinitialization ( BcelWorld world , LazyMethodGen constructor ) { } public static BcelShadow makeMethodExecution ( BcelWorld world , LazyMethodGen enclosingMethod ) { } public static BcelShadow makeShadowForMethod ( BcelWorld world , LazyMethodGen enclosingMethod , Shadow . Kind kind , Member sig ) { } public static BcelShadow makeAdviceExecution ( BcelWorld world , LazyMethodGen enclosingMethod ) { } public static BcelShadow makeConstructorCall ( BcelWorld world , LazyMethodGen enclosingMethod , InstructionHandle callHandle , BcelShadow enclosingShadow ) { } public static BcelShadow makeMethodCall ( BcelWorld world , LazyMethodGen enclosingMethod , InstructionHandle callHandle , BcelShadow enclosingShadow ) { } public static BcelShadow makeShadowForMethodCall ( BcelWorld world , LazyMethodGen enclosingMethod , InstructionHandle callHandle , BcelShadow enclosingShadow , Kind kind , ResolvedMember sig ) { } public static BcelShadow makeFieldGet ( BcelWorld world , LazyMethodGen enclosingMethod , InstructionHandle getHandle , BcelShadow enclosingShadow ) { } public static BcelShadow makeFieldSet ( BcelWorld world , LazyMethodGen enclosingMethod , InstructionHandle setHandle , BcelShadow enclosingShadow ) { } public static void retargetAllBranches ( InstructionHandle from , InstructionHandle to ) { } private ObjectType getTargetBcelType ( ) { } private Type getArgBcelType ( int arg ) { } public boolean terminatesWithReturn ( ) { } public boolean arg0HoldsThis ( ) { } private BcelVar thisVar = null ; private BcelVar targetVar = null ; private BcelVar [ ] argVars = null ; public Var getThisVar ( ) { } public Var getTargetVar ( ) { } public Var getArgVar ( int i ) { } private BcelVar thisJoinPointVar = null ; private BcelVar thisJoinPointStaticPartVar = null ; private BcelVar thisEnclosingJoinPointStaticPartVar = null ; public final Var getThisJoinPointVar ( ) { } public final Var getThisJoinPointStaticPartVar ( ) { } public final Var getThisEnclosingJoinPointStaticPartVar ( ) { } public BcelVar getThisJoinPointBcelVar ( ) { } public BcelVar getThisJoinPointStaticPartBcelVar ( ) { } public BcelVar getThisEnclosingJoinPointStaticPartBcelVar ( ) { } public Member getEnclosingCodeSignature ( ) { } private InstructionList makeArgsObjectArray ( ) { } private void initializeThisVar ( ) { } public void initializeTargetVar ( ) { } public void initializeArgVars ( ) { } public void initializeForAroundClosure ( ) { } void weaveBefore ( BcelAdvice munger ) { } public void weaveAfter ( BcelAdvice munger ) { } public void weaveAfterReturning ( BcelAdvice munger ) { } public void weaveAfterThrowing ( BcelAdvice munger , TypeX catchType ) { } public void weaveSoftener ( BcelAdvice munger , TypeX catchType ) { } public void weavePerObjectEntry ( final BcelAdvice munger , final BcelVar onVar ) { } public void weaveCflowEntry ( final BcelAdvice munger , final Member cflowStackField ) { } public void weaveAroundInline ( BcelAdvice munger , boolean hasDynamicTest ) { Member mungerSig = munger . getSignature ( ) ; ResolvedTypeX declaringType = world . resolve ( mungerSig . getDeclaringType ( ) ) ; <START_BUG> BcelObjectType ot = ( ( BcelObjectType ) ( declaringType ) ) ; <END_BUG> LazyMethodGen adviceMethod = ot . getLazyClassGen ( ) . getLazyMethodGen ( mungerSig ) ; if ( ! ( adviceMethod . getCanInline ( ) ) ) { weaveAroundClosure ( munger , hasDynamicTest ) ; return ; } final InstructionFactory fact = getFactory ( ) ; LazyMethodGen extractedMethod = extractMethod ( NameMangler . aroundCallbackMethodName ( getSignature ( ) , getEnclosingClass ( ) ) ) ; InstructionList advice = new InstructionList ( ) ; InstructionHandle adviceMethodInvocation ; { advice . append ( munger . getAdviceArgSetup ( this , null , new InstructionList ( fact . ACONST_NULL ) ) ) ; adviceMethodInvocation = advice . append ( Utility . createInvoke ( fact , getWorld ( ) , munger . getSignature ( ) ) ) ; advice . append ( Utility . createConversion ( getFactory ( ) , world . makeBcelType ( munger . getSignature ( ) . getReturnType ( ) ) , extractedMethod . getReturnType ( ) ) ) ; if ( ! ( isFallsThrough ( ) ) ) { advice . append ( fact . createReturn ( extractedMethod . getReturnType ( ) ) ) ; } } if ( ! hasDynamicTest ) { range . append ( advice ) ; } else { InstructionList afterThingie = new InstructionList ( fact . NOP ) ; InstructionList callback = makeCallToCallback ( extractedMethod ) ; if ( terminatesWithReturn ( ) ) { callback . append ( fact . createReturn ( extractedMethod . getReturnType ( ) ) ) ; } else { advice . append ( fact . createBranchInstruction ( GOTO , afterThingie . getStart ( ) ) ) ; } range . append ( munger . getTestInstructions ( this , advice . getStart ( ) , callback . getStart ( ) , advice . getStart ( ) ) ) ; range . append ( advice ) ; range . append ( callback ) ; range . append ( afterThingie ) ; } BcelClassWeaver . inlineMethod ( adviceMethod , enclosingMethod , adviceMethodInvocation ) ; String proceedName = NameMangler . proceedMethodName ( munger . getSignature ( ) . getName ( ) ) ;

Fix:
BcelObjectType ot = BcelWorld . getBcelObjectType ( declaringType ) ;