Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: getting 'around' constructor execution

oops forgot the pointcut declaration :

pointcut constructor(A instance, Type arg):
		execution (A.new (Type))
		&& this(instance)
		&& args(arg);


the class to be woven is something like
public class A {
  private Type var1;
  public A(Type arg) {
     super(arg);
     var1=arg;
  }
}

the actual goal is to replace the constructor so that 'super(arg)' is not called.

as before, all help much appreciated.

danny wrote:
the advice -I just want to see if I enter the advice for now- :
A around(A instance, Type arg): constructor(instance, arg) {
  System.out.println("advice A constructor");
return instance ();
}

I get the following error when weaving :
[WeavingURLClassLoader] error at.......incompatible return type applying to constructor-execution(void A.<init>(Type))

I've tried some other constructs, this is the only one I actually trigger something, all other don't even try to weave :(

What do do ?
All help appreciated

Danny



Back to the top