---
title: "What’s happening in this Kotlin code?"
url: https://daily.dev/posts/what-s-happening-in-this-kotlin-code--im5viouff
source_url: https://www.youtube.com/watch?v=wq8X9YrmooU
type: video:youtube
source: "Google for Developers"
published: 2026-06-29T13:11:27.900Z
updated: 2026-06-29T13:11:45.683Z
tags: ["kotlin"]
reading_time: 1
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# What’s happening in this Kotlin code?

**[Google for Developers](https://daily.dev/sources/googledevelopers)** · 1 min read · 0 upvotes · 0 comments

## Summary

A Kotlin code puzzle where creating a new user from an existing one and adding a role to the new user unexpectedly also grants that role to the original user. The challenge asks developers to identify the bug, which likely involves shallow copying and shared object references rather than a true deep copy.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=wq8X9YrmooU>

---

Tags: [#kotlin](https://daily.dev/tags/kotlin)

[View this post on daily.dev](https://daily.dev/posts/what-s-happening-in-this-kotlin-code--im5viouff)
