Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Server.disabled

Hi.

I think it can only have to do with the scoping rules. If a class
already has a *private* field, this field is only visible from the
scope of this class. An aspect can then declare another field on that
class because lookup is unambiguous: When the aspect accesses that
name it can only be meaning the name of the introduced field because
the other one is not visible anyway. As you say, the objects of that
class will then have two fields.

On the other hand, if the class did declare a public field it would
not be clear which of the fields the aspect would be accessing by that
name. Hence, it's forbidden. There could (and maybe should?) be other
rules one could think of, though, e.g. the inter-type field shadowing
the other one but apparently that's not done.

Eric

On 03/10/2007, Alex Liu <alexliu56@xxxxxxxxx> wrote:
> I got some confusion about inter-type declaration when reviewing the online
> doc from eclipse.
>
> private boolean Server.disabled = false;
> "will not have *name collision* if Server has another private field named
> disabled. Since no reference to disabled will be ambiguous."
> --> is it because this field is private, so shield from other types/aspects
> or it is because of the primitive boolean or else?
>
> here, *no name collison* -> does it mean Server's another disabled and the
> Server.disabled in the aspect are actually two different fields?
>
> public int Point.x = 0;
> "will have error if Point already has a field named x (defined by Point or
> by another aspect)"
> --> why?
>
> Thanks
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


Back to the top