Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 12429 invoked from network); 7 Oct 2006 16:55:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Oct 2006 16:55:38 -0000 Received: (qmail 1501 invoked by uid 500); 7 Oct 2006 16:55:37 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 804 invoked by uid 500); 7 Oct 2006 16:55:35 -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 793 invoked by uid 99); 7 Oct 2006 16:55:35 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Oct 2006 09:55:35 -0700 Authentication-Results: idunn.apache.osuosl.org header.from=alexey.v.varlamov@gmail.com; domainkeys=good X-ASF-Spam-Status: No, hits=0.5 required=5.0 tests=DNS_FROM_RFC_ABUSE DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 Received: from [66.249.82.232] ([66.249.82.232:25749] helo=wx-out-0506.google.com) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id E2/75-09076-40CD7254 for ; Sat, 07 Oct 2006 09:55:33 -0700 Received: by wx-out-0506.google.com with SMTP id s13so1239298wxc for ; Sat, 07 Oct 2006 09:55:30 -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=o6f/6wfuXBiCqxG54aYpjqpZJDAzHvp5AEKa8VwVmuvyyXLk7yp13tRYJ59Mwk8zVpMax/Ow/urBD/wW3kavplMZoH0z8OSr19Zl8+ZhCdy6lDTSRW8lhQ9O9nhW2rnPE44qKEohxsGj3B9cU3DLJV2H03ove8E7TxWAzvZl85k= Received: by 10.70.87.5 with SMTP id k5mr7656744wxb; Sat, 07 Oct 2006 09:55:30 -0700 (PDT) Received: by 10.70.23.14 with HTTP; Sat, 7 Oct 2006 09:55:30 -0700 (PDT) Message-ID: Date: Sat, 7 Oct 2006 23:55:30 +0700 From: "Alexey Varlamov" To: harmony-dev@incubator.apache.org, geir@pobox.com Subject: Re: [classlib][lang] AbstractStringBuilder, abstract class? In-Reply-To: <4527C4AC.5060805@pobox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4d0b24970610070751m4b5a0620xb5a7e2a9f8360fca@mail.gmail.com> <4527C4AC.5060805@pobox.com> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 2006/10/7, Geir Magnusson Jr. : > sounds reasonable, but don't go based on my word, of course. > > Interesting question is why AbstractStringBuilder isn't abstract... It does not really matters from implementation POV, and the name was just chosen after the RI - sorta be deeply compatible. But indeed we missed abstract modifier, which is also quite reasonable as a precaution for undocumented exploitation. Let's fix this. > > Andrew Zhang wrote: > > On 2/23/06, Nathan Beyer wrote: > > > >> > >> An interesting side note: The "Serialized Form" documentation gives away > >> an > >> implementation detail of StringBuffer and StringBuilder, in that they > >> both > >> extend from an AbstractStringBuilder. This might be an interesting > >> approach > >> to consolidate those code paths. > > > > > > Spec lies sometimes? The spec of StringBuilder and StringBuffer claim the > > superclass of them is java.lang.Object, but the serialized form tells the > > truth - they extend from java.lang.AbstractStringBuilder, which is not > > public. > > > > I picked up this thread again because I found an existing application > > failed > > against Harmony because of this problem. The scenario is: > > 1. application runs on jdk1.1 > > 2. new instances of some classes. If a class has superclass, then new an > > instance of superclass too if it's not abstract or an interface. The > > pseudo-code looks like: > > newAllInstances(Class clazz) { > > if(clazz == null) return; > > if (clazz is abstract or an interface) return; > > new an instance of clazz; > > newAllInstances(clazz.getSuperClass()); > > } > > > > The test data includes some instances of StringBuffer. The application > > fails > > against Harmony because AbstractStringBuilder is a concrete class but not > > public. The application runs well against sun jdk 1.5 (Although all code > > are > > based on jdk1.1) because the superclass is abstract. > > > > So is it a reason to change the signature of class AbstractStringBuilder? > > Make it as abstract really as the name suggests? > > > > Thanks! > > > > > > > >> [1] > >> > >> http://java.sun.com/j2se/1.5.0/docs/api/serialized-form.html#java.lang.Strin > >> > >> gBuilder > >> [2] > >> > >> http://java.sun.com/j2se/1.5.0/docs/api/serialized-form.html#java.lang.Strin > >> > >> gBuffer > >> > >> > >> -----Original Message----- > >> From: Tim Ellison [mailto:t.p.ellison@gmail.com] > >> Sent: Wednesday, February 22, 2006 3:09 PM > >> To: harmony-dev@incubator.apache.org > >> Subject: Re: [jira] Resolved: (HARMONY-103) java.lang.StringBuilder > >> Implementation for LUNI > >> > >> Nathan, > >> > >> First, let me say a big thank you for the code and tests you submitted. > >> I've had a chance to read through it and (beyond the comments below) it > >> looks good. > >> > >> I've committed a modified version of your patch to SVN. However, ;-) > >> > >> 1. I've removed the javadoc comments as these appear to be direct > >> copies of the Sun documentation. We cannot copy Sun's property. For > >> now the comments have been replaced with TODO tags. > >> > >> 2. I've removed the .intern() from the string literals, since these > >> will be interned by the VM anyway. > >> > >> 3. Why have you got transient char[] and int fields, and then serialize > >> them (as int, char[])? Wouldn't it be easier to reorder the fields and > >> remove the readObject/writeObject methods? > >> > >> Thanks again for your work, > >> Tim > >> > >> > >> Tim Ellison (JIRA) wrote: > >> > [ http://issues.apache.org/jira/browse/HARMONY-103?page=all ] > >> > > >> > Tim Ellison resolved HARMONY-103: > >> > --------------------------------- > >> > > >> > Resolution: Fixed > >> > > >> > Nathan, > >> > > >> > Thanks for the patch, it has been applied (minus javadoc) at repo > >> revision > >> 379882. > >> > > >> > Please check that it has been applied as you expected. > >> > > >> > > >> >> java.lang.StringBuilder Implementation for LUNI > >> >> ----------------------------------------------- > >> >> > >> >> Key: HARMONY-103 > >> >> URL: http://issues.apache.org/jira/browse/HARMONY-103 > >> >> Project: Harmony > >> >> Type: New Feature > >> >> Components: Classlib > >> >> Reporter: Nathan Beyer > >> >> Assignee: Tim Ellison > >> >> Attachments: StringBuilder.java, StringBuilderTest.java > >> >> > >> >> This bug is for submitting an implementation of the > >> java.lang.StringBuilder to the LUNI module of classlib. The > >> implementation > >> and class definition is based on the specification at > >> http://java.sun.com/j2se/1.5.0/docs/api/java/lang/StringBuilder.html. > >> >> The implementation is not complete, there are a few method that are > >> either incomplete or not implemented. All of these are related to the > >> Unicode Code Point support, as defined by Java 5. As for the rest of the > >> implementation, there are probably a number of optimization points, but > >> the > >> focus was to complete the functionality and make it compatible with > >> various > >> Java 5 runtimes. > >> >> Additionally, I had a problem with compiling this class in Eclipse > >> 3.1.2. > >> When I set the compiler to Java 1.4 compliance level, the methods which > >> implement the Appendable interface cause compilation errors. When I set > >> the > >> compiler to Java 5.0 compliance with Java 1.4 .class file compatability > >> and > >> Java 1.4 source compatibility, the class compiled fine. I'm not sure if > >> this > >> is quirk of the JDT compiler or what, but I'm going to do some > >> investigation > >> and testing to see if I can isolate it. > >> > > >> > >> -- > >> > >> 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