summaryrefslogtreecommitdiff
path: root/libjava/prims.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2001-12-16 22:28:35 +0000
committerTom Tromey <tromey@gcc.gnu.org>2001-12-16 22:28:35 +0000
commit68940f3f3c1c6011be4434d30e1e1f8548be7b7d (patch)
tree40b6d3dc40874ea7045518f5a5d294ffddf0cf1f /libjava/prims.cc
parent495513eea640d4135f4b62f341bc844a09779df7 (diff)
downloadgcc-68940f3f3c1c6011be4434d30e1e1f8548be7b7d.tar.gz
For PR java/5088:
* java/lang/natClassLoader.cc (_Jv_InitNewClassFields): New function. (_Jv_NewClass): Use it. (defineClass0): Use it. * prims.cc (_Jv_InitPrimClass): Adjust vtable here. (_Jv_InitPrimClass): Use _Jv_InitNewClassFields. (_Jv_NewArray): Don't abort; just throw exception. Include InternalError.h. * java/lang/Class.h (Class::Class): Declare, don't define. (Class): Declare _Jv_InitNewClassFields as a friend. (union _Jv_Self): Removed. From-SVN: r48081
Diffstat (limited to 'libjava/prims.cc')
-rw-r--r--libjava/prims.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/libjava/prims.cc b/libjava/prims.cc
index 40d1bd66f81..279e3caad02 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -56,6 +56,7 @@ details. */
#include <java/lang/ArrayIndexOutOfBoundsException.h>
#include <java/lang/ArithmeticException.h>
#include <java/lang/ClassFormatError.h>
+#include <java/lang/InternalError.h>
#include <java/lang/NegativeArraySizeException.h>
#include <java/lang/NullPointerException.h>
#include <java/lang/OutOfMemoryError.h>
@@ -533,8 +534,8 @@ _Jv_NewArray (jint type, jint size)
case 10: return JvNewIntArray (size);
case 11: return JvNewLongArray (size);
}
- JvFail ("newarray - bad type code");
- return NULL; // Placate compiler.
+ throw new java::lang::InternalError
+ (JvNewStringLatin1 ("invalid type code in _Jv_NewArray"));
}
// Allocate a possibly multi-dimensional array but don't check that
@@ -613,9 +614,14 @@ _Jv_InitPrimClass (jclass cl, char *cname, char sig, int len,
{
using namespace java::lang::reflect;
- // We must initialize every field of the class. We do this in the
- // same order they are declared in Class.h, except for fields that
- // are initialized to NULL.
+ _Jv_InitNewClassFields (cl);
+
+ // We must set the vtable for the class; the Java constructor
+ // doesn't do this.
+ (*(_Jv_VTable **) cl) = java::lang::Class::class$.vtable;
+
+ // Initialize the fields we care about. We do this in the same
+ // order they are declared in Class.h.
cl->name = _Jv_makeUtf8Const ((char *) cname, -1);
cl->accflags = Modifier::PUBLIC | Modifier::FINAL | Modifier::ABSTRACT;
cl->method_count = sig;