// ResolvedPointcutDefinition
// preResolvedPointcut)
// {
AnnotationGen decp = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREPARENTS_ANNOTATION);
if (decp != null) {
NameValuePair decpPatternNVP = getAnnotationElement(decp, VALUE);
String decpPattern = decpPatternNVP.getValue().stringifyValue();
if (decpPattern != null) {
TypePattern typePattern = parseTypePattern(decpPattern, struct);
ResolvedType fieldType = UnresolvedType.forSignature(struct.field.getSignature()).resolve(
struct.enclosingType.getWorld());
if (fieldType.isInterface()) {
TypePattern parent = parseTypePattern(fieldType.getName(), struct);
FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);
// first add the declare implements like
List<TypePattern> parents = new ArrayList<TypePattern>(1);
parents.add(parent);
DeclareParents dp = new DeclareParents(typePattern, parents, false);
dp.resolve(binding); // resolves the parent and child parts
// of the decp
// resolve this so that we can use it for the
// MethodDelegateMungers below.
// eg. '@Coloured *' will change from a WildTypePattern to
// an 'AnyWithAnnotationTypePattern' after this
// resolution
typePattern = typePattern.resolveBindings(binding, Bindings.NONE, false, false);
// TODO kick ISourceLocation sl =
// struct.bField.getSourceLocation(); ??
// dp.setLocation(dp.getDeclaringType().getSourceContext(),
// dp.getDeclaringType().getSourceLocation().getOffset(),
// dp.getDeclaringType().getSourceLocation().getOffset());
dp.setLocation(struct.context, -1, -1); // not ideal...
struct.ajAttributes.add(new AjAttribute.DeclareAttribute(dp));
// do we have a defaultImpl=xxx.class (ie implementation)
String defaultImplClassName = null;
NameValuePair defaultImplNVP = getAnnotationElement(decp, "defaultImpl");
if (defaultImplNVP != null) {
ClassElementValue defaultImpl = (ClassElementValue) defaultImplNVP.getValue();
defaultImplClassName = UnresolvedType.forSignature(defaultImpl.getClassString()).getName();
if (defaultImplClassName.equals("org.aspectj.lang.annotation.DeclareParents")) {
defaultImplClassName = null;
} else {
// check public no arg ctor