}
return null;
}
private void convertToPointcutDeclaration(MethodDeclaration methodDeclaration, ClassScope scope) {
TypeDeclaration typeDecl = (TypeDeclaration) typeStack.peek();
if (typeDecl.binding != null) {
if (!typeDecl.binding.isClass()) {
methodDeclaration.scope.problemReporter()
.signalError(methodDeclaration.sourceStart,methodDeclaration.sourceEnd,"pointcuts can only be declared in a class or an aspect");
}
}
if (methodDeclaration.thrownExceptions != null && methodDeclaration.thrownExceptions.length > 0) {
methodDeclaration.scope.problemReporter()
.signalError(methodDeclaration.sourceStart,methodDeclaration.sourceEnd,"pointcuts cannot throw exceptions!");
}
PointcutDeclaration pcDecl = new PointcutDeclaration(unit.compilationResult);
copyAllFields(methodDeclaration,pcDecl);
if (ajAnnotations.hasAdviceAnnotation) {
methodDeclaration.scope.problemReporter().disallowedTargetForAnnotation(ajAnnotations.adviceAnnotation);
}
if (ajAnnotations.hasAspectAnnotation) {
methodDeclaration.scope.problemReporter().disallowedTargetForAnnotation(ajAnnotations.aspectAnnotation);
}
if (ajAnnotations.hasAdviceNameAnnotation) {
methodDeclaration.scope.problemReporter().disallowedTargetForAnnotation(ajAnnotations.adviceNameAnnotation);
}
boolean containsIfPcd = false;
int[] pcLocation = new int[2];
String pointcutExpression = getStringLiteralFor("value",ajAnnotations.pointcutAnnotation,pcLocation);
try {
ISourceContext context = new EclipseSourceContext(unit.compilationResult,pcLocation[0]);
Pointcut pc = null;//abstract
if (pointcutExpression == null || pointcutExpression.length() == 0) {
;//will have to ensure abstract ()V method
} else {
pc = new PatternParser(pointcutExpression,context).parsePointcut();
}
pcDecl.pointcutDesignator = (pc==null)?null:new PointcutDesignator(pc);
pcDecl.setGenerateSyntheticPointcutMethod();
TypeDeclaration onType = (TypeDeclaration) typeStack.peek();
pcDecl.postParse(onType);
// EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(methodDeclaration.scope);
// int argsLength = methodDeclaration.arguments == null ? 0 : methodDeclaration.arguments.length;
FormalBinding[] bindings = buildFormalAdviceBindingsFrom(methodDeclaration);
// FormalBinding[] bindings = new FormalBinding[argsLength];