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(* *([EMAIL PROTECTED] (!(Object+)), ..)) : "[EMAIL PROTECTED] annotated value parameter!"; // Wrong (matches f1 and f2, should match only f2): declare error : execution(* *([EMAIL PROTECTED] (*), ..)) && execution(* *(!(Object+), ..)): "[EMAIL PROTECTED] annotated value parameter.";
// OK (matches f2):declare error : !execution(* *(@A (*), ..)) && execution(* *(!(Object+), ..)): "[EMAIL PROTECTED] annotated value parameter.";
// Wrong (matches f3 and f4, should match only f4):declare error : execution(* *([EMAIL PROTECTED] (Object+), ..)) : "[EMAIL PROTECTED] annotated reference parameter!"; // Wrong (matches f3 and f4, should match only f4): declare error : execution(* *([EMAIL PROTECTED] (*), ..)) && execution(* *(Object+, ..)): "[EMAIL PROTECTED] annotated reference parameter.";
// OK (matches f4):declare error : !execution(* *(@A (*), ..)) && execution(* *(Object+, ..)): "[EMAIL PROTECTED] 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 {
}
}
begin:vcard fn:Manuel Menezes de Sequeira n:Menezes de Sequeira;Manuel org:ISCTE;DSI adr;quoted-printable:;;Av.=C2=AA das For=C3=A7as Armadas;Lisboa;;1649-026;Portugal email;internet:[EMAIL PROTECTED] tel;work:+351 217903085 tel;fax:+351 217903927 tel;cell:+351 962337428 url:http://iscte.pt/~mms/ version:2.1 end:vcard
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
