mirror of
https://github.com/corda/corda.git
synced 2025-02-07 19:40:25 +00:00
fix handling of interfaces in isAssignableFrom
The old version was both incorrect (in the case where both arguments are interfaces) and inefficient.
This commit is contained in:
parent
948a2523f1
commit
b3d65fab9b
@ -3176,13 +3176,12 @@ isAssignableFrom(Thread* t, object a, object b)
|
||||
}
|
||||
}
|
||||
|
||||
for (; b; b = classSuper(t, b)) {
|
||||
object itable = classInterfaceTable(t, b);
|
||||
if (itable) {
|
||||
for (unsigned i = 0; i < arrayLength(t, itable); i += 2) {
|
||||
if (arrayBody(t, itable, i) == a) {
|
||||
return true;
|
||||
}
|
||||
object itable = classInterfaceTable(t, b);
|
||||
if (itable) {
|
||||
unsigned stride = (classFlags(t, b) & ACC_INTERFACE) ? 1 : 2;
|
||||
for (unsigned i = 0; i < arrayLength(t, itable); i += stride) {
|
||||
if (arrayBody(t, itable, i) == a) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user