I think what you mean on the declare @type is the following.  I don't have
an IDE in front of me right now, but I think you're missing the rest of the
type pattern.  Notice the missing * (highlighted).

 declare @type : @Auditable *:
@EntityListeners(com.ia.persistence.AuditEventListener.class);



On Tue, Mar 11, 2014 at 11:27 AM, Eric B <ebenza...@gmail.com> wrote:

> 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 * implementscom.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
> aspectj-users@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


-- 
mailto:matt...@matthewadams.me <matt...@matthewadams.me>
skype:matthewadams12
googletalk:matt...@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to