OSDN Git Service

* java/lang/Class.h (_Jv_CopyClassesToSystemLoader): Updated.
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 4 Jan 2006 17:59:40 +0000 (17:59 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 4 Jan 2006 17:59:40 +0000 (17:59 +0000)
* java/lang/natClassLoader.cc (_Jv_CopyClassesToSystemLoader):
Changed argument type.  Use SystemClassLoader.addClass.
* gnu/gcj/runtime/SystemClassLoader.java (addClass): New method.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109340 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/gnu/gcj/runtime/SystemClassLoader.java
libjava/java/lang/Class.h
libjava/java/lang/natClassLoader.cc

index 5f1b05a..97c6284 100644 (file)
@@ -1,3 +1,10 @@
+2006-01-04  Tom Tromey  <tromey@redhat.com>
+
+       * java/lang/Class.h (_Jv_CopyClassesToSystemLoader): Updated.
+       * java/lang/natClassLoader.cc (_Jv_CopyClassesToSystemLoader):
+       Changed argument type.  Use SystemClassLoader.addClass.
+       * gnu/gcj/runtime/SystemClassLoader.java (addClass): New method.
+
 2005-12-24  David Daney <ddaney@avtrex.com>
            Tom Tromey  <tromey@redhat.com>
 
index 1bb5ef9..efd3323 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005  Free Software Foundation
+/* Copyright (C) 2005, 2006  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -21,6 +21,25 @@ public final class SystemClassLoader extends URLClassLoader
     super(new URL[0], parent);
   }
 
+  // This is called to register a native class which was linked into
+  // the application but which is registered with the system class
+  // loader after the VM is initialized.
+  void addClass(Class klass)
+  {
+    String packageName = null;
+    String className = klass.getName();
+    int lastDot = className.lastIndexOf('.');
+    if (lastDot != -1)
+      packageName = className.substring(0, lastDot);
+    if (packageName != null && getPackage(packageName) == null)
+      {
+       // Should have some way to store this information in a
+       // precompiled manifest.
+       definePackage(packageName, null, null, null, null, null, null, null);
+      }
+    loadedClasses.put(className, klass);
+  }
+
   // We add the URLs to the system class loader late.  The reason for
   // this is that during bootstrap we don't want to parse URLs or
   // create URL connections, since that will result in circularities
index a2ec357..1c14df3 100644 (file)
@@ -1,6 +1,6 @@
 // Class.h - Header file for java.lang.Class.  -*- c++ -*-
 
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -22,6 +22,21 @@ details.  */
 #include <java/security/ProtectionDomain.h>
 #include <java/lang/Package.h>
 
+// Avoid including SystemClassLoader.h.
+extern "Java"
+{
+  namespace gnu
+  {
+    namespace gcj
+    {
+      namespace runtime
+      {
+        class SystemClassLoader;
+      }
+    }
+  }
+}
+
 // We declare these here to avoid including gcj/cni.h.
 extern "C" void _Jv_InitClass (jclass klass);
 extern "C" void _Jv_RegisterClasses (const jclass *classes);
@@ -237,7 +252,7 @@ jclass _Jv_GetArrayClass (jclass klass, java::lang::ClassLoader *loader);
 jboolean _Jv_IsInterpretedClass (jclass);
 jboolean _Jv_IsBinaryCompatibilityABI (jclass);
 
-void _Jv_CopyClassesToSystemLoader (java::lang::ClassLoader *);
+void _Jv_CopyClassesToSystemLoader (gnu::gcj::runtime::SystemClassLoader *);
 
 #ifdef INTERPRETER
 void _Jv_InitField (jobject, jclass, int);
@@ -498,7 +513,7 @@ private:
 
   friend void *::_Jv_ResolvePoolEntry (jclass this_class, jint index);
 
-  friend void ::_Jv_CopyClassesToSystemLoader (java::lang::ClassLoader *);
+  friend void ::_Jv_CopyClassesToSystemLoader (gnu::gcj::runtime::SystemClassLoader *);
 
   // Chain for class pool.  This also doubles as the ABI version
   // number.  It is only used for this purpose at class registration
index cfb0612..797005b 100644 (file)
@@ -1,6 +1,6 @@
 // natClassLoader.cc - Implementation of java.lang.ClassLoader native methods.
 
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -43,6 +43,7 @@ details.  */
 #include <java/lang/Cloneable.h>
 #include <java/util/HashMap.h>
 #include <gnu/gcj/runtime/BootClassLoader.h>
+#include <gnu/gcj/runtime/SystemClassLoader.h>
 
 // Size of local hash table.
 #define HASH_LEN 1013
@@ -253,14 +254,14 @@ _Jv_RegisterClass (jclass klass)
 // This is used during initialization to register all compiled-in
 // classes that are not part of the core with the system class loader.
 void
-_Jv_CopyClassesToSystemLoader (java::lang::ClassLoader *loader)
+_Jv_CopyClassesToSystemLoader (gnu::gcj::runtime::SystemClassLoader *loader)
 {
   for (jclass klass = system_class_list;
        klass;
        klass = klass->next_or_version)
     {
       klass->loader = loader;
-      loader->loadedClasses->put(klass->name->toString(), klass);
+      loader->addClass(klass);
     }
   system_class_list = SYSTEM_LOADER_INITIALIZED;
 }