I'm trying to add JPA EntityListeners to my Entities via AspectJ. However,
I am either doing something wrong, or I am potentially running into an AJ
bug.
I have the following aspect declaration:
public aspect AutoAuditEventAspect {
declare parents : @Auditable * implements com.ia.persistence.AutoAuditable;
declare @type : @Auditable : @EntityListeners
(com.ia.persistence.AuditEventListener.class);
}
Where @Auditable is my own annotation
and AutoAuditable is an interface with a static Aspect Implementation.
However, when I try to compile my project I get the following error:
[ERROR] error at declare @type : @Auditable :
@EntityListeners(com.ia.persistence.AuditEventListener.class);
[ERROR] ^^^^^^^^^^^^^^
[ERROR]
webapp/src/main/java/com/ia/persistence/AutoAuditEventAspect.aj:9:0::0 The
annotation @EntityListeners is disallowed for this location
[ERROR] error at declare @type : @Auditable :
@EntityListeners(com.ia.persistence.AuditEventListener.class);
[ERROR]
[ERROR]
webapp/src/main/java/com/ia/persistence/AutoAuditEventAspect.aj:9:0::0
Syntax error on token ";", "name pattern" expected
If I try to remove the @Auditable as the <type-pattern> and replace with
"com.ia.domain.*", then it compiles fine.
Am I not allowed to use an annotation as a type specifier when trying to
introduce an annotation to the class type?
Thanks,
Eric
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users