diff options
author | Mark Wielaard <mark@klomp.org> | 2004-04-30 19:05:02 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2004-04-30 19:05:02 +0000 |
commit | f40757ff6e5f993b6ada58462acf5b3f02be116e (patch) | |
tree | 520b532e268a418f94bee59feddad55411763d36 | |
parent | fb05588039adc2d1b06f05ea2dc800d78595c23f (diff) | |
download | classpath-f40757ff6e5f993b6ada58462acf5b3f02be116e.tar.gz |
2004-04-30 Grzegorz B. Prokopski <gadek@debian.org>
* java/lang/Object.java (static): Remove static initializer.
* java/lang/Throwable.java (nl): Remove static field.
(StaticData): New private static inner class.
(stackTraceStringBuffer): Use StaticData.nl.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | java/lang/Object.java | 15 | ||||
-rw-r--r-- | java/lang/Throwable.java | 18 |
3 files changed, 26 insertions, 14 deletions
@@ -1,3 +1,10 @@ +2004-04-30 Grzegorz B. Prokopski <gadek@debian.org> + + * java/lang/Object.java (static): Remove static initializer. + * java/lang/Throwable.java (nl): Remove static field. + (StaticData): New private static inner class. + (stackTraceStringBuffer): Use StaticData.nl. + 2004-04-30 Mark Wielaard <mark@klomp.org> Reported by David Holmes diff --git a/java/lang/Object.java b/java/lang/Object.java index 2e1d2a479..5ce7ee80a 100644 --- a/java/lang/Object.java +++ b/java/lang/Object.java @@ -1,5 +1,5 @@ /* java.lang.Object - The universal superclass in Java - Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -64,17 +64,8 @@ public class Object // WARNING: Object is a CORE class in the bootstrap cycle. See the comments // in vm/reference/java/lang/Runtime for implications of this fact. - /** - * Load in all native methods in the java.lang package. Note that this - * call is actually a no-op, since it triggers the class initialization - * of System, which loads the same library; but it is necessary to start - * the System class initialization for the bootstrap sequence to work. - */ - static - { - if (Configuration.INIT_LOAD_LIBRARY) - System.loadLibrary("javalang"); - } + // Many JVMs do not allow for static initializers in this class, + // hence we do not use them in the default implementation. // Some VM's rely on the order that these methods appear when laying // out their internal structure. Therefore, do not haphazardly diff --git a/java/lang/Throwable.java b/java/lang/Throwable.java index 1f236b085..75007a4fc 100644 --- a/java/lang/Throwable.java +++ b/java/lang/Throwable.java @@ -1,5 +1,5 @@ /* java.lang.Throwable -- Root class for all Exceptions and Errors - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -396,7 +396,20 @@ public class Throwable implements Serializable pw.print(stackTraceString()); } - private static final String nl = System.getProperty("line.separator"); + /* + * We use inner class to avoid a static initializer in this basic class. + */ + private static class StaticData + { + + private final static String nl; + + static + { + nl = System.getProperty("line.separator"); + } + } + // Create whole stack trace in a stringbuffer so we don't have to print // it line by line. This prevents printing multiple stack traces from // different threads to get mixed up when written to the same PrintWriter. @@ -449,6 +462,7 @@ public class Throwable implements Serializable private static void stackTraceStringBuffer(StringBuffer sb, String name, StackTraceElement[] stack, int equal) { + String nl = StaticData.nl; // (finish) first line sb.append(name); sb.append(nl); |