Indirect Parents
The indirectParents parameter (parents(), hasParentClasses(), hasAllParentInterfacesOf() methods etc.) specifies whether or not to retrieve parents of the parent (indirect parents). By default, indirectParents is false e.g.
For the above inheritance hierarchy it is possible to retrieve:
Direct parents of
ClassC(ClassB):
Konsist
.scopeFromProject()
.classes()
.first { it.name == "ClassC" }
.parents() // ClassBAll parents present in the codebase hierarchy (
ClassBandClassA):
Konsist
.scopeFromProject()
.classes()
.first { it.name == "ClassC" }
.parents(indirectParents = true) // ClassB, ClassAParents declared outside the project codebase (library and Kotlin standard library types) are also returned. With indirectParents = true parents of such parents are read from the test classpath, so the library must be on it (parents missing from the classpath are skipped):
// Library
open class LibraryClass : LibraryInterface
interface LibraryInterface
// Project
class ClassD : LibraryClass()Last updated