This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

type of ClassLoader


The new interpreter has two methods of ClassLoader as static,
when the spec specifies them as non-static.  A comment says
"any objections?  This allows us to call it directly from native
code with less hassle.".  Yes, I object.  I'm afraid this is
not an option we have - it breaks both source and binary compatibility.

Here is my suggested fix.  I haven't sent in the needed paperwork yet,
but I think this qualifies as "obvious" and "small".

Index: java/lang/ClassLoader.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/ClassLoader.java,v
retrieving revision 1.2
diff -u -r1.2 ClassLoader.java
--- ClassLoader.java	1999/08/08 14:06:22	1.2
+++ ClassLoader.java	1999/08/09 05:49:22
@@ -23,10 +23,6 @@
  * @author  Kresten Krab Thorup
  */
 
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * Status: Just a stub; not useful at all.
- */
-
 public abstract class ClassLoader {
 
   static private ClassLoader system;
@@ -225,16 +221,17 @@
    * For historical reasons, this method has a name which is easily
    * misunderstood.  Java classes are never ``resolved''.  Classes are
    * linked; whereas method and field references are resolved.
-   * <P>
-   * FIXME: The JDK documentation declares this method
-   * <code>final</code>, we declare it <code>static</code> -- any
-   * objections?  This allows us to call it directly from native code
-   * with less hassle. 
    *
    * @param     clazz the class to link.
    * @exception java.lang.LinkageError
    */
-  protected static void resolveClass(Class clazz)
+  protected final void resolveClass(Class clazz)
+    throws java.lang.LinkageError
+  {
+    resolveClass0(clazz);
+  }
+
+  static void resolveClass0(Class clazz)
     throws java.lang.LinkageError
   {
     synchronized (clazz)
@@ -273,7 +270,7 @@
    * @exception java.lang.LinkageError 
    * @exception java.lang.ClassNotFoundException 
    */
-  protected native static Class findSystemClass(String name) 
+  protected native Class findSystemClass(String name) 
     throws java.lang.ClassNotFoundException, java.lang.LinkageError;
 
   /*
Index: java/lang/natClass.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/natClass.cc,v
retrieving revision 1.2
diff -u -r1.2 natClass.cc
--- natClass.cc	1999/08/08 14:06:22	1.2
+++ natClass.cc	1999/08/09 05:49:23
@@ -398,7 +398,7 @@
 #ifdef INTERPRETER
       if (_Jv_IsInterpretedClass (this))
 	{
-	  java::lang::ClassLoader::resolveClass (this);
+	  java::lang::ClassLoader::resolveClass0 (this);
 
 	  // Step 1.
 	  _Jv_MonitorEnter (this);
Index: resolve.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/resolve.cc,v
retrieving revision 1.1
diff -u -r1.1 resolve.cc
--- resolve.cc	1999/08/08 14:06:20	1.1
+++ resolve.cc	1999/08/09 05:49:24
@@ -488,7 +488,7 @@
   // the super class, so we use the Java method resolveClass, which will
   // unlock it properly, should an exception happen.
 
-  java::lang::ClassLoader::resolveClass (klass->superclass);
+  java::lang::ClassLoader::resolveClass0 (klass->superclass);
 
   _Jv_InterpClass *clz = (_Jv_InterpClass*)klass;
 
-- 
	--Per Bothner
bothner@pacbell.net  per@bothner.com   http://home.pacbell.net/bothner/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]