Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Style Police (a rant) Date: Mon, 29 Aug 2011 12:10:25 -0700 (PDT) Organization: http://groups.google.com Lines: 34 Message-ID: <0ef6e7bb-e36a-4d0f-98db-45262015f5f0@glegroupsg2000goo.googlegroups.com> References: <36f4953c-f085-4850-85eb-bb248a8cf1bb@glegroupsg2000goo.googlegroups.com> <252cd91f-0695-4cda-8ba0-70cfbc5fbd7a@glegroupsg2000goo.googlegroups.com> <78817664-363f-4e73-99e5-ef3c0a3566af@glegroupsg2000goo.googlegroups.com> <8e9ab8cb-bfff-41f6-a995-5ff570acc683@glegroupsg2000goo.googlegroups.com> Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 108.89.33.208 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1314645026 29443 127.0.0.1 (29 Aug 2011 19:10:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 29 Aug 2011 19:10:26 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=108.89.33.208; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7475 Andreas Leitgeb wrote: > Lew wrote: >> Jan Burse wrote: >>> private methods can be overshadowed. You can try the >>> following code by yourself: >>> class A { >>> private void init() { }; >>> } >>> class B extends A { >>> public void init() { }; >>> } >> The constructor of 'A' still can't call the 'init()' of 'B', >> which is the key point here. > >> In fact, nothing in class 'A' can call the 'init()' of 'B' >> via 'this'; > > Umm... within a C'tor or method of A: > if (this instanceof B) { ((B)this).init(); } ? Good point, if bad code, and I'll include that in the SSCCE I'm planning to make. > Just nitpicking - probably wrong once again, but curious about > the "how": is my interpretation of "via" too general? Is there > a specific meaning of the idiom "calling via" in the JLS? There is no meaning for "calling via" in the JLS of which I'm aware. I was trying to be clear only that I didn't mean via composition. Your corner case is interesting but outside of what I was trying to say. > Btw., that doesn't question the original and main point, anyway. It's a cute corner case. Of course it's bad form to downcast 'this' from a parent class to begin with. -- Lew