Let's say I have the following classes: ``` privat...
# announcements
v
Let's say I have the following classes:
Copy code
private data class Foo(
    val foo: String = "",
    val bar: String = ""
)

data class Bar(
    val foo: String = "",
    val bar: String = ""
)
Is there any particular reason why
kotlinc
doesn't generate a no-args constructor for private classes like
Foo
, but still generates it for public classes like
Bar
? Both classes are going to be instantiated via reflection using the default constructor, so I want it to be there. It's really weird that the presence of such constuctor is determined by the class visibility. Basically, I have two options here: 1. Declare clasess as
public
and leak some implementation details. 2. Mark the constuctor with
@JvmOverloads
and get a few more useless constructors. But what I really want is
kotlinc
to always generate a no-args constructor.
4