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

Hi Arjun,

That's definitely a bug. I was able to reproduce it with a command-line
compile with AspectJ 1.5.2 too. I'd encourage you to enter it in bugzilla:

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Arjun Singh
Sent: Thursday, July 13, 2006 9:05 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [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.

aspectj-users mailing list