Ilya P
09/12/2024, 10:34 AMMapMessage
and it is possible to use from Java, but not from Kotlin.
So this java code works just fine and it is able to infer the type params of MapMessage (which are MapMessage<M extends MapMessage<M, V>, V>
, so there is a self capture there)
Logger l = LogManager.getLogger();
l.info(new MapMessage<>(Map.of("r", 1)));
While Kotlin code like this fails with Cannot infer type for this parameter. Please specify it explicitly.
Which is impossible to do.
val logger = LogManager.getLogger()
<http://logger.info|logger.info>(MapMessage(mapOf("key" to "value")))
Any help would be appreciated. I can use StringMapMessage
as that binds the first parameter to be itself, but that is limiting.Youssef Shoaib [MOD]
09/12/2024, 10:50 AMMapMesaage<*, _>(mapOf(...))
Ilya P
09/12/2024, 10:51 AMephemient
09/12/2024, 10:52 AMMapMessage<Nothing, _>(mapOf(...))
would workIlya P
09/12/2024, 10:54 AMephemient
09/12/2024, 10:54 AMIlya P
09/12/2024, 10:55 AMephemient
09/12/2024, 10:55 AMclass KotlinMapMessage<V>(map: Map<String, V>) : MapMessage<KotlinMapMessage<V>, V>(map)
and use that insteadephemient
09/12/2024, 10:55 AMIlya P
09/12/2024, 10:55 AMIlya P
09/12/2024, 10:55 AMIlya P
09/12/2024, 10:56 AMIlya P
09/12/2024, 10:56 AMIlya P
09/12/2024, 10:58 AMIlya P
09/12/2024, 10:58 AMephemient
09/12/2024, 10:58 AMM
might be, I'm not sureIlya P
09/12/2024, 10:59 AMIlya P
09/12/2024, 11:00 AM