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

From: Eric Bodden <eric.bodden_at_mail.mcgill.ca>
Date: Wed, 19 Nov 2008 10:04:23 -0500

Hi Hossein.

I cannot confirm this. When compiling your code with the current abc
version then I get the following:

$ java -cp abc-complete.jar abc.main.Main Test.java
Test.java:12: Could not find field or local variable "y".
  y = 2;
  ^

Test.java:24: Could not find field or local variable "x".
  x = 1;
  ^

2 errors.

Which abc version are you using? Are you using the JastAdd frontend by
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/
Received on Wed Nov 19 2008 - 15:04:28 GMT

This archive was generated by hypermail 2.2.0 : Wed Nov 19 2008 - 17:20:12 GMT