This is the mail archive of the
java-prs@sourceware.cygnus.com
mailing list for the Java project.
libgcj/277
- To: tromey at cygnus dot com
- Subject: libgcj/277
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 3 Jul 2000 20:30:01 -0000
- Cc: java-prs at sourceware dot cygnus dot com,
- Reply-To: Tom Tromey <tromey at cygnus dot com>
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();
}
}