Klutter `1.19.0` released which adds immutable pro...
# kohesive
released which adds immutable protectors for existing collections, based on a SO answer by @miensol provides a light-weight delegate around collections that prevents any avenue of modification including casting to a mutable type then modifying. And Klutter goes a step further by protecting sub collections such as iterator, listIterator, entrySet, etc. All of those doors are closed and using Kotlin delegation for most methods you take no hit in performance. Simply call
and the result is the same interface but protected. Code to steal, or use the
module: https://github.com/kohesive/klutter/blob/master/core-jdk6/src/main/kotlin/uy/klutter/core/common/Immutable.kt And with tests showing some of the tricks that allowed modifications before, but now do not, along with the blocked casts and calls using these wrappers. https://github.com/kohesive/klutter/blob/master/core-jdk6/src/test/kotlin/uy/klutter/core/collections/TestImmutable.kt