Code RoomKotlin null safety trap
HardPrep Room Coding #4238

Kotlin null safety trap

Vibe & agenticCode quality & reviewSenior–Staff~22 min

You're migrating an Android service layer from Java to Kotlin and let an AI agent auto-convert files. The converted Kotlin compiles and you ship it to the beta channel, where you start seeing a spike in NullPointerExceptions that the old Java code 'never had.' Below is the kind of signature the agent produced — explain the trap.

Implement
audit_kotlin_nullability(entries: list[str]) → list[str]
Examples
in[["loadProfile|none|UserProfile|true","findAll|nonnull|List<User>|false","lookup|nullable|Token?|true"]]out["loadProfile"]
in[["saveDraft|nonnull|Draft|true"]]out["saveDraft"]
in[[]]out[]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 22 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.