mirror of
https://github.com/corda/corda.git
synced 2025-06-14 13:18:18 +00:00
fix Class.getInterfaces to return only declared interfaces
Previously, we returned all interfaces implemented directly or indirectly, which did not match the JDK behavior.
This commit is contained in:
@ -377,19 +377,18 @@ public final class Class <T> implements Type, AnnotatedElement {
|
||||
}
|
||||
|
||||
public Class[] getInterfaces() {
|
||||
if (vmClass.interfaceTable != null) {
|
||||
Classes.link(vmClass);
|
||||
|
||||
int stride = (isInterface() ? 1 : 2);
|
||||
Class[] array = new Class[vmClass.interfaceTable.length / stride];
|
||||
for (int i = 0; i < array.length; ++i) {
|
||||
array[i] = SystemClassLoader.getClass
|
||||
((VMClass) vmClass.interfaceTable[i * stride]);
|
||||
ClassAddendum addendum = vmClass.addendum;
|
||||
if (addendum != null) {
|
||||
Object[] table = addendum.interfaceTable;
|
||||
if (table != null) {
|
||||
Class[] array = new Class[table.length];
|
||||
for (int i = 0; i < table.length; ++i) {
|
||||
array[i] = SystemClassLoader.getClass((VMClass) table[i]);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
return array;
|
||||
} else {
|
||||
return new Class[0];
|
||||
}
|
||||
return new Class[0];
|
||||
}
|
||||
|
||||
public native Class getEnclosingClass();
|
||||
|
Reference in New Issue
Block a user