libgcj/277
Tom Tromey
tromey@cygnus.com
Mon Jul 3 13:30:00 GMT 2000
The following reply was made to PR libgcj/277; it has been noted by GNATS.
From: Tom Tromey <tromey@cygnus.com>
To: Java Gnats Server <java-gnats@sourceware.cygnus.com>
Cc:
Subject: libgcj/277
Date: 03 Jul 2000 14:32:10 -0600
I looked into this a bit more.
Consider the appended Java program.
This runs differently under Sun's JDK 1.2 and gij.
creche. java pw
zardoz has spokenfnord!
23
creche. gij pw
zardoz has spokenfnord!
23fnord!
creche.
I think the fix is to change print() methods in PrintStreamWriter to
call write(String) and not print(String).
If, in the appended program, I change the print method to `write' and
change its implementation to call `super.write' then I get this:
creche. java pw
zardoz has spokenfnord!
23fnord!
creche. gij pw
zardoz has spoken
23
creche.
So, I'm going to submit a fix for this.
Tom
import java.io.*;
public class pw extends PrintWriter
{
public pw (OutputStream o)
{
super (o);
}
public void print (String z)
{
super.print(z);
super.print("fnord!\n");
}
public static void main (String[] args)
{
pw z = new pw (System.out);
z.println ("zardoz has spoken");
z.println (23);
z.flush();
}
}
More information about the Java-prs
mailing list