diff --git a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/OpenAddressLinearProbingHashTable.kt b/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/OpenAddressLinearProbingHashTable.kt index c792adf54ec..f8c18f42a30 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/OpenAddressLinearProbingHashTable.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/util/slicedMap/OpenAddressLinearProbingHashTable.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.util.slicedMap +import java.util.* import java.util.function.BiConsumer // binary representation of fractional part of phi = (sqrt(5) - 1) / 2 @@ -126,7 +127,24 @@ internal class OpenAddressLinearProbingHashTable : AbstractMut } override val entries: MutableSet> - get() = throw IllegalStateException("OpenAddressLinearProbingHashTable::entries is not supported and hardly will be") + get() { + if (@Suppress("ConstantConditionIf") DEBUG) { + return Collections.unmodifiableSet(mutableSetOf>().apply { + forEach { key, value -> add(Entry(key, value)) } + }) + } + + throw IllegalStateException("OpenAddressLinearProbingHashTable::entries is not supported and hardly will be") + } + + private class Entry(override val key: K, override val value: V) : MutableMap.MutableEntry { + override fun setValue(newValue: V): V = throw UnsupportedOperationException("This Entry is not mutable.") + } + + companion object { + // Change to "true" to be able to see the contents of the map in debugger views + private const val DEBUG = false + } } private fun put(array: Array, aShift: Int, key: Any, value: Any?): Boolean {