Constructor with default parameters


Good day, all.
While using both java and kotlin classes I ran into some inconvenient approaches, to pass null values to unnecessary fields in primary constructors in data classes.
I am a newer in using both java and kotlin languages in the same proect.
So, the idea is generate builder, which contains val-fields in constructor, even if they have default values and var fields, which not contains default values, and builder methods which can change variables with default values.


You can use usual constructor with named parameters and default values. For better Java interoperability you can decorate these constructors with @JvmOverloads. The compiler will generate overloaded variants of decorated constructors.