Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Plans for the next release of AspectJ...

Hi Watanabe,

Your example wouldn't work as a compile-time check: cflow isn't statically resolvable in general, and the compiler doesn't try to solve special cases (it requires declare warning and declare error PCD's to always be statically resolvable). 

Of course, you could write advice that log warnings in these cases during a test (or to raise errors for potential deadlocks, etc.).

Ron 

Ron Bodkin
Chief Technology Officer
New Aspects of Security
m: (415) 509-2895

> ------------Original Message------------
> From: Toru Watanabe <t-watanabe@xxxxxxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Wed, Dec-17-2003 5:25 PM
> Subject: Re: [aspectj-users] Plans for the next release of AspectJ...
> 
> Hi Adrian,
> 
> Thank you for your comments.
> 
> Adrian> you mean 'matches monitor(Object Test.lock)' for the FIELD_PAT, right?
> 
> Yes.
> 
> Adrian> For the contrived example
> 
> Adrian> void foo() {
> Adrian>   Object lock = new Object();
> Adrian>   someoneElse.passLockReference(lock);
> Adrian>   synchronized(lock) {
> Adrian>       // ...
> Adrian>   }
> Adrian> }
> 
> Adrian> you could only ever match on TYPE_PAT, and not FIELD_PAT?
> 
> Right.
> 
> Adrian> I fully understand the value of this for tracing / debugging / instrumenting
> Adrian> multi-threaded applications. I'd be very interested to hear use cases anyone
> Adrian> has for this proposed extension that go beyond such examples.
> 
> I'd also like to use this for assertion of lock order.
> for example, suppose Test.class has two Object for lock, 
> Test{
>  Object lock1 = new Object();
>  Object lock2 = new Object();
> }
> 
> And I need to assert that lock2 must be monitored after monitor lock1, then
> I can write aspect like this.
> 
> declare warning : cflowbelow(monitor(Object Test.lock2)) && monitor(Object Test.lock1) :
>    "Check lock order!"
> 
> Thanks and regards,
> Watanabe
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 


Back to the top