amazon-ion / ion-element-kotlin

IonElement is an immutable in-memory representation of the Ion data format. IonElement's API is idiomatic to Kotlin.
Apache License 2.0
8 stars 7 forks source link

`AnyElement` needs a narrowing override of `copy` #36

Closed dlurton closed 4 years ago

dlurton commented 4 years ago

Such as the following.

override fun copy(annotations: List<String> = this.annotations, metas: MetaContainer = this.metas): AnyElement

This has a narrower return type than the copy on IonElement and would prevent the need for clients to need to call .asAnyElement() on the return value.

dlurton commented 4 years ago

Actually, this is not possible since the narrower IonElement implementations already has a covariant return type which is narrowed.