cashapp / cashapp/tempest

Ambiguous error message when dealing with immutable properties

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
90
Forks
42
Avg merge
46m
Merged PRs (30d)
1

Description

As we discussed on Slack, I ran into this stacktrace:
```
class kotlin.reflect.jvm.internal.KProperty1Impl cannot be cast to class kotlin.reflect.KMutableProperty1 (kotlin.reflect.jvm.internal.KProperty1Impl and kotlin.reflect.KMutableProperty1 are in unnamed module of loader 'app')
java.lang.ClassCastException: class kotlin.reflect.jvm.internal.KProperty1Impl cannot be cast to class kotlin.reflect.KMutableProperty1 (kotlin.reflect.jvm.internal.KProperty1Impl and kotlin.reflect.KMutableProperty1 are in unnamed module of loader 'app')
at app.cash.tempest.internal.Binding.setDb(Codec.kt:188)
```

which didn't make it very obvious that the root cause was that I needed to change a `val` to a `var`.

Contributor guide

Open the contributing guide

Research direction

Start at Codec.kt:188, where Binding.setDb triggers the ClassCastException, and trace how immutable properties are handled during binding. The error should make clear that a val cannot be assigned and that changing it to a var is required; verify the resulting message against the reported stacktrace.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.