[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Strange thing when using a library of abstract aspects
|
Hello,
I have a problem with using a library of abstract aspects in a project.
I would like to understand if this is a bug, because I'm not seeing any
other reason.
Let us suppose we have a project called ProjectA with the following structure:
ProjectA
src
pt.zenida.paulo.common.pointcuts
CommonPointcuts:
public aspect CommonPointcuts {
public final pointcut all() : !none();
public final pointcut none();
}
pt.zenida.paulo.projecta
BaseAspect:
import pt.zenida.paulo.common.pointcuts.*;
public abstract aspect BaseAspect {
public pointcut scope() : !within(BaseAspect+);
public pointcut enableAdvice() : !within(BaseAspect+);
public pointcut excludedPoints() :
CommonPointcuts.none();
public pointcut declareWarningScope() : CommonPointcuts.all();
public final pointcut declareErrorScope() : !declareWarningScope();
public pointcut declareSofteningExceptionScope() : CommonPointcuts.all();
public final pointcut scopeWithExcludedPoints() :
scope() &&
!excludedPoints();
}
EnforceExceptionClassesNamingConventionAspect:
public abstract aspect EnforceExceptionClassesNamingConventionAspect extends
BaseAspect {
public pointcut exceptionClassesCorrectNames() :
within(*Exception);
public final pointcut invalidNamesForExceptionClasses() :
staticinitialization(Exception+) &&
!exceptionClassesCorrectNames();
declare warning : declareWarningScope() &&
invalidNamesForExceptionClasses() &&
scopeWithExcludedPoints() &&
enableAdvice() :
"Exception classes should be suffixed with Exception.";
declare error : declareErrorScope() &&
invalidNamesForExceptionClasses() &&
scopeWithExcludedPoints() &&
enableAdvice() :
"Exception classes should be suffixed with Exception.";
}
ConcreteEnforceExceptionClassesNamingConventionAspect:
public aspect ConcreteEnforceExceptionClassesNamingConventionAspect extends
EnforceExceptionClassesNamingConventionAspect {
public pointcut scope() : within(A) ||
within(pt.zenida.paulo.thesis.test.convention.naming..*);
}
pt.zenida.paulo.projecta.test
MyException (listing 5)
public class MyException extends Exception {
}
MyExceptionWithWrongName (listing 6)
public class MyExceptionWithWrongName extends Exception {
}
The previous works just fine, with the compiler displaying a warning
message for the second class but not for the first one. However, if I
use two projects, creating a jar file with the Abstract aspect which is
included in the classpath of the second project, such as the following,
it issues a warning for both classes:
ProjectA
src
pt.zenida.paulo.common.pointcuts
CommonPointcuts:
(remains unchanged)
pt.zenida.paulo.projecta
BaseAspect:
(remains unchanged)
EnforceExceptionClassesNamingConventionAspect:
(remains unchanged)
ProjectB
src
pt.zenida.paulo.projectb
ConcreteEnforceExceptionClassesNamingConventionAspect:
import pt.zenida.paulo.projecta.EnforceExceptionClassesNamingConventionAspect;
public aspect ConcreteEnforceExceptionClassesNamingConventionAspect extends
EnforceExceptionClassesNamingConventionAspect {
public pointcut scope() : within(pt.zenida.paulo.projectb.test.*);
}
pt.zenida.paulo.projectb.test
MyException:
(remains unchanged)
MyExceptionWithWrongName:
(remains unchanged)
lib
projectA.jar
Any ideas about what this might be? Am I missing something?
Thanks in advance.
Paulo Zenida
----------------------------------------------------------------
Mensagem enviada usando o IMP (Internet Messaging Program).