[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] initialising instance variables
|
Hi All,
I have tried to intialise the intance variables in a
constructor (I assumed that one was not needed as some
of the examples in the programming guide do not have
one) i.e:
aspect BoundPoint {
private PropertyChangeSupport Point.support = new
PropertyChangeSupport(this);
....
}
Is this becuase the aspect is adding an instance
variable to the class Point, and adds initialisation
of support into the Point constructor?
Here is my problem when I add a constructor:
public abstract aspect LoggingAspect
{
// call depth per logger
protected int callDepth;
// (commons) Log4j logger
protected Log log;
// class unspecified
public abstract pointcut cutClass(Object o);
// pointcuts and advice for intercepting constructor
and
// method calls based on unspecified class
}
public aspect myClassLogger extends LoggingAspect
{
// initialise logger and calldepth
public myClassLogger()
{
callDepth = 2;
log = LogFactory.getLogger
(myClassLogger.class);
}
public pointcut cutClass(Object o) : this(o)
&& within(com.foo.myClass);
// custom logging methods for myClass
}
The compiler complains:
inherited abstract pointcut
LoggingAspect.cutClass(java.lang.Object) is not made
concrete in com.foo.myClassLogger
If I make the instance variables static and add a
static constructor to LoggingAspect, it compiles (and
works) fine.
Cheers,
Aaron.
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com