if (indexes[i][1] != -1)
{
// negative index
if (indexes[i][1] < 0)
{
throw new InvalidAdviceException(
"Negative joinpoint parameter index found at method '" +
method + "'");
}
// wrong index
if (indexes[i][1] >= expectedTypes.length)
{
AdviceMethodFactory.appendNewMatchingMessage(method,
"there is no joinpoint argument with index ");
AdviceMethodFactory.appendMatchingMessage(indexes[i][1]);
AdviceMethodFactory.appendMatchingMessage(", since there are ");
AdviceMethodFactory.appendMatchingMessage(expectedTypes.length == 0? "no": expectedTypes.length);
AdviceMethodFactory.appendMatchingMessage(" joinpoint arguments available");
return false;
}
// wrong type
if (!AssignabilityAlgorithm.VARIABLE_TARGET.isAssignable(
adviceTypes[indexes[i][0]], expectedTypes[indexes[i][1]],
hierarchy))
{
AdviceMethodFactory.appendNewMatchingMessage(method, "advice parameter ");
AdviceMethodFactory.appendMatchingMessage(indexes[i][0]);
AdviceMethodFactory.appendMatchingMessage(", of type '");
AdviceMethodFactory.appendMatchingMessage(adviceTypes[indexes[i][0]]);
AdviceMethodFactory.appendMatchingMessage("', cannot be assigned to the value of joinpoint argument with index ");
AdviceMethodFactory.appendMatchingMessage(indexes[i][1] + ", whose type is '");
AdviceMethodFactory.appendMatchingMessage(expectedTypes[indexes[i][1]]);
AdviceMethodFactory.appendMatchingMessage("'");
return false;
}
// index set more than once
if (taken[indexes[i][1]])
{
throw new InvalidAdviceException(
"Joinpoint parameter index '" + indexes[i][0] +
"' cannot be assigned to more than one " + rule +
"-annotated advice parameter (on " + adviceType +
" advice method '" + method + "')");
}