[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-dev] Conflicts when extending abstract aspect
|
I'm having trouble extending an abstract aspect and
hope someone can give me some advice.
I'm packaging an abstract aspect that
provides introduction to a marker interface in a common code base. I extend the abstract aspect with an
empty concrete aspect and it provides introduction correctly within the common
code base.
When I use that common code
base as a jar/library in a new project, I'd like the same
introduction performed on classes that implement the marker interface from the
common jar. I've again, extended the abstract aspect with an empty concrete
aspect, but when I attempt to compile I receive the following:
\patterns\SingletonAspectImpl.java:12:1: public
static SingletonAspectImpl
SingletonAspectImpl.aspectOf() conflicts with
public static SingletonAspect Sing
letonAspect.aspectOf(): defined in same
type
\patterns\SingletonAspectImpl.java:12:1: public
static boolean SingletonAsp
ectImpl.hasAspect() conflicts with public static
boolean SingletonAspect.hasAspe
ct(): defined in same
type
[ajc] [ERROR] public aspect SingletonAspectImpl
extends SingletonAspect
here's my code:
package com.common;
public abstract aspect
SingletonAspect
{
public static Object
(SingletonPattern+).instance=null;
public
(SingletonPattern+).new() { super(); initialize();
}
public
static Object (SingletonPattern+).getInstance()
{
return
instance;
}
after():
staticinitialization(SingletonPattern+)
{
Class
SingletonPattern =
thisJoinPoint.getSignature().getDeclaringType();
try
{
java.lang.reflect.Field theInstance
= SingletonPattern.getField("instance");
Object
singletonObject = SingletonPattern.newInstance();
if
(theInstance.get(null)==null)
{
theInstance.set(null,singletonObject);
}
}
catch (Exception ex)
{
System.err.println("Singleton pattern
failed for "+SingletonPattern.getName()+": "+ex);
};
}
}
// This one compiles without error
package
com.common;
public aspect SingletonAspectImpl extends SingletonAspect
{}
// This one does not compile, with the conflicts
listed above
package com.derivative;
public aspect SingletonAspectImpl
extends SingletonAspect
{}
Can anyone out there
point me to a solution?
Thanks,
-Eric
Simmerman