classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cp-patches] APPROVAL: Merge of java.lang.StringBuilder


From: Andrew John Hughes
Subject: RE: [cp-patches] APPROVAL: Merge of java.lang.StringBuilder
Date: Wed, 19 Jan 2005 10:30:29 +0000

On Wed, 2005-01-19 at 09:09, Jeroen Frijters wrote:
> Andrew John Hughes wrote:
> > Attached is a patch to merge java.lang.StringBuilder (thanks
> > to Tom Tromey) to HEAD.
> 
> I'm still not thrilled about this. If any of the //FIXME methods are
> used (in code compiled against the Sun libraries), it will still not
> work correctly.
> 
Well, I have no problem with removing those all together from the HEAD
patch; they are only for implementing the Appendable interface. 
Generated code gives:

 90: new #124=<Class java.lang.StringBuilder>
 93: dup
 94: ldc #126=<String "c1 = ">
 96: invokespecial #129=<Method java.lang.StringBuilder.<init>
(java.lang.String)void>
 99: aload_1
100: invokevirtual #133=<Method java.lang.StringBuilder.append
(java.lang.Object)java.lang.StringBuilder>
103: ldc #135=<String ", c2 = ">
105: invokevirtual #138=<Method java.lang.StringBuilder.append
(java.lang.String)java.lang.StringBuilder>
108: aload_3
109: invokevirtual #133=<Method java.lang.StringBuilder.append
(java.lang.Object)java.lang.StringBuilder>
112: invokevirtual #142=<Method java.lang.StringBuilder.toString
()java.lang.String>
115: invokevirtual #147=<Method java.io.PrintStream.println
(java.lang.String)void>

from System.out.println("c1 = " + class1 + ", c2 = " + class2);
So for this, we just need the constructor, the basic append methods seen
in StringBuffer, and the interaction with String.

> I general I'm not a fan of turning obvious failure (StringBuilder class
> not found) into more subtle ones (NoSuchMethodError, but only
> occasionally).
> 

Well, code using the append() methods wouldn't compile in either case,
and both would show up in our japi tests. The error message it would
give makes me move towards the idea of removing these altogether, so
that the problem is missing methods rather than the lack of a cast. 
This also solves the pre-compiled binary problem.  As I say, the main
aim of this at present is to support cases where it is merely used as a
supplement for StringBuffer with the 1.4 interface.  

I've attached a new version of the patch that removes these three
methods.

> Regards,
> Jeroen

Thanks,
-- 
Andrew :-)

Please avoid sending me Microsoft Office (e.g. Word, PowerPoint) attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html

No software patents in Europe -- http://nosoftwarepatents.com

"Value your freedom, or you will lose it, teaches history.
`Don't bother us with politics' respond those who don't want to learn."
-- Richard Stallman

"We've all been part of the biggest beta test the world has ever known --
Windows"
-- Victor Wheatman, Gartner

Attachment: stringbuilder.diff
Description: Text Data

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]