diff options
Diffstat (limited to 'libjava/java/lang')
-rw-r--r-- | libjava/java/lang/reflect/natArray.cc | 11 |
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); |