Commit 7a3155be by Per Bothner Committed by Per Bothner

natClass.cc (_Jv_IsAssignableFrom): Checking the ancestors array is invalid for interfaces...


	* java/lang/natClass.cc (_Jv_IsAssignableFrom):  Checking the
	ancestors array is invalid for interfaces, so do that *after*
	check that the target type is not an interface.

From-SVN: r40797
parent 7238de5c
2001-03-23 Per Bothner <per@bothner.com>
* java/lang/natClass.cc (_Jv_IsAssignableFrom): Checking the
ancestors array is invalid for interfaces, so do that *after*
check that the target type is not an interface.
2000-03-23 Jeff Sturm <jsturm@one-point.com> 2000-03-23 Jeff Sturm <jsturm@one-point.com>
* prims.cc (_Jv_FindClassFromSignature): Check return of * prims.cc (_Jv_FindClassFromSignature): Check return of
......
...@@ -909,11 +909,8 @@ _Jv_LookupInterfaceMethodIdx (jclass klass, jclass iface, int method_idx) ...@@ -909,11 +909,8 @@ _Jv_LookupInterfaceMethodIdx (jclass klass, jclass iface, int method_idx)
jboolean jboolean
_Jv_IsAssignableFrom (jclass target, jclass source) _Jv_IsAssignableFrom (jclass target, jclass source)
{ {
if (source == target if (source == target)
|| (target == &ObjectClass && !source->isPrimitive()) return true;
|| (source->ancestors != NULL
&& source->ancestors[source->depth - target->depth] == target))
return true;
// If target is array, so must source be. // If target is array, so must source be.
if (target->isArray ()) if (target->isArray ())
...@@ -945,9 +942,15 @@ _Jv_IsAssignableFrom (jclass target, jclass source) ...@@ -945,9 +942,15 @@ _Jv_IsAssignableFrom (jclass target, jclass source)
&& cl_idt->cls.itable[offset] == target) && cl_idt->cls.itable[offset] == target)
return true; return true;
} }
return false;
} }
return false; if ((target == &ObjectClass && !source->isPrimitive())
|| (source->ancestors != NULL
&& source->ancestors[source->depth - target->depth] == target))
return true;
return false;
} }
// Interface type checking, the slow way. Returns TRUE if IFACE is a // Interface type checking, the slow way. Returns TRUE if IFACE is a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment