private MethodByConInfo doResolveConstructorCallerMethodInfo(Class<?> callingClass, int callingIndex, String calledClass, long calledMethodHash)
{
try
{
Constructor<?> callingConstructor = constructors[callingIndex];
if (callingConstructor == null) throw new RuntimeException("Unable to figure out calling method of a caller pointcut");
Class<?> called = SecurityActions.getClassLoader(callingClass).loadClass(calledClass);
Method calledMethod = MethodHashing.findMethodByHash(called, calledMethodHash);
if (calledMethod == null) throw new RuntimeException("Unable to figure out calledmethod of a caller pointcut");
boolean matched = false;
ClassifiedBindingAndPointcutCollection bindingCol = manager.getBindingCollection();
for (AdviceBinding binding : bindingCol.getConstructorCallBindings())
{
if (binding.getPointcut().matchesCall(this, callingConstructor, called, calledMethod))
{
addConstructorCallerPointcut(callingIndex, calledClass, calledMethodHash, binding);
matched = true;
}
}
if (!matched) initializeEmptyConstructorCallerChain(callingIndex, calledClass, calledMethodHash);
MethodByConInfo info = initializeConstructorCallerInterceptorsMap(callingClass, callingIndex, calledClass, calledMethodHash, calledMethod);
ArrayList<AdviceBinding> bindings = getConstructorCallerBindings(callingIndex, calledClass, calledMethodHash);
bindConstructorCallerInterceptorChain(bindings, callingIndex, calledClass, calledMethodHash);
return info;
}
catch (Exception x)
{
throw new RuntimeException(x);
}
}