Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!news.mixmin.net!news.albasani.net!news.stack.nl!.POSTED!ipv6.urchin.earth.li!twic From: Tom Anderson Newsgroups: comp.lang.java.programmer Subject: Re: Why only public methods on interfaces? Date: Fri, 8 Apr 2011 20:34:14 +0100 Organization: Stack Usenet News Service Lines: 24 Message-ID: References: <25875c94-9af2-4d28-976d-2050a738ae2e@n10g2000yqf.googlegroups.com> NNTP-Posting-Host: ipv6.urchin.earth.li Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: mud.stack.nl 1302291254 51833 2001:ba8:0:1b4::6 (8 Apr 2011 19:34:14 GMT) X-Complaints-To: abuse@stack.nl NNTP-Posting-Date: Fri, 8 Apr 2011 19:34:14 +0000 (UTC) User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) In-Reply-To: <25875c94-9af2-4d28-976d-2050a738ae2e@n10g2000yqf.googlegroups.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2997 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