https://kotlinlang.org logo
#android
Title
# android
t

tevjef

12/08/2018, 9:57 PM
Does anyone know if there is a an Intellij inspection or a lint rule that can mark dependencies as unused?
Copy code
class SomeActivity @Inject constructor() {
    @Inject
    lateinit var notUsed: UnusedClass
}
Over the years, classes have built up with unused dagger classes
@Inject
properties . It’s hard to clean this up manually over an entire codebase.
r

rkeazor

12/08/2018, 10:02 PM
Not sure what you mean by “classes have built up unused dagger classes”.If your trying to suppress a warning you can do @SuppressWarnings(“unused”)
If your just trying to find them with a static analysis tool, There are third party libraries like klint that will pick up on that
There is also a errorprone , which can give dagger optimization suggestions
j

jw

12/08/2018, 10:06 PM
error prone is for Java
👍 1
r

rkeazor

12/08/2018, 10:09 PM
ahh I see, so there is no kotlin integration for it
j

jw

12/08/2018, 10:10 PM
it's a Java compiler
t

tevjef

12/08/2018, 10:23 PM
Not sure what you mean by “classes have built up unused dagger classes”.
Sorry, I’ve updated the grammar.
👍 1
r

rkeazor

12/08/2018, 10:32 PM
Interesting, even though I have used it in a codebase that had both Java and Kotlin, and it was still able to issue code improvement suggestions to the dagger modules.
@tevjef yea if lint is not working for you, just look into a 3rd party static analysis tool.