This playground example from the design notes on K...
# announcements
e
This playground example from the design notes on KEEP-237 (value classes) behaves differently on v1.5.0 and v1.4.30: https://github.com/Kotlin/KEEP/blob/497c86126b7320f3651807eb070f5efe80bcdb3a/notes/value-classes.md#L123-L135 (note that you might have to change the playground settings before running for it to work as expected) It prints
Copy code
true
false
on v1.4.30, but on v1.5.0 it prints
Copy code
true
true
Why? What part of the v1.5.0 release changed this behaviour?
e
probably JVM change. https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#valueOf-int-
This method will always cache values in the range -128 to 127, inclusive, and may cache other values outside of this range.
... or maybe not, I see
(0..Integer.MAX_VALUE).first { System.identityHashCode(it) != System.identityHashCode(it) }
returns 128 on Playground. maybe optimizer got smarter