# ReenteringLazyValueComputationException in Kotlin 1.3.20

**URL:** <https://discuss.kotlinlang.org/t/reenteringlazyvaluecomputationexception-in-kotlin-1-3-20/11564>\
**Category:** Uncategorized\
**Created:** [February 13, 2019, 12:28am UTC](https://discuss.kotlinlang.org/t/reenteringlazyvaluecomputationexception-in-kotlin-1-3-20/11564 "2019-02-13T00:28:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebolwidt](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@ebolwidt](https://discuss.kotlinlang.org/u/ebolwidt)\
**Post date:** [February 13, 2019, 12:28am UTC](https://discuss.kotlinlang.org/t/reenteringlazyvaluecomputationexception-in-kotlin-1-3-20/11564/1 "2019-02-13T00:28:31Z")

</div>

I’m getting **ReenteringLazyValueComputationException** when I try to compile the following piece of code (an optimized method for a function that gets called very often). No idea why I would get that - code looks alright?

```
class FailedValidationResult(
    details: Collection<FailedValidationResult> = emptySet(),
    private val useDetailsOnly: Boolean = false
) {
    val details = details.mapInto { element, output ->
        if (element.useDetailsOnly)
            output.addAll(element.details)
        else
            output.add(element)
    }
}

private inline fun <E> Collection<E>.mapInto(
    action: (element: E, output: MutableCollection<E>) -> Unit
): Collection<E> {
    val result: MutableCollection<E> = ArrayList(this.size)
    this.forEach {
        action(it, result)
    }
    return result
}

```

---

<div class="post-metadata">

**Author:** ![Alexey.Belkov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/alexey.belkov/32/5215_2.png) [@Alexey.Belkov](https://discuss.kotlinlang.org/u/Alexey.Belkov)\
**Post date:** [February 13, 2019, 11:05am UTC](https://discuss.kotlinlang.org/t/reenteringlazyvaluecomputationexception-in-kotlin-1-3-20/11564/2 "2019-02-13T11:05:16Z")

</div>

Thank you, reported as [https://youtrack.jetbrains.com/issue/KT-29876](https://youtrack.jetbrains.com/issue/KT-29876)

Workaround: specify type of the property explicitly as `Collection<FailedValidationResult>`
