[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] initializaton's definition
|
Hi,
I have a aspect like the following:
pointcut typeConstruction():
initialization(as.classifier.Type+.new(..));
after(as.classifier.Type type) returning():
typeConstruction() && target(type) {
xs.school.Types.getInstance().register(type);
}
I find that the advice is executed twice for a subclass (StudyType) of as.classifier.Type. I traced my constructor call stack like the following: (StudyType inherits from AccountabilityType, which inherits from RelationType, which implements Type).
private StudyType(String name, StudyType parent, boolean isAbstract) {
super(name, parent, isAbstract);
}
--> advice is executed here
public AccountabilityType(String name, AccountabilityType parent, boolean isAbstract) {
super(name, parent, isAbstract);
} --> advice is
NOT executed here
public RelationType(String name, RelationType parent, boolean isAbstract) {
super(name, parent, isAbstract);
if (this instanceof AggregationType)
setValidator(
CyclicValidator.getInstance());
}
-- > advice is executed hereShould not the join point for the constructor RelationType be adviced? I want just want the advice is executed on the join point for StudyType constructor. What should I do?
Thanks,
Rice