+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>
-/* Copyright (C) 2005 Free Software Foundation
+/* Copyright (C) 2005, 2006 Free Software Foundation
This file is part of libgcj.
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
// 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.
#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);
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);
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
// 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.
#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
// 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;
}