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
This commit is contained in:
Tom Tromey 2000-03-09 04:50:49 +00:00 committed by Tom Tromey
parent 0f72dc9e31
commit c500e5ec9f
5 changed files with 68 additions and 24 deletions

View file

@ -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);