aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>2000-03-09 04:50:49 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-03-09 04:50:49 +0000
commitc500e5ec9f9e5775b633d93381282de9b55e789a (patch)
treeb38a57c29f2f7431998c23a31b1204a3dc189ea4 /libjava/java/lang
parent0f72dc9e314346054bc995d63dc4cc01e2770fab (diff)
downloadgcc-c500e5ec9f9e5775b633d93381282de9b55e789a.zip
gcc-c500e5ec9f9e5775b633d93381282de9b55e789a.tar.gz
gcc-c500e5ec9f9e5775b633d93381282de9b55e789a.tar.bz2
natArray.cc (newInstance): Don't allow array of `void' to be created.
* java/lang/reflect/natArray.cc (newInstance): Don't allow array of `void' to be created. From-SVN: r32443
Diffstat (limited to 'libjava/java/lang')
-rw-r--r--libjava/java/lang/reflect/natArray.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/libjava/java/lang/reflect/natArray.cc b/libjava/java/lang/reflect/natArray.cc
index e886f80..fd95368 100644
--- a/libjava/java/lang/reflect/natArray.cc
+++ b/libjava/java/lang/reflect/natArray.cc
@@ -1,6 +1,6 @@
// natField.cc - Implementation of java.lang.reflect.Field native methods.
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@@ -29,7 +29,14 @@ jobject
java::lang::reflect::Array::newInstance (jclass componentType, jint length)
{
if (componentType->isPrimitive())
- return _Jv_NewPrimArray (componentType, length);
+ {
+ // We could check for this in _Jv_NewPrimArray, but that seems
+ // like needless overhead when the only real route to this
+ // problem is here.
+ if (componentType == JvPrimClass (void))
+ throw new java::lang::IllegalArgumentException ();
+ return _Jv_NewPrimArray (componentType, length);
+ }
else
return JvNewObjectArray (length, componentType, NULL);