return;
}
int joinPointHash = AsmHelper.calculateMethodHash(calleeMethodName, calleeMethodDesc);
ClassInfo classInfo = AsmClassInfo.getClassInfo(calleeClassName.replace('/', '.'), m_loader);
MethodInfo calleeMethodInfo = classInfo.getMethod(joinPointHash);
if (calleeMethodInfo == null) {
// lookup in the class hierarchy
ClassInfo superClassInfo = classInfo.getSuperClass();
while (superClassInfo != null) {
calleeMethodInfo = superClassInfo.getMethod(joinPointHash);
if (calleeMethodInfo == null) {
// go up in the hierarchy
superClassInfo = superClassInfo.getSuperClass();
} else {
break;
}
}
if (calleeMethodInfo == null) {
throw new Error(
"callee method info metadata structure could not be build for method: "
+ calleeClassName
+ '.'
+ calleeMethodName
+ ':'
+ calleeMethodDesc
);
}
}
ExpressionContext ctx = new ExpressionContext(PointcutType.CALL, calleeMethodInfo, m_callerMethodInfo);
if (methodFilter(m_ctx.getDefinitions(), ctx, calleeMethodInfo)) {
super.visitMethodInsn(opcode, calleeClassName, calleeMethodName, calleeMethodDesc);
} else {
m_ctx.markAsAdvised();
m_sequence++; // single place of incrementation, is used in multiple places
// TODO is caller class sufficient in the name or do we need callee classname?
String joinPointClassName = JoinPointCompiler.getJoinPointClassName(
m_callerClassName,
JoinPointType.METHOD_CALL,
joinPointHash
);
// load the caller instance (this), or null if in a static context
// note that callee instance [optional] and args are already on the stack
if (Modifier.isStatic(m_callerMethodInfo.getModifiers())) {
visitInsn(ACONST_NULL);
} else {
visitVarInsn(ALOAD, 0);
}
// add the call to the join point
super.visitMethodInsn(
INVOKESTATIC,
joinPointClassName,
INVOKE_METHOD_NAME,
TransformationUtil.getInvokeSignatureForCodeJoinPoints(
calleeMethodInfo.getModifiers(), calleeMethodDesc, m_callerClassName, calleeClassName
)
);
// emit the joinpoint
m_ctx.addEmittedInlinedJoinPoint(
new ContextImpl.EmittedInlinedJoinPoint(
JoinPointType.METHOD_CALL,
m_callerClassName,
m_callerMethodName,
m_callerMethodDesc,
m_callerMethodInfo.getModifiers(),
calleeClassName,
calleeMethodName,
calleeMethodDesc,
calleeMethodInfo.getModifiers(),
m_sequence,
joinPointHash,
joinPointClassName
)
);