prims.cc (_Jv_NewMultiArrayUnchecked): New method.

* prims.cc (_Jv_NewMultiArrayUnchecked): New method.
	(_Jv_NewMultiArray): Use it.  Check each array dimension.
	(_Jv_NewMultiArray): Likewise.
	* java/lang/reflect/natMethod.cc (can_widen): Nothing promotes to
	`char'.
	* java/lang/reflect/natArray.cc (newInstance): Throw
	IllegalArgumentException if there are no dimensions.

From-SVN: r45951
This commit is contained in:
Tom Tromey 2001-10-02 13:44:32 +00:00 committed by Tom Tromey
parent 6cbd1b6f7e
commit 62a040818a
4 changed files with 34 additions and 9 deletions

View file

@ -43,11 +43,12 @@ java::lang::reflect::Array::newInstance (jclass componentType, jint length)
}
jobject
java::lang::reflect::Array::newInstance (jclass componentType, jintArray dimensions)
java::lang::reflect::Array::newInstance (jclass componentType,
jintArray dimensions)
{
jint ndims = dimensions->length;
if (ndims == 0)
return componentType->newInstance ();
throw new java::lang::IllegalArgumentException ();
jint* dims = elements (dimensions);
if (ndims == 1)
return newInstance (componentType, dims[0]);

View file

@ -100,8 +100,8 @@ can_widen (jclass from, jclass to)
// Boolean arguments may not be widened.
if (fromx == BOOLEAN && tox != BOOLEAN)
return false;
// Special-case short->char conversions.
if (fromx == SHORT && tox == CHAR)
// Nothing promotes to char.
if (tox == CHAR && fromx != CHAR)
return false;
return fromx <= tox;