Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Steven Simpson Newsgroups: comp.lang.java.programmer Subject: Re: generics puzzle Date: Mon, 17 Oct 2011 16:26:59 +0100 Organization: Aioe.org NNTP Server Lines: 35 Message-ID: <33utm8-qs4.ln1@news.simpsonst.f2s.com> References: <9g2f24Fi0vU1@mid.individual.net> NNTP-Posting-Host: 5D2fxXki9h+eqFzMnlXg4g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Lightning/1.0b2 Thunderbird/3.1.15 X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8918 On 17/10/11 15:33, markspace wrote: > On 10/17/2011 5:14 AM, Steven Simpson wrote: >> On 17/10/11 11:41, blmblm@myrealbox.com wrote: >>> One fix is to just introduce a method setFromModified() in GThing, >>> but that doesn't appeal to me. >> >> Instead of adding it to GThing, create a static method: >> >> private static void setModified(GThing t) { >> t.set(t.modified()); >> } > > > I don't like the T here. While it compiles, this T is a different T > than the other T. Ah, T time! ;-) > public class GThing { > > private static void setModified( GThing t ) { > > ...other T's stay the same. > } I meant that the static method didn't belong in GThing at all. The author of the call site factors it out of his code, and keeps it near the call site, in order to deal with an issue that arises very specifically out of the design of that site. Ideally, it would be an Ada-like local method, but he has to settle for a near-by static. The author of GThing is unaware of it, and is not responsible for it. -- ss at comp dot lancs dot ac dot uk