Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] declare parents syntax

Wes,

This is not even a workaround and don't help much for LTW. Instead of raising errors on typos, I much prefer to not make typos at the first place.

Also reversing pointcut matching on newly introduced type look really like an unnecessary twist to me, because the match should happen on selected classes and not on the introduced type. I hope you can see the logical difference between those cases.

 regards,
 Eugene


Wes Isberg wrote:
Just remember that
  within(XyzType+)

can pick out subtypes outside com.xyz..* that extend
a type in com.xyz..*

You can name the pointcut to reuse it:

  pointcut inScope() : within(com.xyz..*);

then
  before(): something() && inScope() {..}

To address the problem of typo's (i.e., redundancy across
type patterns and pointcuts), try something like

  declare parents : com.xyz..* : implements X;

  declare warning : staticinitialization(X+)
     && !inScope() : "X not in scope";

The latter would also pick out those types not in
com.xyz..*
i.e., the subtypes outside the package.

Wes



Back to the top