Rule Definition
Referencing down the inheritance tree is against Object-Oriented coding practices. It is a way of having two-way inheritance between class and subclass. This is an indication of poor class design and use of class inheritance. Such practices increase the complexity of the application.
Remediation
Review the design of the Class hierarchy.
Violation Code Sample
class SuperClass {
func m1(item) {
if item is SubClass { // violation: reference to SubClass
// ...
}
}
}
class SubClass : SuperClass {
// ...
}
Related Technologies
Technical Criterion
CWE-1062 - Parent Class with References to Child Class
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.