I have two separate files with both declaring ```...
# getting-started
u
I have two separate files with both declaring
Copy code
@Serializable
private data object LoginNavKey : NavKey
and I'm getting a
Redeclaration: data object LoginNavKey : NavKey
comp time error. Why? They're both private, there is no redeclaration in respective files
p
Even these classes are private, for JVM they will have the same name. JVM class name for class Test in file a/b/c.kt will be a.b.Test
So if you have another Test class in a/b/d.kt it will have the same name a.b.Test
u
okay so it's fundamentally different from say (top level) functions?
p
Top level functions and variables are compiled for JVM as members of generated by Kotlin class with name as file name with Kt suffics.
u
I see
so the easiest way to "dedupe" is to have different packages, right?
p
For examle if you have val x in a/b/test.kt it will be static member of class a.b.TestKt
u
yea makes sense now
p
Right
u
gotcha thank you