Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Need advice on how to craft a pointcut ... a real challenge :)

Pavlovich, Peter schrieb:
> I need to craft a pointcut to identify code which does not adhere to a 
> specific design pattern. Here is the pattern:

Hello Peter,

to my understanding, what you want to achieve isn't possible at compile
time, at least with the capabilities of AspectJ or similar current systems.
You would need a real meta-language doing some derivations at compile time.
I hope something of this sort will appear somewhere in the next years, given
the new discoveries and possibilities we more or less all explored in the last
years with pointcuts, annotations and metadata, IoC and template
metaprogramming (C++).

I faced similar requirements several times, often more in conjunction
with visitor-like constructs. You can solve them if you accept a
runtime check, making the unwanted calls at least assert immediately.
Because, at runtime it's trivial to check for the absence of a token
or sentinel. AspectJ is very helpful with this sort of tasks, because
the poincut (sub)-language is quite concise and declarative. Then you'd
combine this with a unit test policy assuring coverage.

Cheers,
Hermann





Back to the top