[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] declare error

Type patterns don't handle modifiers (like abstract), but otw see 
this pointcut in B.java below:

    // a class initialization join point, of
    // any Cluster subtype except Cluster itself
    staticinitialization(!Cluster && Cluster+)
    // that does not have an annotation
    && !staticinitialization(@DaoLink *) :

Wes

--------------------------------------------------
----------------- $ aspectj-1.5 -1.5 B.java
C:\home\wes\work\src\B.java:4 [error] Annotate concreate Cluster with @DaoLink
static abstract class C implements Cluster { }

        staticinitialization(void B$C.<clinit>())
        see also: C:\home\wes\work\src\B.java:10::0
C:\home\wes\work\src\B.java:5 [error] Annotate concreate Cluster with @DaoLink
static class D extends C { }

        staticinitialization(void B$D.<clinit>())
        see also: C:\home\wes\work\src\B.java:10::0
C:\home\wes\work\src\B.java:8 [error] Annotate concreate Cluster with @DaoLink
static class DD extends C { }

        staticinitialization(void B$DD.<clinit>())
        see also: C:\home\wes\work\src\B.java:10::0

3 errors
----------------- $ cat B.java

public class B {
  interface Cluster {}
  static abstract class C implements Cluster { }
  static class D extends C { }
  @DaoLink // not inherited by CC
  static abstract class CC implements Cluster { }
  static class DD extends CC { }
  static aspect A {
    declare error: staticinitialization(!Cluster && Cluster+)
       && !staticinitialization(@DaoLink *) :
       "Annotate concreate Cluster with @DaoLink";
  }
  @interface DaoLink {}
}
> ------------Original Message------------
> From: FaKod <fakod@xxxxxxxxxxxxxxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Mon, Jun-26-2006 7:36 AM
> Subject: [aspectj-users] declare error
>
> I want to declare an error on non abstract classes of type Cluster 
> without a specific annotation.
> I cannot write something like this: within(!@DaoLink !abstract 
> Cluster+);
> 
> How can i do this?
> 
> 
> 
> 
> I'm using this code:
> 
> ...
>     pointcut clusterWithoutDAOAnno():
>         execution(* *(..)) &&
>         within(!@DaoLink Cluster+);
>    
>     declare error: clusterWithoutDAOAnno():
>         "please use @DaoLink Annotation for Cluster Objects";
> 
> ...
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>