Skip to main content

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

Well argued. In the absence of other arguments, I support Ramnivas' proposal...

Cheers,

Nicholas Lesiecki
Software Craftsman, specializing in J2EE,
Agile Methods, and aspect-oriented programming
m: 520 591-1849

Books:
* Mastering AspectJ: http://tinyurl.com/66vf
* Java Tools for Extreme Programming: http://tinyurl.com/66vt

Articles on AspectJ:
* http://tinyurl.com/66vu and http://tinyurl.com/66vv
On Jan 27, 2005, at 12:52 PM, Ramnivas Laddad wrote:

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
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev




Back to the top