methodHash, joinPointType, PointcutType.CALL, joinPointInfo,
declaringClass, m_targetClass, targetInstance, targetInstance
);
}
JoinPoint joinPoint = joinPointInfo.joinPoint;
// if null or redefined -> create a new join point and cache it
if (joinPoint == null) {
Map pointcutTypeToAdvicesMap = s_registry.getAdvicesForJoinPoint(m_classHash, methodHash);
AdviceContainer[] adviceIndexes = null;
switch (joinPointType) {
case JoinPointType.METHOD_CALL:
adviceIndexes = (AdviceContainer[])pointcutTypeToAdvicesMap.get(PointcutType.CALL);
// TODO: make diff between target and this instances
joinPoint = createMethodJoinPoint(
methodHash, joinPointType, declaringClass, adviceIndexes, targetInstance, targetInstance
);
break;
case JoinPointType.CONSTRUCTOR_CALL:
adviceIndexes = (AdviceContainer[])pointcutTypeToAdvicesMap.get(PointcutType.CALL);
// TODO: make diff between target and this instances
joinPoint = createConstructorJoinPoint(
methodHash, joinPointType, declaringClass, adviceIndexes, targetInstance, targetInstance
);
break;
default:
throw new RuntimeException("join point type not valid");
}
// set the join point
joinPointInfo.joinPoint = joinPoint;
// update the state
if (adviceIndexes.length == 0) {
joinPointInfo.state = JoinPointState.ADVISED;
}
else {
joinPointInfo.state = JoinPointState.HAS_ADVICES;
}
}
((JoinPointBase)joinPoint).setTargetInstance(targetInstance);
if (parameters != null) {
((CodeRtti)joinPoint.getRtti()).setParameterValues(parameters);
}
return ((JoinPointBase)joinPoint).proceed();
}