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 8 forks source link

Ensure that all empty PersistentLists are the same instance. #91

Closed popematt closed 5 months ago

popematt commented 5 months ago

Issue #, if available:

None

Description of changes:

There's a problem in kotlinx.collections.immutable (described in https://github.com/Kotlin/kotlinx.collections.immutable/pull/176) that was causing ion-element-kotlin to unnecessarily allocate large numbers of empty lists for unannotated values (and anywhere else that had a possibly-empty list).

Unfortunately, we won't be able to use the fix from that PR until we can update ion-element-kotlin to Kotlin >= 1.9. This adds our own extension functions to work around the bug.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 88.37209% with 5 lines in your changes are missing coverage. Please review.

:exclamation: No coverage uploaded for pull request base (master@5b9ec91). Click here to learn what that means.

Files Patch % Lines
src/com/amazon/ionelement/api/Ion.kt 81.48% 4 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #91 +/- ## ========================================= Coverage ? 90.01% Complexity ? 496 ========================================= Files ? 31 Lines ? 1062 Branches ? 157 ========================================= Hits ? 956 Misses ? 63 Partials ? 43 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.