Hi,
I'm trying to implement the builder validation process for EMF Facet project.
We need the EMF Facet query to implement IJavaModelQuery interface.
Until now, our builder was checking that the query class was directly implementing this interface.
Using:
IType type = myJavaProject.findType(query.getImplementationClassName());
String[] superInterfaceTypeSignatures = type.getSuperInterfaceTypeSignatures();
for (String superInterfaceTypeSignature : superInterfaceTypeSignatures) {
String typeErasure = Signature.getTypeErasure(superInterfaceTypeSignature);
String implementedInterface = Signature.getSignatureSimpleName(typeErasure);
}
I was able to check that implementedInterface contains 'IJavaModelQuery ' String
The 'IJavaModelQuery' might also be implemented by the query superClass.
So this is what I try :
IType type = myJavaProject.findType(query.getImplementationClassName());
// SuperClass resolution
String[][] resolutionResult = type.resolveType(type.getSuperclassName());
String superClassName = Signature.toQualifiedName(resolutionResult[0]);
IType superClassType = myJavaProject.findType(superClassName);
This piece of code works as long as my hierarchy is simple.
ClassA extends ClassB
ClassB implements IJavaModelQuery
As soon as I add a hierarchy level, 'resolutionResult ' is null when I try to resolve ClassC from ClassB, but I can't figure out why
ClassA extends ClassB
ClassB extends ClassC
ClassC implements IJavaModelQuery
Is there an easiest way to check a class hierarchy ?
Does someone know why the class resolution is not working for ClassC ?
Regards,
Nicolas Guyomar