I have the following code: ```object TestConfig { ...
# getting-started
v
I have the following code:
Copy code
object TestConfig {
  val ENV_UNDER_TEST by lazy { ... }
}
It’s a global variable I’m using in the project that stores the environment name under test. Is it possible to change that variable during the runtime? maybe with reflection or somehow else? I do understand that it’s not supposed to be changed and that it’s a dirty hack, so I accept that risk.
r
"val" stands for immutability. You could use property delegation, however, and override the getValue-Operator which might return the value of a mutable backing field. But if TestConfig can be modified why not make it a data class and use .copy it if needed?
👍 1