return;
}
int joinPointHash = AsmHelper.calculateFieldHash(fieldName, fieldDesc);
ClassInfo classInfo = AsmClassInfo.getClassInfo(className.replace('/', '.'), m_loader);
FieldInfo fieldInfo = classInfo.getField(joinPointHash);
if (fieldInfo == null) {
// lookup in the class hierarchy
ClassInfo superClassInfo = classInfo.getSuperClass();
while (superClassInfo != null) {
fieldInfo = superClassInfo.getField(joinPointHash);
if (fieldInfo == null) {
// go up in the hierarchy
superClassInfo = superClassInfo.getSuperClass();
} else {
break;
}
}
if (fieldInfo == null) {
throw new Error(
"field info metadata structure could not be build for field: "
+ className
+ '.'
+ fieldName
+ ':'
+ fieldDesc
);
}
}
if (opcode == PUTFIELD) {
ExpressionContext ctx = new ExpressionContext(PointcutType.SET, fieldInfo, m_callerMethodInfo);
if (fieldFilter(m_ctx.getDefinitions(), ctx, fieldInfo)) {
super.visitFieldInsn(opcode, className, fieldName, fieldDesc);
} else {
m_ctx.markAsAdvised();
m_sequence++; // single place of incrementation, is used in multiple places
String joinPointClassName = JoinPointCompiler.getJoinPointClassName(
m_callerClassName,
JoinPointType.FIELD_SET,
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,
AsmHelper.getInvokeSignatureForFieldJoinPoints(
fieldInfo.getModifiers(), fieldDesc, m_callerClassName, className
)
);
// emit the joinpoint
m_ctx.addEmittedInlinedJoinPoint(
new ContextImpl.EmittedInlinedJoinPoint(
JoinPointType.FIELD_SET,
m_callerClassName,
m_callerMethodName,
m_callerMethodDesc,
m_callerMethodInfo.getModifiers(),
className,
fieldName,
fieldDesc,
fieldInfo.getModifiers(),
m_sequence,
joinPointHash,
joinPointClassName
)
);