Fixed
Status Update
Comments
il...@google.com <il...@google.com>
jb...@google.com <jb...@google.com> #2
Looks to be the same issue as https://github.com/androidannotations/androidannotations/issues/1208 where after being parceled and unparceled, the type swaps to Parcelable[] which is indeed a different type than CustomModel[]. The same thing can be seen with Fragment destinations if you:
1. turn on the Developer Option of "Don't keep activities"
2. Navigate to the Fragment destination (it won't crash)
3. Hit the home button
4. Use the recents button to relaunch the app (it will crash)
It seems like the only viable work around is to create a new array of the correct type (CustomModel[]), then System.arraycopy() the objects over. We can do this automatically as part of the Args class. We should also double check to see if this same problem exists with Serializable.
1. turn on the Developer Option of "Don't keep activities"
2. Navigate to the Fragment destination (it won't crash)
3. Hit the home button
4. Use the recents button to relaunch the app (it will crash)
It seems like the only viable work around is to create a new array of the correct type (CustomModel[]), then System.arraycopy() the objects over. We can do this automatically as part of the Args class. We should also double check to see if this same problem exists with Serializable.
Description
Component used: Fragment
Version used: 1.5.0
Devices/Android versions reproduced on: N/A lint only
In newer versions of lint (seemingly 30.4.x, but possibly 30.3.x), there was an API change that breaks the DialogFragmentCallbacksDetector lint. This commit fixes it and the fix (
(node.sourcePsi as? KtClassOrObject)
) is backward compatible. It would be great if this could be backported to a patch release for 1.5.x.