You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
data classFrom (
valnonNullProperty:String = "I'm not nullable",
valnullProperty:String? = null
)
@NoArgsConstructor
data classTo(
valnonNullProperty:String,
valotherNonNullProperty:String = "I'm not nullable",
)
@Test
funrien() {
val shapeshift =ShapeShiftBuilder().withMapping<From, To> {
autoMap(AutoMappingStrategy.BY_NAME)
From::nullProperty mappedTo To::otherNonNullProperty
}.build()
checkNotNull(shapeshift.map<From, To>(From()).otherNonNullProperty)
}
I would assume that the resulting object had otherNonNullProperty with its default value, but it seems using the no-arg constructor from noArg kotlin plugin does not honor default values.
Any way to work around this? I'd rather not use an ObjectSupplier if that would be possible, this seems tedious and error-prone.
FYI, if all the members of To have a default value, it works fine.
The text was updated successfully, but these errors were encountered:
Given this code:
I would assume that the resulting object had
otherNonNullProperty
with its default value, but it seems using the no-arg constructor fromnoArg
kotlin plugin does not honor default values.Any way to work around this? I'd rather not use an ObjectSupplier if that would be possible, this seems tedious and error-prone.
FYI, if all the members of
To
have a default value, it works fine.The text was updated successfully, but these errors were encountered: