Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #2994
| Date | 2011-04-08 08:59 -0700 |
|---|---|
| From | Patricia Shanahan <pats@acm.org> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Why only public methods on interfaces? |
| References | (2 earlier) <2011040801014026003-angrybaldguy@gmailcom> <5YSdnThYKPSwAgPQnZ2dnUVZ_gydnZ2d@earthlink.com> <KPCdnfEJDvZ0KAPQnZ2dnUVZ_sqdnZ2d@posted.palinacquisition> <XoGdnZ2ah5Y6iQLQnZ2dnUVZ_jednZ2d@earthlink.com> <TcKdnZsfUbuKhALQnZ2dnUVZ_iydnZ2d@posted.palinacquisition> |
| Message-ID | <58-dnYYCMK1urQLQnZ2dnUVZ_gGdnZ2d@earthlink.com> (permalink) |
On 4/8/2011 7:17 AM, Peter Duniho wrote: > On 4/8/11 6:59 AM, Patricia Shanahan wrote: >> [...] >>>> Yes, but then the implementing methods do have to be public, which is >>>> undesirable if they should not be used outside the package. >>> >>> The implementing type doesn't have to be public either. >> >> How do you know that? Of course, implementing the interface does not >> require it to be public, but the class may also be part of the public >> face of the package. > > Since it's an implementation choice, you can just as easily choose to > implement the interface in a non-public class. Yes, it is often possible to work around the public-methods-only limitation, in several different ways, including a non-public inner class object that implements the interface on behalf of its surrounding class. Interfaces would have been even more useful than they are now if it were not necessary to work around the limitation. The really unfortunate decision is not the public methods only, but the decision to make non-specification of access mean public interface method declarations but package access in class method declarations. That cuts off any possibility of changing interfaces now to make them more flexible. Patricia
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Why only public methods on interfaces? kramer31 <kramer.newsreader@gmail.com> - 2011-04-07 17:09 -0700
Re: Why only public methods on interfaces? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-04-07 21:48 -0300
Re: Why only public methods on interfaces? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-04-07 21:01 -0400
Re: Why only public methods on interfaces? v_borchert@despammed.com (Volker Borchert) - 2011-04-08 02:43 +0000
Re: Why only public methods on interfaces? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-04-08 00:24 -0400
Re: Why only public methods on interfaces? Patricia Shanahan <pats@acm.org> - 2011-04-07 21:49 -0700
Re: Why only public methods on interfaces? Owen Jacobson <angrybaldguy@gmail.com> - 2011-04-08 01:01 -0400
Re: Why only public methods on interfaces? Patricia Shanahan <pats@acm.org> - 2011-04-07 22:37 -0700
Re: Why only public methods on interfaces? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-04-08 00:14 -0700
Re: Why only public methods on interfaces? Patricia Shanahan <pats@acm.org> - 2011-04-08 06:59 -0700
Re: Why only public methods on interfaces? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-04-08 07:17 -0700
Re: Why only public methods on interfaces? Patricia Shanahan <pats@acm.org> - 2011-04-08 08:59 -0700
Re: Why only public methods on interfaces? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-04-08 17:27 -0700
Re: Why only public methods on interfaces? "Mike Schilling" <mscottschilling@hotmail.com> - 2011-04-09 22:14 -0700
Re: Why only public methods on interfaces? "Mike Schilling" <mscottschilling@hotmail.com> - 2011-04-09 22:28 -0700
Re: Why only public methods on interfaces? Tom Anderson <twic@urchin.earth.li> - 2011-04-10 16:02 +0100
Re: Why only public methods on interfaces? Roedy Green <see_website@mindprod.com.invalid> - 2011-04-08 03:18 -0700
Re: Why only public methods on interfaces? Esmond Pitt <esmond.pitt@bigpond.com> - 2011-04-08 20:32 +1000
Re: Why only public methods on interfaces? Tom Anderson <twic@urchin.earth.li> - 2011-04-08 20:34 +0100
Re: Why only public methods on interfaces? Tom Anderson <twic@urchin.earth.li> - 2011-04-10 18:10 +0100
csiph-web