Hey! I've created the following function:
fun setProp( currentValueGetter: () -> Int?, currentValueSetter: (Int?) -> Unit) {
// getting value
val oldValue = currentValueGetter();// setting value
currentValueSetter(10);
}
I'd like to use it inside property:
public var difference : Int? = null
get() = $difference
set(value) {
this.setProp({() -> $difference }, {(v: Int?) -> $difference = v });
};
Unfortunately, calling setProp causes exception:
java.lang.IllegalAccessError: tried to access field Model.UTPModel.difference from class Model.UTPModel$difference$1
I think it caused by using propery's backing field ($difference). It's a bug or by design? Can I access that field?