Skip to main content

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

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


Back to the top