[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Declare error on missing advice
|
Hi,
I need to make a pointcut that matches locations that do not have advice
applied to them.
Some context: I'm working on a large software system for simplifying game
scripting for non-programmers ( http://www.cs.ualberta.ca/~script ). Since
it's designed to be used as a development tool, we need an undo/redo system.
I'm trying to use AspectJ to implement that undo system. I've got some
pointcuts that locate state-changing methods, and the advice is the undo
logic. That all works fine.
What I wanted to do was enforce style guidelines by using the "declare
error/warning" statements that force programmers to implement undo advice
when they write new state-changing methods. To put it to code, what I want
is something along the lines of:
declare error: undefinedModification(): "Undo Aspect: Method in
undo-sensitive class does not have an undo operation defined in Undo.aj.";
where undefinedModification is a pointcut that matches all locations that
are:
1. defined to be undoable by the convention I'm enforcing
2. does not already have advice from the Undo aspect applied to it.
So far, I haven't found any truly similar situations in the mailing list
archives. I have found a feature request
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=292264) which asks for the
ability to use Type Patterns in declare statements, but I don't know if that
would solve my issue or not.
So, to make a very long post short: Can I make a pointcut that matches
locations that do not have advice applied to them? Is this beyond the
capabilities of AspectJ? If so, then will it ever be possible?
Ordinarily I wouldn't try so hard to get this semantic enforced, but since
this software has its primary developer change every 16 months
(undergraduate internships) such restrictions gain incredible value. I think
I can set up a more kludgy solution where it throws a runtime exception, but
we all know it's better to be compile-time when possible.
- Robin Miller
ScriptEase IIP Programmer Analyst
--
View this message in context: http://old.nabble.com/Declare-error-on-missing-advice-tp27797268p27797268.html
Sent from the AspectJ - users mailing list archive at Nabble.com.