:question: Is it possible to check if a constructo...
# konsist
p
Is it possible to check if a constructor parameters are all of type interface?
Copy code
Konsist.scopeFromProject()
            .classes()
            .primaryConstructors
            .parameters
            .assertTrue {
                // it.type == Interface
            }
The usecase for this is to check that the components that are injected are always the abstractions and never concrete implementations.
My current workaround is
Copy code
Konsist.scopeFromProject()
            .classes()
            .primaryConstructors
            .parameters
            .assertTrue {           Class.forName(it.type.fullyQualifiedName).isInterface
            }
t
This doesn’t seem to work for me, I get a
ClassNotFoundException
n
This will be possible in the next release which will be available soon 🙂
🙌 1