Hi everyone! I realised that I can’t use `@Parceli...
# android
e
Hi everyone! I realised that I can’t use
@Parcelize
on a nested data class. Why this restriction is present?
🤔 2
😮 1
s
I don't think there was such a restriction. Maybe if you could post the code sample with this case?
e
You are right. I was also surprised. But after a couple of experiments I am able to add Parcelize to the nested class. Sometimes it works, sometimes not. Looks like a bug in the kotlin plugin. For example I am taking a class, doing Cmd+A, Cmd+C + Cmd+V and it works on a copy, but doesn’t work in the source file. The same module, package, the same folder. I am confused and still trying to get stable example.
Ahah, reproduced finally:
Copy code
package com.test_parcelize

import com.test_parcelize.TestNestedParcelize.*

interface TestI<T : Any>

class TestNestedParcelize : TestI<State> {

    @Parcelize
    data class State(
            val isLoading: Boolean = false
    )
}
if I replace
TestNestedParcelize.*
to
TestNestedParcelize.State
everything works.
In the example above the kotlin plugin doesn’t work correctly