Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 82180 invoked from network); 5 Jul 2006 03:24:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jul 2006 03:24:41 -0000 Received: (qmail 40991 invoked by uid 500); 5 Jul 2006 03:24:37 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 40927 invoked by uid 500); 5 Jul 2006 03:24:36 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 40903 invoked by uid 99); 5 Jul 2006 03:24:36 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jul 2006 20:24:36 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of mloenko@gmail.com designates 66.249.82.206 as permitted sender) Received: from [66.249.82.206] (HELO wx-out-0102.google.com) (66.249.82.206) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jul 2006 20:24:35 -0700 Received: by wx-out-0102.google.com with SMTP id s6so615903wxc for ; Tue, 04 Jul 2006 20:24:14 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=rinVp3W+ghV3Q7s9tipgGSBbNeQ0Rc5DYdPXkQnkr9CPq6w3TqFyBTIiigrC3H0DgaTmFCJHck3nRPXEtoIGeEzHcLh7Caaq2cdOcBclQk8UnFdBY8vgrdw/XyuJnqp68eGW7VewA2lz7yhsaH2nzOcFgpiku5tXbXshwoxpnuU= Received: by 10.70.128.1 with SMTP id a1mr7978016wxd; Tue, 04 Jul 2006 20:24:14 -0700 (PDT) Received: by 10.70.28.12 with HTTP; Tue, 4 Jul 2006 20:24:14 -0700 (PDT) Message-ID: <906dd82e0607042024u14871f2dq321fbe1a88add7c@mail.gmail.com> Date: Wed, 5 Jul 2006 10:24:14 +0700 From: "Mikhail Loenko" To: harmony-dev@incubator.apache.org Subject: Re: [classlib] compatibility of toString In-Reply-To: <44AB215E.80700@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <2c9597b90606300814s491fba4ar2841e8ae61d198e1@mail.gmail.com> <636fd28e0606301453o6478f51asaeee042a779be43b@mail.gmail.com> <4d0b24970606302343v2b11357re7eca58d98f50a32@mail.gmail.com> <636fd28e0607010009o6a4a3a0av3cf612270f00872d@mail.gmail.com> <4d0b24970607010032u11a8fba4y8305913eea5fb962@mail.gmail.com> <44A8EC74.1030007@gmail.com> <44A939F7.1000102@pobox.com> <44A9CBCB.9080506@gmail.com> <44AA595A.7030804@pobox.com> <44AB215E.80700@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N IIRC Geir was going to ask Sun if we are allowed to copy their exception messages Thanks, Mikhail 2006/7/5, Richard Liang : > > > Geir Magnusson Jr wrote: > > Richard Liang wrote: > > > >> Geir Magnusson Jr wrote: > >> > >>> Tim Ellison wrote: > >>> > >>> > >>>>> > >>>>> > >>>> Yep, if the spec tells you what the format of the string should be then > >>>> follow it (since apps may be dependent upon it), otherwise I'd be > >>>> inclined to invent your own useful string representation. > >>>> > >>>> > >>>> > >>> This idea scares me. I think people do depend on toString() when > >>> writing apps, and tend to shove that kind of thing to log files and such > >>> on server apps. To have our outptut different from Sun's, BEA's, IBM's, > >>> Apple's seens like we're asking for trouble. > >>> > >>> > >>> > >> Hello Geir, > >> > >> IMHO, as long as the method does not give confusing message to > >> developers, we are not required to have the same behavior. You may want > >> to refer to the spec of java.lang.Object.toString: > >> ... > >> In general, the toString method returns a string that "textually > >> represents" this object. The result should be a concise but informative > >> representation that is easy for **a person to read**. > >> ... > >> > > > > Sure, but that doesn't mean that it would be reasonable to randomly > > change the output of a given Class's toString() as long as it would be > > easy for a person to read :) > > > > I know that's not what you are advocating, and I certainly agree that no > > one should depend on toString() output like that, but I also know that > > in production systems *I* have done it, and I'm sure others have as well. > > > > > >> And there are some cases that we even cannot follow RI. > >> e.g., > >> URLConnection conn = new URL("http://www.apache.org").openConnection(); > >> System.out.println(conn.toString()); > >> > >> The code above will print > >> "sun.net.www.protocol.http.HttpURLConnection:http://www.apache.org" > >> > >> Any comments? Thanks a lot. > >> > > > > Well, we could actually print that if that was our impl of URLConnection > > for HTTP, but still, I think > > > > "org.apache.harmony.whatever.HttpURLConnection:http://www.apache.org" > > > > would be more reasonable than > > > > "Implementing Class : org.apache.harmony.whatever.HttpURLConnection, > > Target URI : http://www.apache.org" > > > > or something like that, even thought the second is perfectly good. > > > > All I'm saying is that unless the output from the RI's toString() is > > particularly brain-dead, it doesn't seem to be too much of a bother to > > be similar. > > > > > Agree. And in fact, it's easier to have the same output as RI's if we > are allowed. :-) Could we think this rule also apply to the message when > an exception is thrown? > > Any comments? Thanks a lot. > > Best regards, > Richard > > > Just my $0.02 > > > > geir > > > > > >> Best regards, > >> Richard > >> > >>> geir > >>> > >>> > >>> > >>> > >>> --------------------------------------------------------------------- > >>> Terms of use : http://incubator.apache.org/harmony/mailing.html > >>> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > >>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org > >>> > >>> > >>> > >>> > > > > --------------------------------------------------------------------- > > Terms of use : http://incubator.apache.org/harmony/mailing.html > > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > > For additional commands, e-mail: harmony-dev-help@incubator.apache.org > > > > > > > > -- > Richard Liang > China Software Development Lab, IBM > > > --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org For additional commands, e-mail: harmony-dev-help@incubator.apache.org