I'm writing a custom check to see if some classes conform to our architecture , one of the rules states that if a class has a certain prefix to it's name , it must inherit a certain type of servlet directly or indirectly.
the available checks don't cover this case and the indirect inheritance is proving to be a challange to test because i can't find a way to get the Ast tree of the first inherited class so patterns like this:
- dummyClass1 extends dumDummy
- dumDummy extends realyImportantClass
are going unchecked. The question is:
- How can i access the Ast tree of the inherited class?
- The first idea was to get the .class to the first inherited class and check it , can it be done?
- Can Checkstyle get the Ast tree from a .class file?
Thanks in advance , please warn me if the question was unclear , i'll be happy to provide as much information as possible