Re: [abc-users] Semantics of private member introduction

From: Hossein Sadat-Mohtasham <sadat_at_cs.ualberta.ca>
Date: Wed, 19 Nov 2008 18:30:20 -0700

Another problem I noticed is that (using abc-1.3.0 with JastAdd
frontend), "set" pointcut does not pick sets on private members added
by introduction (this is probably the case for get too.) Here is the
case:

/*
  * set pointcut does not pick sets on members added through
introductions.
  *
  */
public class Test {
        
   public static void main(String[] args) {

     Test test = new Test();

     test.foo();

   }
}

aspect Aspect {
        
   private int Test.y = 0;
        
   public void Test.foo() {

          System.out.println("before y = 1!");

          //It's expected that this set be mathced!

          y = 1;
        
          System.out.println("after y = 1!");
   }

   before():set(int Test.*)
   {
          System.out.println("field set!" + thisJoinPoint.toString());
   }
}

In the above example, y = 1 is not matched by the set(int Test.*).

I didn't try this with Polyglot frontend because I've had decided to
work with JastAdd frontend; I also did not try the latest development
version to see if these problems have already been fixed.

It appears to me that the JastAdd front-end is not as stable as
Polyglot front-end yet. So, my concern is that how bad things are with
the JastAdd front-end? I had the impression that introductions aren't
the hardest parts in AspectJ to implement, so it scares me off when it
comes to using a base implementation to experiment new stuff, because
you never easily know for sure if the problem is with your new code or
the existing one.

Please tell me about your experience on this and I appreciate comments
and advice.

Thanks

--Hossein

On 19-Nov-08, at 11:05 AM, Eric Bodden wrote:

> Ah, now I can confirm it. Compiling with...
>
> java -cp abc-ja-complete.jar abc.main.Main -ext abc.ja Test.java
>
> ... indeed causes no errors. I guess somebody should look into this.
>
> Eric
>
> 2008/11/19 Hossein Sadat-Mohtasham <sadat_at_cs.ualberta.ca>:
>> Thanks Eric,
>>>
>>> Which abc version are you using? Are you using the JastAdd
>>> frontend by
>>
>> I'm using the abc-1.3.0 release with JastAdd front-end.
>>
>> --Hossein
>>
>>>
>>> any chance?
>>>
>>> Eric
>>>
>>> 2008/11/18 Hossein Sadat-Mohtasham <sadat_at_cs.ualberta.ca>:
>>>>
>>>> Hi,
>>>> I've had the impression that a private field introduction is only
>>>> visible
>>>> to
>>>> the defining aspect and not the target class. That's what I get in
>>>> AspectJ;
>>>> however, I get no complaint when I access such a field from
>>>> within a
>>>> target
>>>> when compiling using abc-1.3.0.
>>>> Here is an example:
>>>> /*
>>>> *
>>>> * 1) private y should not be visible in Test but it is.
>>>> * 2) private x should not be visible in Aspect, but it is.
>>>> *
>>>> */
>>>> public class Test {
>>>>
>>>> private int x = 0;
>>>>
>>>> public static void main(String[] args) {
>>>> Test test = new Test();
>>>> test.f();
>>>> }
>>>> public void g() {
>>>> y = 2;
>>>> }
>>>> }
>>>> aspect testaspect {
>>>>
>>>> private int Test.y = 0;
>>>>
>>>> public void Test.f() {
>>>> x = 1;
>>>> y = 1;
>>>>
>>>>
>>>>
>>>> g();
>>>>
>>>> }
>>>> }
>>>> I might be mistaken, so let me know if so. I was expecting to get 2
>>>> compile
>>>> errors: one for accessing x in testaspect and the second one for
>>>> accessing y
>>>> in Test. With abc I don't get neither.
>>>> Thanks in advance for your thoughts.
>>>> --Hossein
>>>
>>>
>>>
>>> --
>>> Eric Bodden
>>> Sable Research Group, McGill University, Montréal, Canada
>>> Got an interesting job offer? http://www.bodden.de/hire-me/
>>
>>
>>
>
>
>
> --
> Eric Bodden
> Sable Research Group, McGill University, Montréal, Canada
> Got an interesting job offer? http://www.bodden.de/hire-me/
Received on Thu Nov 20 2008 - 01:30:27 GMT

This archive was generated by hypermail 2.2.0 : Sun Nov 23 2008 - 10:40:12 GMT