Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Combining annotation parameters and multiple annotations

I think there is one combination you didn't try:

declare @field : @Anno("a") !@Discriminated * * : @Added;

That works :)

Andy

On 9 September 2011 01:24, Zoran Regvart <zregvart+aspectj@xxxxxxxxx> wrote:
> Hi,
> am I missing something, or this would be yet unsupported? I was hoping
> to match by presence of annotation and discriminate against presence
> of another annotation, and with that match on annotation parameters,
> like this:
>
> @Retention(RetentionPolicy.RUNTIME)
> @interface Anno {
>  String value();
> }
>
> @Retention(RetentionPolicy.RUNTIME)
> @interface Discriminate {
> }
>
> @Retention(RetentionPolicy.RUNTIME)
> @interface Added {
> }
>
> class Sample {
>  @Anno("a")
>  String a;
>
>  @Anno("a")
>  @Discriminated
>  String b;
> }
>
> aspect Advice {
>  declare @field : @Anno("a") @!Discriminated * * : @Added; // Syntax
> error on token "!", "name pattern" expected
>  declare @field : @(Anno("a") !Discriminated) * * : @Added; // Syntax
> error on token "(", ")" expected
>  declare @field : @(Anno("a") && !Discriminated) * * : @Added; //
> Syntax error on token "(", ")" expected
> }
>
> could it be that parameters confuse the parser when multiple
> annotations are given?
>
> thanks,
>
> zoran
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top