# Binary compatibility for constructors with default values

**URL:** <https://discuss.kotlinlang.org/t/binary-compatibility-for-constructors-with-default-values/11385>\
**Category:** Uncategorized\
**Created:** [January 30, 2019, 2:45pm UTC](https://discuss.kotlinlang.org/t/binary-compatibility-for-constructors-with-default-values/11385 "2019-01-30T14:45:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hr\_flick](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/hr_flick/32/6015_2.png) [@hr\_flick](https://discuss.kotlinlang.org/u/hr_flick)\
**Post date:** [January 30, 2019, 2:45pm UTC](https://discuss.kotlinlang.org/t/binary-compatibility-for-constructors-with-default-values/11385/1 "2019-01-30T14:45:42Z")

</div>

Hi.

When I add a new property Y with a default value to data class D that previously only had property X i would expect that previously compiled code P that depended on constructor D(X) would not be affected. This does not seem to be the case.

When I load the updated library containing D and the unchanged library containing P the code in P that is instantiating D fails with something akin to  
NoSuchMethodError: D.\<init\>(X;DefaultConstructorMarker)

If I recompile P it starts to work again.  
I tried to make the change to D binary backwards compatible by adding the @JvmOverloads annotation to the constructor but that does not help since the signature of the primary constructor changes.

Is this to be expected? Are there any reasonable workarounds I can use to avoid having to recompile all libraries that depends on D?
