aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2001-03-23 16:21:24 -0800
committerPer Bothner <bothner@gcc.gnu.org>2001-03-23 16:21:24 -0800
commit7a3155bef708a70dfa72958ef23fc2356b20c8a2 (patch)
treea626528a671f9cc0f64d2951301f705afc0674a6 /libjava/java/lang
parent7238de5c34318c3f5e60a0b2021e54ffd40c8e57 (diff)
downloadgcc-7a3155bef708a70dfa72958ef23fc2356b20c8a2.zip
gcc-7a3155bef708a70dfa72958ef23fc2356b20c8a2.tar.gz
gcc-7a3155bef708a70dfa72958ef23fc2356b20c8a2.tar.bz2
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
Diffstat (limited to 'libjava/java/lang')
-rw-r--r--libjava/java/lang/natClass.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc
index b934ae7..5d74971 100644
--- a/libjava/java/lang/natClass.cc
+++ b/libjava/java/lang/natClass.cc
@@ -909,11 +909,8 @@ _Jv_LookupInterfaceMethodIdx (jclass klass, jclass iface, int method_idx)
jboolean
_Jv_IsAssignableFrom (jclass target, jclass source)
{
- if (source == target
- || (target == &ObjectClass && !source->isPrimitive())
- || (source->ancestors != NULL
- && source->ancestors[source->depth - target->depth] == target))
- return true;
+ if (source == target)
+ return true;
// If target is array, so must source be.
if (target->isArray ())
@@ -945,9 +942,15 @@ _Jv_IsAssignableFrom (jclass target, jclass source)
&& cl_idt->cls.itable[offset] == target)
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