How to find super interface?

I am writing custom rule on java.
For example we have such situation:

public interface DocV extends VersionOf<Doc> {

The task is: to check DocV that it has all methods, that Doc has. Doc is public abstract class.

My current problem: I can’t get even Doc from DocV. I tried ((ParameterizedTypeTree) clazz.superInterfaces().get(0)) – it returns VersionOf. In debug I see that it has in children Doc, but there is no api to call children… even so, this Doc is InternalSyntaxToken, without its methods…

I also tried to find in context.getSemanticModel() – the same.


This information has not (yet?) been made available publicly in semantic API :

So you wont’ be able to check this with a custom rule as of today.

However I am puzzled by such a rule, shouldn’t you consider having a common interface between your two types to enforce this at compiler level ?

Hi @Nicolas_Peru!
Thanks for info. It’s a pity.
What about class loaders? How can I load class by myself using sonar api?
In my situation Doc and DocV are located in the same package.

It is a long story and restricted by NDA, but some words: this configuration used for versioning DTOs.

Archiving this topic due a lack of activity. If you have a similar problem please start a new topic. Thank you