Index getAllKnownSubInterface
dufoli opened this issue · comments
olivier dufour commented
My need is to get all interface wich extends another interface.
The issue is that index is class oriented. So I can get subclass or class which implement an interface. But I found not solution to get interface which inherit from another.
example
interface A{
}
interface B extends A{
}
interface C extends B{
}
goal is to be abble to get C and B.
I try to use getAllKnownImplementors but it skip interface (I have check source)
I try to do my own method with a recurssive method:
void produceRecursiveProxies(IndexView index,
DotName interfaceDN,
BuildProducer<NativeImageProxyDefinitionBuildItem> proxies) {
index.getKnownDirectImplementors(interfaceDN).stream()
.filter(classinfo -> Modifier.isInterface(classinfo.flags()))
.map(ClassInfo::name)
.forEach((className) -> {
proxies.produce(new NativeImageProxyDefinitionBuildItem(className.toString()));
produceRecursiveProxies(index, className, proxies);
});
}
but getKnownDirectImplementors seems to not return the interface but only class... not sure ?
Best is to have a new function in indexer for that.
getKnownSubInterface
olivier dufour commented
the recurcive is working indeed, it was just that some things was not in the index.