How to declare a warning on field with AspectJ

Posted by Ralph on Stack Overflow See other posts from Stack Overflow or by Ralph
Published on 2012-03-22T11:26:29Z Indexed on 2012/03/22 11:29 UTC
Read the original article Hit count: 231

Filed under:

I want to declare a warning on all fields Annotated with @org.jboss.weld.context.ejb.Ejb in AspectJ.

But I do not find a way how to select that field.

I guess the aspect should be something like that:

public aspect WrongEjbAnnotationWarningAspect {
   declare warning :
       within(com.queomedia..*) &&
       ??? (@org.jboss.weld.context.ejb.Ejb)
       : "WrongEjbAnnotationErrorAspect: use javax.ejb.EJB instead of weld Ejb!";
}

Or is it impossible to declare warnings on fields at all?

© Stack Overflow or respective owner

Related posts about java