diff options
| author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-24 00:21:24 +0000 |
|---|---|---|
| committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-24 00:21:24 +0000 |
| commit | 45cb76f4145003d0f08392064a40452ced0cf59a (patch) | |
| tree | a626528a671f9cc0f64d2951301f705afc0674a6 /libjava/java | |
| parent | 5c144a30ab68a06ec67aba76d88721ca009ce65c (diff) | |
| download | ppe42-gcc-45cb76f4145003d0f08392064a40452ced0cf59a.tar.gz ppe42-gcc-45cb76f4145003d0f08392064a40452ced0cf59a.zip | |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40797 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java')
| -rw-r--r-- | libjava/java/lang/natClass.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc index b934ae76389..5d7497109af 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 |

