hasAtAspectJAnnotation = hasAtAspectJAnnotation || handleAroundAnnotation(rvs, struct, preResolvedPointcut);
// there can only be one RuntimeVisible bytecode attribute
break;
}
} catch (ReturningFormalNotDeclaredInAdviceSignatureException e) {
msgHandler.handleMessage(new Message(WeaverMessages.format(WeaverMessages.RETURNING_FORMAL_NOT_DECLARED_IN_ADVICE,
e.getFormalName()), IMessage.ERROR, null, bMethod.getSourceLocation()));
} catch (ThrownFormalNotDeclaredInAdviceSignatureException e) {
msgHandler.handleMessage(new Message(WeaverMessages.format(WeaverMessages.THROWN_FORMAL_NOT_DECLARED_IN_ADVICE,
e.getFormalName()), IMessage.ERROR, null, bMethod.getSourceLocation()));
}
}
hasAtAspectJAnnotation = hasAtAspectJAnnotation || hasAtAspectJAnnotationMustReturnVoid;
// semantic check - must be in an @Aspect [remove if previous block
// bypassed in advance]
if (hasAtAspectJAnnotation && !type.isAspect()) { // isAnnotationStyleAspect())
// {
msgHandler.handleMessage(new Message("Found @AspectJ annotations in a non @Aspect type '" + type.getName() + "'",
IMessage.WARNING, null, type.getSourceLocation()));
// go ahead
}
// semantic check - advice must be public
if (hasAtAspectJAnnotation && !struct.method.isPublic()) {
msgHandler.handleMessage(new Message("Found @AspectJ annotation on a non public advice '"
+ methodToString(struct.method) + "'", IMessage.ERROR, null, type.getSourceLocation()));
// go ahead
}
// semantic check - advice must not be static
if (hasAtAspectJAnnotation && struct.method.isStatic()) {
msgHandler.handleMessage(MessageUtil.error("Advice cannot be declared static '" + methodToString(struct.method) + "'",
type.getSourceLocation()));
// new Message(
// "Advice cannot be declared static '" +
// methodToString(struct.method) + "'",
// IMessage.ERROR,
// null,
// type.getSourceLocation()
// )
// );
// go ahead
}
// semantic check for non around advice must return void
if (hasAtAspectJAnnotationMustReturnVoid && !Type.VOID.equals(struct.method.getReturnType())) {
msgHandler.handleMessage(new Message("Found @AspectJ annotation on a non around advice not returning void '"
+ methodToString(struct.method) + "'", IMessage.ERROR, null, type.getSourceLocation()));
// go ahead
}
return struct.ajAttributes;