/** * Handles the arguments to the before advice. * * @param cv * @param adviceMethodInfo * @param joinPointInstanceIndex */ public void createBeforeAdviceArgumentHandling( final MethodVisitor cv, final AdviceMethodInfo adviceMethodInfo, final int joinPointInstanceIndex) { final String joinPointClassName = adviceMethodInfo.getJoinPointClassName(); final int joinPointIndex = joinPointInstanceIndex; cv.visitFieldInsn( GETSTATIC, joinPointClassName, SIGNATURE_FIELD_NAME, METHOD_SIGNATURE_IMPL_CLASS_SIGNATURE); cv.visitMethodInsn( INVOKEVIRTUAL, METHOD_SIGNATURE_IMPL_CLASS_NAME, GET_METHOD_METHOD_NAME, GET_METHOD_METHOD_SIGNATURE); if (Type.getArgumentTypes(adviceMethodInfo.getCalleeMemberDesc()).length == 0) { cv.visitInsn(ACONST_NULL); } else { cv.visitVarInsn(ALOAD, joinPointIndex); cv.visitMethodInsn( INVOKEVIRTUAL, joinPointClassName, GET_RTTI_METHOD_NAME, GET_RTTI_METHOD_SIGNATURE); cv.visitTypeInsn(CHECKCAST, METHOD_RTTI_IMPL_CLASS_NAME); cv.visitMethodInsn( INVOKEVIRTUAL, METHOD_RTTI_IMPL_CLASS_NAME, GET_PARAMETER_VALUES_METHOD_NAME, GET_ARGUMENTS_METHOD_SIGNATURE); } cv.visitVarInsn(ALOAD, joinPointIndex); cv.visitFieldInsn( GETFIELD, joinPointClassName, CALLEE_INSTANCE_FIELD_NAME, adviceMethodInfo.getCalleeClassSignature()); }
public void createBeforeOrAfterAdviceArgumentHandling( MethodVisitor methodVisitor, CompilerInput compilerInput, Type[] types, AdviceMethodInfo adviceMethodInfo, int i) { if (AdviceType.BEFORE.equals(adviceMethodInfo.getAdviceInfo().getType())) { createBeforeAdviceArgumentHandling( methodVisitor, adviceMethodInfo, compilerInput.joinPointInstanceIndex); } else { // after advice no matter what createAfterAdviceArgumentHandling( methodVisitor, adviceMethodInfo, compilerInput.joinPointInstanceIndex); } }