title: Assertion fails on object copied using Kotlin copy
body: <p>This is a problem that has been really puzzling. For some reason, equals method fails here:</p>
  <pre><code>val newItem = testPlaylistItem.copy(id = returnedItem.id, index = 0, updatedAt = newPlaylistFromDb.updatedAt)
  assertEquals(newPlaylistFromDb, newItem)
  </code></pre>
  <p>As you can see, I'm just overwriting some properties that I know that change and I can't control (<code>id</code> isn't known since it's generated by the persistence and <code>index</code> and <code>updatedAt</code> are internally generated). Basically what I'm doing is ignoring them for the test at hand. This test is successful locally all the time but randomly fails when run by the compilation inside a Docker container (in CI pipeline). As displayed in the error, it shows a small difference: <code>2022-06-20T15:50:45.187Z</code> vs <code>2022-06-20T15:50:45.186Z</code>.</p>
  <p>What I've tried so far is decompiling the generated bytecode into Java and I can't see the reason why this could happen. Apparently the copy method would pass the instant parameter by reference to instantiate a new object.</p>
  <p>The stack and versions I'm using are:</p>
  <ul>
  <li>Docker image: openjdk:11.0.3-jre-slim</li>
  <li>Gradle 6.9.2</li>
  <li>Kotlin 1.4.10</li>
  </ul>