[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] declare error involving volatile field


I have a situation that is similar to the following example:

class A {
   private volatile int state;

   public void foo() {
        state = 0;

aspect FSM {
   declare error: set(* A.state) && !within(FSM): "Changing state
outside aspect";

The modification to the state variable in method foo() does not result
in a compilation error.  However, if I change the type of the state
variable to just int (rather than volatile int), a compilation error
is produced as intended.

As far as I know, it should be possible to use declare error with a
volatile int, as shown above.  Am I mistaken, or am I doing something
wrong?  I am using AJDT 1.4 with Eclipse 3.2.