Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 67938 invoked from network); 10 Aug 2006 13:33:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Aug 2006 13:33:33 -0000 Received: (qmail 26543 invoked by uid 500); 10 Aug 2006 13:33:30 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 26506 invoked by uid 500); 10 Aug 2006 13:33:30 -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 26495 invoked by uid 99); 10 Aug 2006 13:33:29 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Aug 2006 06:33:29 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [216.218.240.193] (HELO pogo.kaffe.org) (216.218.240.193) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Aug 2006 06:33:28 -0700 Received: from robilad by pogo.kaffe.org with local (Exim 3.35 #1 (Debian)) id 1GBAkC-0003Ew-00 for ; Thu, 10 Aug 2006 06:38:40 -0700 Date: Thu, 10 Aug 2006 06:38:40 -0700 To: harmony-dev@incubator.apache.org Subject: Re: [general] compatibility packages (was: Re: BASE64Encoder class missing?) Message-ID: <20060810133840.GA7714@pogo.kaffe.org> References: <11f7653a0608091233r8d9e5ffp2a179b3de7b51f3d@mail.gmail.com> <44DA5A68.6050105@pobox.com> <1155162283.2717.39.camel@localhost.localdomain> <44DA8C59.3080805@pobox.com> <636fd28e0608100120s701d9be4pfd964e890da4b22@mail.gmail.com> <44DAF35B.20000@gmail.com> <906dd82e0608100200r28561a33ga2ae65ee5786b87@mail.gmail.com> <44DAFC0E.9080600@gmail.com> <20060810115719.GA32121@pogo.kaffe.org> <44DB2816.3040309@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44DB2816.3040309@gmail.com> User-Agent: Mutt/1.3.28i From: Dalibor Topic X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Thu, Aug 10, 2006 at 01:35:34PM +0100, Tim Ellison wrote: > Dalibor Topic wrote: > > On Thu, Aug 10, 2006 at 10:27:42AM +0100, Tim Ellison wrote: > >> Mikhail Loenko wrote: > >>> The problem is Base64 functionality is unavailable through the > >>> standard API, so people have a choice either use unportable sun.*, > >>> o.a.h.*, etc or create the coder from scratch > >> Understood, I think people are 'driven' to using the non-API types > >> though necessity rather than doing so by mistake. > > > > Hardly. Many replacements for Base64 exists, for example GNU Classpath > > recommends using Apache Commons Codec for projects compatible with the > > Apache license. > > > > Amateur developers use non-standard classes because they are too lazy > > to think for themselves, and accordingly copy broken code around projects. > > Alas, a language designed to appeal to the masses naturally attracts a > > lot of people who'd have trouble producing portable code in any programming > > language. :) > > I was being charitable. For sure many such usages can be easily > avoided, but in other cases no so easily; like CharToByteConverter would > require duplicating a wad of data, and I don't know of any third-party > impl. of Unsafe. Is there something that CharToByteConverter does that CharsetEncoder(ICU) can't? I don't think there is, but I haven't seen code using CharToByteConverter in years. Code using Unsafe, of course, is fundamentally tied to a VM, anyway, thanks to the JVM JSR not being ahead thinking enough to specify an API for low-level operations. It may or may not work depedending on how a VM interprets the non-existent spec for that class, so it is practically useless, unless it is running on the VM it was written on, i.e. Sun's. It may or may not work by chance, rather than by virtue. That holds in general for any code using implementation-specific interfaces. > > We should appeal to app developers to change implementation dependent > code (even provide a recipe book of recommended solutions), but be > pragmatic about the need to run the current version. In many cases it > may be beyond the apps immediate sphere of influence (i.e. dependent > libraries). If everyone responded as quickly and effectively as Martin > we would have no worries. We've been doing that for years. See the GNU Classpath migration page in the Wiki that describes how to fix such broken code in many cases. Being 'pragmatic' solves nothing, it just encourages people to continue behaving in dumb ways, because their code still may run, somehow, even if there is no way for Harmony to ensure that it will behave as they expect from whatever buggy Sun JDK they are using to run it usually in the corner cases, because there is no spec, and there are no tests. Awarding incompetence doesn't solve the problem. That being said, kudos to Martin for fixing the bug in his code. Had we had a Base64 class, that bug wouldn't have showed up, and his code would have failed elsewhere, or behaved differently on another VM. With the fix, his code is portable, behaves in the same way on any VM, and may even be faster than a vm-specific 'just for compatibility' implementation. There is no downside to simply fixing the buggy code. > > On a side note, I seem to recall reading on Sun's javac engineer's blog > > that javac won't allow access to sun internal classes sooner or later, > > so idiot-proofing class libraries may not be very useful, anyway, > > as people will have to rewrite such code, or preferrably, throw it away. > > It will be interesting to see what havoc is unleashed by attempts to > reduce the visibility of sun internal packages by the compiler and at > runtime. I assume it will just cause unmaintained libraries to be substituted by maintained ones, as people trade up to higher quality implementations of functionality they need. Code that uses sun.* classes is a bad smell, to invoke Fowler. If it doesn't get fixed, just get rid of it, and use something else that doesn't stink. cheers, dalibor topic > Regards, > Tim > > -- > > Tim Ellison (t.p.ellison@gmail.com) > IBM Java technology centre, UK. > > --------------------------------------------------------------------- > 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