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) {
noValueSupplied = true; // matches nothing pointcut
} else {
noValueSupplied = false;
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];
// for (int i = 0, len = bindings.length; i < len; i++) {
// Argument arg = methodDeclaration.arguments[i];
// String name = new String(arg.name);
// UnresolvedType type =
// factory.fromBinding(methodDeclaration.binding.parameters[i]);
// bindings[i] = new FormalBinding(type, name, i, arg.sourceStart,
// arg.sourceEnd, "unknown");
// }
swap(onType, methodDeclaration, pcDecl);
if (pc != null) {
// has an expression
EclipseScope eScope = new EclipseScope(bindings, methodDeclaration.scope);
char[] packageName = null;
if (typeDecl.binding != null && typeDecl.binding.getPackage() != null) {
packageName = typeDecl.binding.getPackage().readableName();
}
eScope.setLimitedImports(packageName);
pc.resolve(eScope);
HasIfPCDVisitor ifFinder = new HasIfPCDVisitor();
pc.traverse(ifFinder, null);
containsIfPcd = ifFinder.containsIfPcd;
}
} catch (ParserException pEx) {
methodDeclaration.scope.problemReporter().parseError(pcLocation[0] + pEx.getLocation().getStart(),
pcLocation[0] + pEx.getLocation().getEnd(), -1, pointcutExpression.toCharArray(), pointcutExpression,