[abc-users] Semantics of private member introduction

From: Hossein Sadat-Mohtasham <sadat_at_cs.ualberta.ca>
Date: Tue, 18 Nov 2008 19:51:05 -0700

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
Received on Wed Nov 19 2008 - 02:51:11 GMT

This archive was generated by hypermail 2.2.0 : Wed Nov 19 2008 - 15:10:11 GMT