[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: Re-reverted some static class initializer cleanups
From: |
Mark Wielaard |
Subject: |
FYI: Re-reverted some static class initializer cleanups |
Date: |
Fri, 30 Apr 2004 21:03:42 +0200 |
Hi,
This re-reverts some static class initializer cleanups done by Grzegorz
that got accidentally reverted by Etienne together with some othe CVS
reverts.
2004-04-30 Grzegorz B. Prokopski <address@hidden>
* 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.
Note that the java/lang/reflect/Array.java patch that was in the
original commit was not re-reverted since that static block is currently
actually needed for VMs that use the GNU Classpath provided version for
createObjectArray() from our javalangreflect.so. We probably want to
move this to a VMArray class so a runtime is free to override it when
the want to.
Cheers,
Mark
Index: java/lang/Object.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Object.java,v
retrieving revision 1.17
diff -u -r1.17 Object.java
--- java/lang/Object.java 17 Apr 2004 17:08:22 -0000 1.17
+++ java/lang/Object.java 30 Apr 2004 19:03:07 -0000
@@ -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 @@
// 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
Index: java/lang/Throwable.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Throwable.java,v
retrieving revision 1.22
diff -u -r1.22 Throwable.java
--- java/lang/Throwable.java 23 Apr 2004 21:13:20 -0000 1.22
+++ java/lang/Throwable.java 30 Apr 2004 19:03:07 -0000
@@ -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 @@
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 @@
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);
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: Re-reverted some static class initializer cleanups,
Mark Wielaard <=