[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[aspectj-users] ITD public fields break encapsulation?
|
- From: Matthew Adams <matthew@xxxxxxxxxxxxxxx>
- Date: Wed, 26 Aug 2009 07:53:22 -0700
- Delivered-to: aspectj-users@eclipse.org
This may be a FAQ, but when you are doing compile-time weaving and
introduce a field into classes matching your type expression, that
field is public with a mildly obfuscated name, which I assert breaks
encapsulation.
If I introduce an implementation of an interface into classes, I would
prefer that the private fields and methods supporting the public
methods of the interface be non-public in the introduced class.
Otherwise, when the class is used, a client can directly set the
introduced field(s), which should be encapsulated from the client;
they shouldn't even see them.
Is there a way to introduce interface implementations that don't
change the public interface of the introduced class other than simply
adding the "implements" declaration and the implemented methods?
TIA,
Matthew