From c500e5ec9f9e5775b633d93381282de9b55e789a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 9 Mar 2000 04:50:49 +0000 Subject: 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 --- libjava/java/lang/reflect/natArray.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libjava/java/lang') 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); -- cgit v1.1