Eugen Martynov
12/12/2025, 11:35 AMmessageActionList =
requireArguments().getSerializableCompat(MESSAGE_ACTION_LIST) ?: emptyList()
// Unresolved reference. None of the following candidates is applicable because of a receiver type mismatch:
fun <reified T : Serializable> Bundle.getSerializableCompat(key: String): T?
Where messageActionList type is List<MessageAction> and MessageAction is Serializable. How to fix compilation error?Eugen Martynov
12/12/2025, 11:38 AMSerializable? Or how to understand itEugen Martynov
12/12/2025, 11:44 AMinline fun <reified T : Serializable> Bundle.getSerializableCompat(key: String): T? =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
getSerializable(key, T::class.java)
} else {
getSerializable(key) as? T
}dmitriy.novozhilov
12/12/2025, 11:56 AMrequireArguments() returns. The errors says about incompatible receiver type, not argument types.Eugen Martynov
12/12/2025, 11:58 AMrequireArguments() : Bundledmitriy.novozhilov
12/12/2025, 11:59 AMEugen Martynov
12/15/2025, 2:39 PMdmitriy.novozhilov
12/15/2025, 2:41 PM.zip achieve with a gradle project would be the ideal.Eugen Martynov
12/15/2025, 2:43 PMdmitriy.novozhilov
12/15/2025, 3:09 PMbundle.getSerializableCompat<List<Test>>("Test")
This one reports Type argument is not within its bounds: must be subtype of 'Serializable'. on the List<Test> type argument which is completely fair, as List is not inheritor of Serializabledmitriy.novozhilov
12/15/2025, 3:13 PM?: could slightly change. So previously it was inferred into something serializable and now it's just a List.
Could you please tell me what is the type of the messageActionList property from the original example?Eugen Martynov
12/15/2025, 3:16 PMprivate lateinit var messageActionList: List<MessageAction>Eugen Martynov
12/15/2025, 3:16 PMclass MessageAction :
Action(),
SerializableEugen Martynov
12/15/2025, 3:17 PMopen class Action(...): SerializableEugen Martynov
12/15/2025, 3:18 PMEugen Martynov
12/15/2025, 3:18 PMdmitriy.novozhilov
12/15/2025, 3:19 PMIt's a still list, so there shouldn't be much difference. Maybe there is some otherprivate lateinit var messageActionList: List<MessageAction>
getSerializableCompat function in the project which doesn't have an upper bound?Eugen Martynov
12/15/2025, 3:21 PMEugen Martynov
12/15/2025, 3:23 PMArrayList and it started compilingEugen Martynov
12/15/2025, 3:23 PMEugen Martynov
12/15/2025, 3:25 PMdmitriy.novozhilov
12/15/2025, 3:25 PM