Not sure about this error ```Smart cast to 'LinkOr...
# codereview
e
Not sure about this error
Copy code
Smart cast to 'LinkOrigin.ActionButtonLink' is impossible, because 'event.origin' is a public API property declared in different module
LinkOrigin
is sealed class in the different module indeed. But why is it the problem?
k
It's because the
origin
property is defined in a different module, which is separately compiled, and therefore the compiler can't be sure that repeated accesses of this property will return the same value.
e
You mean that it doesn’t have kotlin meta data or this bytecode is java and could be changed?
k
A separately compiled module can be Kotlin or Java code, and in both cases smart casts are not applied on properties. I'm not sure if the Kotlin metadata on a property says whether or not it can return a different value between calls. But certainly a Java getXxxx() method can.
e
Thank you. I don’t remember it being the case before. Some inconvenience for sure.