diff options
author | Tom Tromey <tromey@redhat.com> | 2002-06-20 15:10:49 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2002-06-20 15:10:49 +0000 |
commit | 04a704a4aafd2da62601578e9bdd7928aec45fd0 (patch) | |
tree | 5fe7164c297cc6a841a25c673434a465963b9818 /libjava/resolve.cc | |
parent | aa16c0facca1a54d453555e97546b941f197c661 (diff) | |
download | gcc-04a704a4aafd2da62601578e9bdd7928aec45fd0.zip gcc-04a704a4aafd2da62601578e9bdd7928aec45fd0.tar.gz gcc-04a704a4aafd2da62601578e9bdd7928aec45fd0.tar.bz2 |
For PR libgcj/7073:
* resolve.cc (_Jv_PrepareClass): Only resolve superclass if it
exists.
* defineclass.cc (handleClassBegin): Superclass for interface is
`null'.
From-SVN: r54835
Diffstat (limited to 'libjava/resolve.cc')
-rw-r--r-- | libjava/resolve.cc | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/libjava/resolve.cc b/libjava/resolve.cc index fba6cba..f558755 100644 --- a/libjava/resolve.cc +++ b/libjava/resolve.cc @@ -516,11 +516,14 @@ _Jv_PrepareClass(jclass klass) if (klass->state >= JV_STATE_PREPARED) return; - // make sure super-class is linked. This involves taking a lock on - // the super class, so we use the Java method resolveClass, which will - // unlock it properly, should an exception happen. + // Make sure super-class is linked. This involves taking a lock on + // the super class, so we use the Java method resolveClass, which + // will unlock it properly, should an exception happen. If there's + // no superclass, do nothing -- Object will already have been + // resolved. - java::lang::ClassLoader::resolveClass0 (klass->superclass); + if (klass->superclass) + java::lang::ClassLoader::resolveClass0 (klass->superclass); _Jv_InterpClass *clz = (_Jv_InterpClass*)klass; @@ -529,8 +532,12 @@ _Jv_PrepareClass(jclass klass) int instance_size; int static_size; - // java.lang.Object is never interpreted! - instance_size = clz->superclass->size (); + // Although java.lang.Object is never interpreted, an interface can + // have a null superclass. + if (clz->superclass) + instance_size = clz->superclass->size(); + else + instance_size = java::lang::Object::class$.size(); static_size = 0; for (int i = 0; i < clz->field_count; i++) @@ -646,9 +653,6 @@ _Jv_PrepareClass(jclass klass) jclass super_class = clz->getSuperclass (); - if (super_class == 0) - throw_internal_error ("cannot handle interpreted base classes"); - for (int i = 0; i < clz->method_count; i++) { _Jv_Method *this_meth = &clz->methods[i]; @@ -708,6 +712,10 @@ _Jv_PrepareClass(jclass klass) while (effective_superclass && effective_superclass->vtable == NULL) effective_superclass = effective_superclass->superclass; + /* If we ended up without a superclass, use Object. */ + if (! effective_superclass) + effective_superclass = &java::lang::Object::class$; + /* copy super class' vtable entries. */ if (effective_superclass && effective_superclass->vtable) for (int i = 0; i < effective_superclass->vtable_method_count; ++i) |