Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] Request for @this()... syntax consideration

Compared to the current @this(@Foo), I prefer the @this(Foo) form. Of course, the same goes for @target(), @args(), and @annotation() forms.

Note that there is no fundamental issue here, just the aesthetics.

Rationale:
1. Since @this() can take only an annotation type as the parameter, @ in front of Foo is redundant. 2. The @ form is used in Java to supply annotations instances. However, the @ form is not used with annotation types on the consumer side (reflection etc.). Basically, annotation types are treated no differently than other types. 3. It makes modifying pointcut to capture context aestehtically less pleasing. Consider the following pointcut in the current form:
   pointcut thisHasFoo() : @this(@Foo);
If now I want to capture the annotation instance, I need to modify the pointcut as follows:
   pointcut thisHasFoo(Foo foo) : @this(foo);

Since Foo is a real type, I can't use "@Foo foo". This means @ is used with Foo depending on where it is specified in the pointcut even through it serves the same purpose in both forms.

-Ramnivas


Back to the top