bug in static initialization

Tom Tromey tromey@redhat.com
Tue Sep 4 10:15:00 GMT 2001


If I compile the appended program with `gcj -C' and then run it via
gij, it prints `null'.  This is clearly wrong.  If I change
`timestampFormat' to be `final', then it works correctly.

I suspect this problem was introduced by some recent changes in gcj.
However I haven't looked to be sure.

Tom

public class sdf
{
  protected static String timestampFormat = "yyyy-MM-dd HH:mm:ss";

  public static void main(String args[])
  {
    System.out.println (timestampFormat);
  }
}



More information about the Java mailing list