Re: Why only public methods on interfaces?
kramer31 <kramer.newsreader@gmail.com> writes:
For instance, I have an aspect which creates a proxy of a given
interface (which handles transaction propagation). Now in order to
use this aspect, I need an interface (otherwise, no proxy can be
created). However, I have some methods on this class which I would
like to proxy which are public, some are protected, some are package.
Because of this stupid restriction, I have to make all of the methods
public, or do ridiculous things with protection on inner classes.
The problem might not be the interface specification,
but the way interfaces are used by the proxy specification.
A proxy could use several interfaces, one for public methods,
one for private methods. But ?private? to whom?
Privacy is a static aspect, related to the way the source
code is organized into classes and packages. An object does
not have a scope, only lifetime. The compiler checks privacy
at compile time. At runtime, there is no privacy, because
there is no scope (like, e.g., a package). Proxies often are
dynamic entities created at run time. So the whole concept
of privacy might not apply here.
However, the JLS does not define ?aspect? nor ?proxy? IIRC,
so when using these words, you need to give the library
whose dictionary is to be used, when interpreting the words
?aspect? and ?proxy?.