I have a silly problem that getters of my properti...
# intellij
m
I have a silly problem that getters of my properties (and therefore also many `toString`s) have side effects, so when IJ debugger evaluates them, superfluous side effects occur. For now I disabled auto evaluation of `toString`s and properties, but ultimately I'd like to have them on. So instead, is there a way to write something like this?:
Copy code
var myReactiveProperty: Int
   get() {
      if (/*is-being-evaluated-by-IJ-debugger*/) {
         return field
      } else {
         fireSideEffects()
         return field
      }
   }
Although this is about my code, I think the same issue happens in Jetpack Compose when evaluating `MutableState`variables.
m
whenever you're debugging, don't you have to manually 'call' the getter whenever you want to see whats inside them? otherwise the debugger does exactly what a normal run would do no?
if that is the problem, you can do: _myReactiveProperty_field_ to check the field without doing the getter with sideeffects
m
IJ debugger calls the getter automatically by default, I just disabled that. And yes, I can instead see _`myReactiveProperty_field`. Except in my case these are delegated properties, so I need to first evaluate `myReactiveProperty$delegate`and then seek for the `value`property, which is doable, but inconvenient._ And then I also have nice `toString`s, which read the property directly (e.g.
override fun toString() = "(Prop1=$myReactiveProperty, Prop2=$myReactiveProperty2)"
)
I'd like to see them in debugger too, but right now they trigger the side effects.