Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Strange error with parameter annotation

I've also now fixed the other cases - your test program will work fine
with the next dev build.

Andy.

On 25/04/2008, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
> That's a bug, well two bugs.  I've now fixed all except cases 2 and 7
>  in your test program (so I've fixed 5,8,10,11).  2 and 7 are a
>  different issue, completely unrelated to the new parameter annotation
>  matching, they indicate a bug in annotation matching in general when !
>  is used.  I've raised
>  https://bugs.eclipse.org/bugs/show_bug.cgi?id=228980 to track the
>  problem.
>
>  thanks for the cool test program. the fixes will be in the next AJ dev build.
>
>  cheers,
>  Andy.
>
>
>  On 25/04/2008, Manuel Menezes de Sequeira <Manuel.Sequeira@xxxxxxxx> wrote:
>  >
>  >  Hi all!
>  >
>  >  I'm having some problems with parameter annotations. My original idea was
>  > to use
>  >
>  > declare error : execution(* *(@A (!(Object+)), ..)) : "@A annotated value
>  > parameter!" to match executions of methods with an @A annotated,
>  > non-reference typed, first parameter. It did not work, at least with my AJDT
>  > version (Version: 1.5.2.200804241330, AspectJ version:
>  > 1.6.0.20080423100000). I made a few more tests and detected a few more
>  > strange cases (see code below). What am I doing wrong?
>  >
>  >  Regards,
>  >
>  >  Manuel
>  >
>  >  ----- Test.aj -----
>  >
>  >  import java.lang.annotation.ElementType;
>  >  import java.lang.annotation.Retention;
>  >  import java.lang.annotation.RetentionPolicy;
>  >  import java.lang.annotation.Target;
>  >
>  >  public aspect Test {
>  >      // OK (matches f1 and f2):
>  >      declare error : execution(* *(!(Object+), ..)) : "Value parameter.";
>  >
>  >      // Wrong (matches f1 and f2, should match only f1):
>  >      declare error : execution(* *(@A (!(Object+)), ..)) : "@A annotated
>  > value parameter!";
>  >
>  >      // OK (matches f1):
>  >      declare error : execution(* *(@A (*), ..)) && execution(* *(!(Object+),
>  > ..)): "@A annotated value parameter.";
>  >
>  >      // OK (matches f3 and f4):
>  >      declare error : execution(* *(Object+, ..)) : "Reference parameter.";
>  >
>  >      // Wrong (no matches, should match f3):
>  >      declare error : execution(* *(@A (Object+), ..)) : "@A annotated
>  > reference parameter!";
>  >
>  >      // OK (matches f3):
>  >      declare error : execution(* *(@A (*), ..)) && execution(* *(Object+,
>  > ..)): "@A annotated reference parameter.";
>  >
>  >      // Wrong (matches f1 and f2, should match only f2):
>  >      declare error : execution(* *(!@A (!(Object+)), ..)) : "Non-@A
>  > annotated value parameter!";
>  >
>  >      // Wrong (matches f1 and f2, should match only f2):
>  >      declare error : execution(* *(!@A (*), ..)) && execution(*
>  > *(!(Object+), ..)): "Non-@A annotated value parameter.";
>  >
>  >      // OK (matches f2):
>  >      declare error : !execution(* *(@A (*), ..)) && execution(*
>  > *(!(Object+), ..)): "Non-@A annotated value parameter.";
>  >
>  >      // Wrong (matches f3 and f4, should match only f4):
>  >      declare error : execution(* *(!@A (Object+), ..)) : "Non-@A annotated
>  > reference parameter!";
>  >
>  >      // Wrong (matches f3 and f4, should match only f4):
>  >      declare error : execution(* *(!@A (*), ..)) && execution(* *(Object+,
>  > ..)): "Non-@A annotated reference parameter.";
>  >
>  >      // OK (matches f4):
>  >      declare error : !execution(* *(@A (*), ..)) && execution(* *(Object+,
>  > ..)): "Non-@A annotated reference parameter.";
>  >
>  >      void f1(@A int i) {}
>  >
>  >      void f2(int i) {}
>  >
>  >      void f3(@A Integer i) {}
>  >
>  >      void f4(Integer i) {}
>  >
>  >      @Retention(RetentionPolicy.RUNTIME)
>  >      @Target({ElementType.PARAMETER})
>  >      private static @interface A {
>  >
>  >      }
>  >  }
>  >
>  >
>
> > _______________________________________________
>  >  aspectj-users mailing list
>  >  aspectj-users@xxxxxxxxxxx
>  > https://dev.eclipse.org/mailman/listinfo/aspectj-users
>  >
>  >
>  >
>


Back to the top