<@U5UG5M2HY> Inner classes in Kotlin by default wo...
# android
g
@Loránd Inner classes in Kotlin by default work as static inner in java, so no implicit reference. To create inner class with implicit parent reference you should add “inner” modifier to a inner class
❤️ 3
w
@gildor this is healthy in terms of memory leaks, right? Pls can you shed more light on that?
g
Practically yes, inner classes without implicit reference to parent less often source of leak, because sometimes you forgot to add "static" to inner class in Java and inner class keeps reference. But it not a warranty from leaks, of course. And if you don't need reference to parent and, especially, access to private members of parent it's better to use inner class without reference to parent, so I think this is the reason why inner classes in Kotlin are static by default
w
Thanks.