elect
06/24/2022, 6:13 PMjava.lang.Boolean(true)
, which returns a boxed Boolean) won't be seen as different keys, that is they would be overwritten
how can I solve it?Vampire
06/24/2022, 6:14 PMVampire
06/24/2022, 6:14 PMelect
06/24/2022, 6:15 PMelect
06/24/2022, 6:15 PMVampire
06/24/2022, 6:18 PMYoussef Shoaib [MOD]
06/24/2022, 7:17 PMRef
type.
Something like this:
sealed class Ref
class IntRef(val value:Int): Ref
class BooleanRef(val value:Boolean): Ref
// etc.
Klitos Kyriacou
06/26/2022, 9:37 PMjava.lang.Boolean(true)
would indeed create a boxed instance with a unique reference. However, this constructor has been deprecated since Java 9, and may be removed in a future release. Also, you would have to use IdentityHashMap
if you use actual Boolean with different identities. Youssef's suggestion of creating your own boxing class is better. However, it seems a very odd thing to do, using keys that rely on referential identity. What is your use case? It sounds like an X-Y problem.Vampire
06/26/2022, 9:48 PMvalueOf
elect
06/29/2022, 4:32 PMresource "tls_locally_signed_cert" "example" {
...
}
resource "x" "y" {
booleanProp = tls_locally_signed_cert.example.ready_for_renewal
}
translated in Kotlin to:
val example by tls_locally_signed_cert {
...
}
val y by x {
booleanProp = example.ready_for_renewal
}
ready_for_renewal
is a Boolean
, but under the hood, when I synthesize the Terraform HCL language (first example), I need to retrieve the right string for booleanProp
elect
06/29/2022, 4:35 PMgetValue
till the next setValue
, which will grab all the strings (it might be a list) and then clear the top-level container prop